0% found this document useful (0 votes)
36 views14 pages

In House Summer Training 2023: Assignment: 3

1. The document outlines an in-house summer training program for the Department of Computer Science and Engineering. 2. It provides details on 4 coding assignments for a student named Divya Parkash Singh Jasrotia, including creating a registration page, login page, welcome/profile page, and updating the profile page. 3. For each assignment, the document provides the required code and functionality, such as allowing registration with validations, login with email or phone, displaying user information, and allowing profile editing.

Uploaded by

valorant.1473
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views14 pages

In House Summer Training 2023: Assignment: 3

1. The document outlines an in-house summer training program for the Department of Computer Science and Engineering. 2. It provides details on 4 coding assignments for a student named Divya Parkash Singh Jasrotia, including creating a registration page, login page, welcome/profile page, and updating the profile page. 3. For each assignment, the document provides the required code and functionality, such as allowing registration with validations, login with email or phone, displaying user information, and allowing profile editing.

Uploaded by

valorant.1473
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

In House Summer Training 2023

DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

Assignment : 3

Student Name: Divya Parkash Singh Jasrotia UID: 21BCS10446


Branch: BE-CSE Semester: 5th
Total Marks: 10 Subject Name: Web Dev

5-10 Questions hands on practical/Theory/Project based

1) Create a Registration Page with Name,Email,Phone


Number,Address,City,State,Pin code,Gender and a checkbox
(Agreement) don’t allow to enter duplicate and print message user
already exists.

Code:
In House Summer Training 2023
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

<html>
<head>
<title>SignUp</title>

<link rel="stylesheet" href="quiz.css">

<style>
*{
color:white;
}
#fr{
margin-top:90px; margin-right: 70px;
}
.in{
margin:17px; color:black;
} #n{
margin-left:80px;
} .w{
margin-left:40px;

</style>
</head>
<body>
</body>

<div id="outer">
<div id="con">
Welcome to QuizTech!!<br><br>
QuizTech is a platform for you to evaluate your intelligence in the feild of technology. We
have quizzes for three most integral domains of Computer Science .<br>
<br>Concept refreshing quizzes for Java, Web Development and DSA for you.

</div>

<form id="fr" action="sign.php" method="post" enctype="multipart/form-data" >


In House Summer Training 2023
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

<input class="in" type="text" name="namee" placeholder="Enter your name" />


<input class="in" type="text" name="phone" placeholder="Enter phone number" />
<input class="in" type="email" name="email" placeholder="Enter email" />
<input class="in" type="text" name="desi" placeholder="Your Designation" />
<input class="in" type="password" name="pass" placeholder="Enter Password" />

<input class="in" id="btn" type="submit" name="ok" value="Sign Up" />


<a id="n" href="log.php" >Already signed in?</a><br>

<?php
if(isset($_POST['ok'])){

$name=$_POST['namee'];
$phone=$_POST['phone'];
$email=$_POST['email'];
$desi=$_POST['desi'];
$pass=$_POST['pass'];

$con= mysqli_connect("localhost","root","","signup"); if(!$con){


echo "Error in connection";
}
$res=mysqli_query($con, "INSERT INTO `quiz`( `name`, `phone`, `email`, `Desi`,
`pass`) VALUES ('$name','$phone','$email','$desi','$pass')");
$a= mysqli_affected_rows($con);
?>

<span class= "w">


<?php
if($a==1)
{
echo "Successfully Signed In!!";
}
else
{

echo "Username or phone number already exists!!";


In House Summer Training 2023
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

mysqli_close($con);

}
?>
<span>
</form>
</div>
</body>
</html>

Database:
In House Summer Training 2023
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

2) Create a Login page with working session user can login with
Email or phone number.

Code:

<?php session_start(); if(isset($_SESSION['id']))


{
header("Location:profile.php");
}

?>
<html>
<head>
In House Summer Training 2023
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

<title>Login</title>
<link rel="stylesheet" href="quiz.css">
<style> *{ color:white;
}
.in{
color:black;
}

.w{ margin-left:47px;

}
</style>

</head>
<body>
</body>

<div id="outer">
<div id="con">
Welcome to QuizTech!!<br><br>
QuizTech is a platform for you to evaluate your intelligence in the feild of technology. We
have quizzes for three most integral domains of Computer Science .<br> <br>Concept
refreshing quizzes for Java, Web Development and DSA for you.

</div>
<form id="fr" action="log.php" method="post">
<input class="in" type="text" name="email" placeholder="Enter email or phone " /><br>
<input class="in" type="password" name="pass" placeholder="Enter Password" /><br>
<input class="in" id="btn" type="submit" name="ok" value="Login" /><br>
<a id="n" href="sign.php">New User?</a> <br>
<?php

if(isset($_POST['ok'])){

$email= $_POST['email'];
$pass= $_POST['pass'];

$con= mysqli_connect("localhost","root","","signup");
In House Summer Training 2023
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

$res= mysqli_query($con, "SELECT * from `quiz` where email='$email'");


?>

<span class= "w">


<?php
if(mysqli_num_rows($res)>=1)
{
while($arr=mysqli_fetch_array($res))
{
if($arr['pass']==$pass)
{
$_SESSION['id'] = $arr['id'];
header("Location:profile.php");
}
else{
echo "Password entered is wrong";
}

} else }
{
} echo "Username is wrong";

}
?>
<span>
</form>
</div>
</body>
</html>
In House Summer Training 2023
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

3) Create a welcome page with profile picture and user can Edit his/her
information but can’t change the email and phone number. User can
update his/her profile picture.

