php cookie
<?php
session_start();
include('phpconnectivity.php');
$nm=$_REQUEST['nm'];
$_SESSION['username']=$nm;
$pwd=$_REQUEST['pwd'];
$button=$_REQUEST['bt'];
$ck=$_REQUEST['ck'];
if(isset($button)){
$query="select * from userinfo where name='{$nm}' and pass='{$pwd}'";
$r=mysqli_query($con,$query);
$r_count=mysqli_num_rows($r);
echo $r_count;
if($r_count>0){
if(!empty($ck)){
setcookie("loginuser",$nm,time()+(1*60*60));
setcookie("loginpassword",$pwd,time()+(1*60*60));
}
else{
if(isset($nm)){
setcookie("loginuser","");
}
if(isset($pwd)){
setcookie("loginpassword","");
}
}
header("Location: Home.php");
}
else{
echo "this name or password not matched";
}
}
...
Comments
Post a Comment