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

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -