By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,949 Members | 889 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,949 IT Pros & Developers. It's quick & easy.

Logout Session - not working

P: 144

i'm learning and trying to develop a web with php. the logout script of mine seems not working since that after i pressed the logout link. i still get the greeting "welcome, 'username' ".

this is the script in the logout.php that

<meta http-equiv="refresh" content="1; URL=index.php">

//destroy session and redirect user


//redirect using meta tag

hope someone could help. thx
Dec 24 '07 #1
Share this Question
Share on Google+
7 Replies

P: 30
this is a quote from
You should go there and read more. Also it depends on what php version your using.

sometimes you might have problems even if using both session_unset and session_destroy. You have to clear the $_SESSION array. I got it working this way:

$_SESSION = array();[/PHP]
Dec 24 '07 #2

P: 144
thx nothing

well, it works if i use html form as the logout method. the problem just that i don't want to display the logout as a submit button. i want it to be displayed as a link

is there any work around..

Dec 24 '07 #3

Expert 5K+
P: 5,821
Heya, Thesti.

What happens if you refresh index.php after logging out? You might just be seeing a cached version of index.php.
Dec 24 '07 #4

P: 144

after some changes, it works well with FF and IE. but it doesn't work with Opera. even after i refresh the page. can i solve this problem?

Dec 25 '07 #5

Expert 5K+
P: 5,821
Heya, Thesti.

Try redirecting to index.php?loggedout=true. The loggedout=true part wouldn't affect your logic, but it would prevent the browser from serving the cached version of the page because "index.php" != "index.php?loggedout=true".
Dec 25 '07 #6

P: 144
i've tried your suggestion to use GET method, but still it doesn't work with Opera. i also have tried to use the no-cache and last-modified things but that doesn't solve the problem too

wonder if this only happen to me. still working to solve this...
Dec 25 '07 #7

P: 1
JS workaround for the submit button to show as link:
Expand|Select|Wrap|Line Numbers
  1. <form action="" method="post">
  2. <input type="hidden" name="logout" value="true" />
  3. <a href="#" onclick="document.getElementById('submitbutton').click();">Logout</a>
  4. <input id="submitbutton" type="submit" name="submit" value="test" style="display: none;">
  5. </form>
Dec 25 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.