PHP, sql

Login with Cookie

<?php
require_once(‘connect.php’);

$email = $_REQUEST[“email”];
$password = $_REQUEST[“password”];

$matchQuery = “SELECT * FROM puran WHERE email=’$email’ AND password=’$password'”;
$runMatchQuery = mysqli_query($connect,$matchQuery);
$checkCount = mysqli_num_rows($runMatchQuery);
if($runMatchQuery==true) {
if($checkCount===1) {
setcookie(“email”,$email,time() + 3600);
header(“location: dashboard.php”);
}else {
header(“location: login.php?action=false”);
}}?>

 

Note: 3600 = 1 hour

Leave a Reply