Increase your programming skills with android and backend for software designing, development, learning and updates
Saturday, 15 October 2016
Saturday, 1 October 2016
how to make login page using session kookies mysql all in one
How to make a login page using mysql , session , cookies , in php
itis is a very simple method see below
<head>
<?php
session_start();
mysql_connect("localhost","root","");
mysql_select_db("form");
if (isset($_POST["btn"])){
$email = $_POST["n3"];
$password = $_POST["n4"];
if (isset($_POST["btn"])){
setcookie("email",$em,time()+60);
setcookie("password",$pa,time()+60);
}
$q = "select * from submit where email = '$email' && password ='$password' ";
$sr = mysql_query($q);
$num = mysql_num_rows($sr);
if($num > 0){
$row = mysql_fetch_array($sr);
if ($row["email"] == $email && $row ["password"] == $password ) {
$_SESSION ["useremail"] = $email;
header("location:dashboard.php");
}
}
}
?>
</head>
<body>
<div class="wraper" >
<div class="logout">
<p align="center"> <a href="">LOGOUT</a></p>
</div>
<div class="header">
<div class="menu">
<form method="post" ><b><h2><pre>
email : <input type="email" name="n3" /><br />
Password : <input type="password" name="n4" /><br />
<input type="submit" name="btn" value="submit" />
<a href="">forget password</a>
</pre> </h2>
</b></form>
</div>
</div>
</div>
</body>
itis is a very simple method see below
<head>
<?php
session_start();
mysql_connect("localhost","root","");
mysql_select_db("form");
if (isset($_POST["btn"])){
$email = $_POST["n3"];
$password = $_POST["n4"];
if (isset($_POST["btn"])){
setcookie("email",$em,time()+60);
setcookie("password",$pa,time()+60);
}
$q = "select * from submit where email = '$email' && password ='$password' ";
$sr = mysql_query($q);
$num = mysql_num_rows($sr);
if($num > 0){
$row = mysql_fetch_array($sr);
if ($row["email"] == $email && $row ["password"] == $password ) {
$_SESSION ["useremail"] = $email;
header("location:dashboard.php");
}
}
}
?>
</head>
<body>
<div class="wraper" >
<div class="logout">
<p align="center"> <a href="">LOGOUT</a></p>
</div>
<div class="header">
<div class="menu">
<form method="post" ><b><h2><pre>
email : <input type="email" name="n3" /><br />
Password : <input type="password" name="n4" /><br />
<input type="submit" name="btn" value="submit" />
<a href="">forget password</a>
</pre> </h2>
</b></form>
</div>
</div>
</div>
</body>
Subscribe to:
Posts (Atom)