Code:

<?php
include 'headerr.php';
?>

<div id="info">

<div id="pp">
<img src="<?php echo $arr['photo'];?>">
</div>

<div id="in"> <span> Name:


<?php
In House Summer Training 2023
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

echo $arr['name'];
?>
</span> <span> Phone No:
<?php

echo $arr['phone'];
?>
</span> <span> Email:
<?php

echo $arr['email'];
?>
</span>
</div>

</div>

<div id="score">

<table id="t" style="padding: 30px;text-align: center; color: white; width: 100%;" > <tr>
<th>Subject</th>
<th>Java</th>
<th>Web Dev</th>
<th>DSA</th>

</tr>
<tr>

<td>Recent Score </td>


<td><?php echo $arr['jscore'];?></td>
<td><?php echo $arr['wscore'];?></td>
<td><?php echo $arr['dscore'];?></td>

</tr>
In House Summer Training 2023
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

</table>

</div>

<div class="b" >


<a href="up.php"> Update Profile </a>
</div>

<div class="b" >


<a href=" del.php?id=<?php echo $arr['id']; ?> " > Delete Profile </a> </div>

<div class="b" >


<a href="logoutt.php"> Logout </a>
</div>
</div>

</div>
</body>
</html>
In House Summer Training 2023
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

4) Your Layout looks like this. User can update/add about me and my
services user can add skills.

Code:

<html>
<head>
<title>Update Profile</title>
<link rel="stylesheet" href="quiz.css">

</head>
<body>

<div id= "outer">


<?php
session_start();

if(!isset($_SESSION['id'])){
header("Location:log.php");
In House Summer Training 2023
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

}
$id= $_SESSION['id'];

$con = mysqli_connect("localhost","root","","signup");
$res= mysqli_query($con, "SELECT * from `quiz` where id='$id'");
$arr = mysqli_fetch_array($res);

?>
<div id="top">
<div id="logo">
</div>

<div id="pro">
MY PROFILE
</div>

<div id="us">
<?php

echo "Hello ".$arr['name']."!";


?>
</div>

</div>

<div id="left">

<a class="nav" id="navp" href="profile.php">My Profile</a> <br>


<a class="nav" href="jav.php">Java Quiz</a> <br>
<a class="nav" href="webd.php">Web Dev Quiz</a> <br>
<a class="nav" href="dsa.php">DSA Quiz</a> <br>

</div>

<div id="main">
In House Summer Training 2023
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

<div id="info">

<table id="t">
<form action="up.php" method="post" enctype="multipart/form-data">
<tr>
<td> Name: </td>
<td> <input type="text" name="name" value="<?php echo $arr['name']; ?>" /> </td>
</tr>
<tr>
<td> Phone No. </td>
<td> <input type="text" name="phone" value="<?php echo $arr['phone']; ?>"/> </td>
</tr>

<tr>
<td> Password: </td>
<td> <input type="text" name="pass" value="<?php echo $arr['pass']; ?>" /> </td>
</tr>
<tr>
<td> Profile Picture: </td>
<td> <input type="file" name="photo" value="<?php echo $arr['photo']; ?>" /> </td>
</tr>
<tr>
<td> </td>
<td colspan=2>
<input class="b" type="submit" name="upp" value="Update" />
</td>
</tr>
</form>
</table>

</div>

<?php
if(isset($_POST['upp'])){

$name=$_POST['name'];
$phone=$_POST['phone'];
In House Summer Training 2023
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

$pass=$_POST['pass']; $photo=$_FILES['photo']['name'];
move_uploaded_file($_FILES['photo']['tmp_name'], "uploads/".$photo);
mysqli_query($con, "update `quiz` set name='$name', phone='$phone', pass='$pass' ,
photo='$photo' where id='$id'"); header("Location:profile.php");
}

?>

</div>

</div>
</body>
</html>

You might also like