I have a simple website on localhost at the moment. I am working on security. I created an additional column in the database and named it “active_notactive” of type enum(‘0’, ‘1’).
My question: How to change the active_notactive feild to 0 on the logout of that specific user.
What I want to achieve is: Before the user logs in, active_notactive=’0′ , after they login active_notactive=’1′ , when they logout=’0′. I got all of them to work apart from the logout bit.
Here is my logout script:
<?php
// start session
session_start();
// HERE IS WHERE IM STUCK
// get session email to use it in the following query
$_SESSION['email'] = $email;
// Update member to active
mysql_query("UPDATE members SET active_notactive='0' WHERE email=$email");
// delete the current dession
unset($_SESSION);
session_destroy();
// set the current cookie to 1 hour ago (to delete it)
setcookie ("online_security_user", "", time() - 3600);
setcookie ("online_security_pass", "", time() - 3600);
?>
<h2>Thank you for using our website. You are now logged out.</h2>
$email needs to be in quotes as it is string.
and also above answer
$email= $_SESSION["email"]needed.