Hello Friend मेरा नाम दीपेन्द्र बघेल है में आप के लिए एक इस post में एक mini Project ले कर आया हु |
यह Registration and login form in php का post Part 2 है यदि अपने इसके पहले का post नहीं देखा है जिसमे Registration form बंनाना बताया गया है तो आप यह click करे click here
आज के इस post में हम login form बनाएगे
यह Registration and login form in php का post Part 2 है यदि अपने इसके पहले का post नहीं देखा है जिसमे Registration form बंनाना बताया गया है तो आप यह click करे click here
आज के इस post में हम login form बनाएगे
Codeing Of login Page in PHP
<?php
include('connection.php');
?>
<!DOCTYPE html>
<html>
<head>
<title>Sign Up</title>
<style type="text/css">
#header{
width: 100%;
height: 50px;
background: orange;
}
#container
{
width: 100%;
height: 500px;
}
#footer{
width: 100%;
height: 50px;
background-color: orange;
}
#ic{
width: 50%;
height: 400px;
background:orange;
border-radius: 20px;
}
td{
width: 200px;
height: 50px;
}
</style>
</head>
<body>
<div id="header"><h1 align="center">Engineersworld.in</h1></div>
<div id="container"><br><br><br>
<center><div id="ic"><br>
<h2 align="center">Login</h2><br><br><br>
<form action="" method="post">
<table>
<tr>
<td><b>Enter E-Mail</b></td>
<td><input type="text" name="email" placeholder="Enter E-Mail" title="Enter E-Mail"></td>
</tr>
<tr>
<td><b>Enter Password</b></td>
<td><input type="password" name="ps" placeholder="Enter Password" title="Enter Password"></td>
<tr>
<td><input type="submit" name="sub" value="Sign Up"></td>
<td><input type="reset" name="res" value="Reset" title="Reset"></td>
</tr>
</table>
</form>
<?php
if(isset($_POST['sub']))
{
$un=$_POST['email'];
$ps=$_POST['ps'];
session_start();
$_SESSION['un']=$un;
$q="select * from s1 where email='$un' && ps='$ps'";
$run=mysqli_query($link,$q);
$res=mysqli_num_rows($run);
if($res>0)
{
header('Location:welcome.php');
}
else
{
header('Location:login.php?Wrong User');
}
}
?>
<a href="s1.php">Sign Up</a>
</div></center>
</div>
<div id="footer"><h1 align="center">copyright@engineersworld.in</h1></div>
</body>
</html>
include('connection.php');
?>
<!DOCTYPE html>
<html>
<head>
<title>Sign Up</title>
<style type="text/css">
#header{
width: 100%;
height: 50px;
background: orange;
}
#container
{
width: 100%;
height: 500px;
}
#footer{
width: 100%;
height: 50px;
background-color: orange;
}
#ic{
width: 50%;
height: 400px;
background:orange;
border-radius: 20px;
}
td{
width: 200px;
height: 50px;
}
</style>
</head>
<body>
<div id="header"><h1 align="center">Engineersworld.in</h1></div>
<div id="container"><br><br><br>
<center><div id="ic"><br>
<h2 align="center">Login</h2><br><br><br>
<form action="" method="post">
<table>
<tr>
<td><b>Enter E-Mail</b></td>
<td><input type="text" name="email" placeholder="Enter E-Mail" title="Enter E-Mail"></td>
</tr>
<tr>
<td><b>Enter Password</b></td>
<td><input type="password" name="ps" placeholder="Enter Password" title="Enter Password"></td>
<tr>
<td><input type="submit" name="sub" value="Sign Up"></td>
<td><input type="reset" name="res" value="Reset" title="Reset"></td>
</tr>
</table>
</form>
<?php
if(isset($_POST['sub']))
{
$un=$_POST['email'];
$ps=$_POST['ps'];
session_start();
$_SESSION['un']=$un;
$q="select * from s1 where email='$un' && ps='$ps'";
$run=mysqli_query($link,$q);
$res=mysqli_num_rows($run);
if($res>0)
{
header('Location:welcome.php');
}
else
{
header('Location:login.php?Wrong User');
}
}
?>
<a href="s1.php">Sign Up</a>
</div></center>
</div>
<div id="footer"><h1 align="center">copyright@engineersworld.in</h1></div>
</body>
</html>
Welcome Page
<?php
include('connection.php');
?>
<!DOCTYPE html>
<html>
<head>
<title>Sign Up</title>
<style type="text/css">
#header{
width: 100%;
height: 50px;
background: orange;
}
#container
{
width: 100%;
height: 500px;
}
#footer{
width: 100%;
height: 50px;
background-color: orange;
}
#ic{
width: 50%;
height: 400px;
background:orange;
border-radius: 20px;
}
td{
width: 200px;
height: 50px;
}
</style>
</head>
<body>
<div id="header"><h1 align="center">Engineersworld.in</h1></div>
<div id="container"><br><br><br>
<center><div id="ic"><br>
<?php
session_start();
$un=$_SESSION['un'];
if(!$un)
{
header('Location:login.php');
}
?>
<h2 align="center">Welcome <?php echo $un; ?></h2><br><br><br>
<a href="logout.php">Logout</a>
</div></center>
</div>
<div id="footer"><h1 align="center">copyright@engineersworld.in</h1></div>
</body>
</html>
include('connection.php');
?>
<!DOCTYPE html>
<html>
<head>
<title>Sign Up</title>
<style type="text/css">
#header{
width: 100%;
height: 50px;
background: orange;
}
#container
{
width: 100%;
height: 500px;
}
#footer{
width: 100%;
height: 50px;
background-color: orange;
}
#ic{
width: 50%;
height: 400px;
background:orange;
border-radius: 20px;
}
td{
width: 200px;
height: 50px;
}
</style>
</head>
<body>
<div id="header"><h1 align="center">Engineersworld.in</h1></div>
<div id="container"><br><br><br>
<center><div id="ic"><br>
<?php
session_start();
$un=$_SESSION['un'];
if(!$un)
{
header('Location:login.php');
}
?>
<h2 align="center">Welcome <?php echo $un; ?></h2><br><br><br>
<a href="logout.php">Logout</a>
</div></center>
</div>
<div id="footer"><h1 align="center">copyright@engineersworld.in</h1></div>
</body>
</html>
Logout Page Codeing
<?php
session_start();
$un=$_SESSION['un'];
session_destroy();
header('Location:Login.php');
?>
session_start();
$un=$_SESSION['un'];
session_destroy();
header('Location:Login.php');
?>
0 komentar: