Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-21-2010, 02:32 AM   PM User | #1
Taylor_1978
Regular Coder

 
Join Date: Jun 2003
Location: Australia
Posts: 528
Thanks: 8
Thanked 8 Times in 8 Posts
Taylor_1978 is on a distinguished road
COOKIES / SESSION - Logging out on one computer, not on another

Hi,

I seemed to have made a mess of my cookies / sessions for login/logout purposes.

On my desktop, I am able to log out no problem. However on my laptop, it will not log me out.

This is what I have:

login.php
PHP Code:
setcookie("USERID",$r['id'],time()+2592000);
$_SESSION['USERID'] = $r['id']; 
db.php (included at the top of every page)
PHP Code:
if (@!$_COOKIE['USERID'] AND $_SESSION['USERID']!=0) {
  if(isset(
$_SESSION['USERID'])) {
    
$_COOKIE['USERID'] = $_SESSION['USERID']; // I included this because with only cookies, some people were saying they could not login at all.
  
}


logout.php
PHP Code:
setcookie("USERID",""); // I've also tried: setcookie("USERID","",time()-2592000);
unset($_SESSION['USERID']); 
EDIT: This issue actually appears to be an IE issue (surprise surprise), although I'm sure it's still due to my coding... I can lout no problem on Firefox on my desktop, but not in IE

Any help appreciated!

Last edited by Taylor_1978; 02-21-2010 at 07:03 AM..
Taylor_1978 is offline   Reply With Quote
Old 02-21-2010, 04:29 AM   PM User | #2
Taylor_1978
Regular Coder

 
Join Date: Jun 2003
Location: Australia
Posts: 528
Thanks: 8
Thanked 8 Times in 8 Posts
Taylor_1978 is on a distinguished road
Okay so I listed this as resolved as I thought I had fixed the problem.

So I added into logout.php session_destroy();

This worked on my desktop... It now logged out correctly in both firefox and IE.. So I thought problem was solved.. but it isn't!

On my laptop - the same problem still occurs... Firefox logs out... IE does not! Both are IE v8. The only difference is desktop is XP and laptop is Vista... which I know that probably makes no difference, but its the only think I know of different between the two! HELP!

Last edited by Taylor_1978; 02-21-2010 at 07:06 AM..
Taylor_1978 is offline   Reply With Quote
Old 02-21-2010, 08:01 PM   PM User | #3
Taylor_1978
Regular Coder

 
Join Date: Jun 2003
Location: Australia
Posts: 528
Thanks: 8
Thanked 8 Times in 8 Posts
Taylor_1978 is on a distinguished road
Anyone have a solution/idea?
Taylor_1978 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
[IMG] code is On
HTML code is Off

Forum Jump


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


Advertisement
Log in to turn off these ads.