Bluehost.com Web Hosting $6.95

Logging Users Out

This is a discussion on Logging Users Out within the PHP General forums, part of the PHP Programming Forums category; So I am using the following code to log people in. $uid = $rowlogin["UserID_PK"]; session_register("uid"); ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-30-2003
Yisong Yue
 
Posts: n/a
Default Logging Users Out

So I am using the following code to log people in.


$uid = $rowlogin["UserID_PK"];
session_register("uid");


where $rowlogin is a query on a database of users.
my code for logging someone out looks like this.


session_unregister("uid");
unset($uid);


the problem is that I have this link that links to login.php when the
session isn't registered and logout.php when the session is registered.
This link doesn't update correctly.

After I logout, the link for logout still appears. I have to manually
refresh the browser (press F5) to have the login link appear instead. The
same happens after I log in. Does anyone know what might be going on?

Here's how I check for user login.

method 1

if(isset($uid))
{
echo " logout link html";
}
else
{
echo " login link html";
}

method 2

if(session_is_registered("uid"))
{
echo " logout link html";
}
else
{
echo " login link html";
}

both methods give me the same problem. I have to actually refresh the
page before the links are changed. I know for certain that the $uid
variable and the session has been properly changed. But it seems that the
browser isn't telling the php server to refresh the page, and loading up a
cached page instead.

Any ideas?


##-----------------------------------------------##
Article posted from PHP Freaks NewsGroups
http://www.phpfreaks.com/newsgroups
Get Addicted: php.general
##-----------------------------------------------##
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:08 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0