web - PHP Login Form Session Variable Destroying -
i new php , creating login screen session variable. trying destroy or unset session variable when logging out doesn't seem work.
my session variable:
$_session['currentuser']
this button should end session:
<input type="submit" name="logout" id="logout" value="log out">
when pressing button:
if(isset($_post['logout'])) { session_unset(); session_destroy(); }
my practice, set session variable random:
$_session['currentuser'] = time(); session_destroy();
and reload/refresh page. example:
header('location: /'); die;
if not redirect after session destruction, page render as if session not destroyed (html render...)
Comments
Post a Comment