billperrotta Posted April 9, 2010 Report Share Posted April 9, 2010 Getting this error " Parse error: syntax error, unexpected T_UNSET in /homepages/21/d176117763/htdocs/logout.php on line 6" My logout.php is pasted below <?php Session_start(); if ($_SESSION['loggedin'] == true) { (unset $_SESSION); session_destroy(); } echo 'you are now logged out'; ?> Quote Link to comment Share on other sites More sharing options...
falkencreative Posted April 9, 2010 Report Share Posted April 9, 2010 Looks like you have unnecessary parenthesis around your "(unset $_SESSION);" Quote Link to comment Share on other sites More sharing options...
billperrotta Posted April 9, 2010 Author Report Share Posted April 9, 2010 Changed logout.php to this, nothing changed got same error, see below. <?php Session_start(); if ($_SESSION['loggedin'] == true) { unset $_SESSION; session_destroy(); } echo 'you are now logged out'; ?> Quote Link to comment Share on other sites More sharing options...
falkencreative Posted April 9, 2010 Report Share Posted April 9, 2010 Sorry, didn't catch this earlier... The parenthesis on the unset line actually need to be like this, since unset() is a function: unset($_SESSION); I checked that code on my local machine and with that change, it seems to work fine. Quote Link to comment Share on other sites More sharing options...
billperrotta Posted April 10, 2010 Author Report Share Posted April 10, 2010 That worked. Brackets only on the session statement. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.