Good day!
i have simpe login page with logout…
But, I need to have a syntax for autologout when the browser is closed and when he open again the login page he need to login again…
How can it possible?
Here is my login code:
<?php
include 'config.php';
session_start();
if (isset($_POST['submit'])) {
$username=$_POST['username'];
$password=($_POST['password']);
$sql = "SELECT username, password FROM paylogin WHERE username='$username' AND password='$password'";
$rs = $conn2->Execute($sql);
if($rs==1){
$_SESSION['logged_in'] = true;
header("location:index.php");
}
else {
echo "<center>";
echo "Wrong Username or Password";
echo "</center>";
}
}
?>
and logout page
<?php
session_start();
session_destroy();
header ("Location: login.php");
?>
Thank you