I am using the following code to try and log out users but it is not working, any ideas why?
<?php session_start(); if(isset($_SESSION['authenticated'])) unset($_SESSION['authenticated']); echo 'you are not logged in'; ?>
The code I used to start the session is:
And that seems to work with the log in but I am unable to log out now.
Also for the following code how would I then remove the cookie?
setcookie('username', $_POST['username'], time()+60*60*24*365, 'www.website.com'); setcookie('password', $_POST['password'], time()+60*60*24*365, 'www.website.com');
I came up with:
$past = time() - 100; setcookie(username, gone, $past); setcookie(password, gone, $past);
Sorry if I am completely wrong, I am new at this!
Thanks for any help