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

4x4 Matrix in Python -

python - String indices must be integers and while issue -

wso2is - WSO2 IS 5.0.0 SP1 After restart there is authentication error -