index.php file
Sinup For New User<br>
<form action = "submit.php" method = "POST">
Username - <input type= "text" name="username"><br><br>
Email - <input type = "email" name = "email"><br><br>
Password - <input type="password" name="password"><br><br>
<input type = "submit" value = "Signup">
</form>
Login <br>
<form action = "login.php" method = "POST">
Email - <input type = "email" name = "email"><br><br>
Password - <input type="password" name="password"><br><br>
<input type = "submit" value = "Login">
</form>
submit.php file
<?php
$connect = mysql_connect("localhost","root","");
mysql_select_db(" Your Database Name", $connect);
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
mysql_query("insert into register(username,email,password)values('$username','$email','$password')");
echo "Successfully Register";
?>
login.php file
<?php
session_start();
$connect = mysql_connect("localhost","root","");
mysql_select_db("Your Database Name", $connect);
$email = $_POST['email'];
$password = $_POST['password'];
$sql = mysql_query("select * from register where email = '$email'");
$result = mysql_fetch_array($sql);
$dbemail = $result['email'];
$dbpassword = $result['password'];
if($dbemail==$email)
{
$_SESSION['email'] = $dbemail;
?>
<script>
window.location = 'home.php';
</script>
<?php
}
?>
home.php file
<?php
session_start();
$connect = mysql_connect("localhost","root","");
mysql_select_db("Your Database Name", $connect);
$sql= mysql_query("select * from register where email = '".$_SESSION['email']."'");
$result = mysql_fetch_array($sql);
?>
Email- <?php echo $result['email']; ?><br><br>
Username - <?php echo $result['username']; ?>
Choose the right course and start building your future with practical skills.
Learn HTML, CSS, JavaScript, and PHP to build modern, responsive websites and real-world projects.
Enroll Now See Full Details
Understand electronics basics with hands-on breadboard projects and circuit building techniques.
Enroll Now See Full Details
Step into AI with real-world applications, automation tools, and smart development techniques.
Enroll Now See Full Details