Jump to content

SESSION changes username when clicking on a link


shocker-z

Recommended Posts

I have a issue after logging into my site and click a link it changes the username to the last user to log onto the site.. I have deleted the session files but no diffrence.. i have also user diffrent PC's and browsers but same issue! getting me stressed! it's got to be sumet simple im missing but really can't understand!

index.php
[a href=\"http://blucode.sytes.net/ukchat/index.phps\" target=\"_blank\"]http://blucode.sytes.net/ukchat/index.phps[/a]

profiles/login.php
[a href=\"http://blucode.sytes.net/ukchat/profiles/upload.phps\" target=\"_blank\"]http://blucode.sytes.net/ukchat/profiles/upload.phps[/a]

You can test this @ [a href=\"http://blucode.sytes.net/ukchat/\" target=\"_blank\"]http://blucode.sytes.net/ukchat/[/a]
user: test
pass: user

Please let me in on any ideas you have!

Regards
Liam
[!--quoteo(post=358209:date=Mar 25 2006, 01:59 PM:name=shocker-z)--][div class=\'quotetop\']QUOTE(shocker-z @ Mar 25 2006, 01:59 PM) [snapback]358209[/snapback][/div][div class=\'quotemain\'][!--quotec--]
sorry.. that's in the profiles/header.php page that i included at the start..

[/quote]

Only in one of the files in that case
Sorry my bad i put the upload.phps instead of the actual login.php that deals with the username/password..

[a href=\"http://blucode.sytes.net/ukchat/profiles/login.phps\" target=\"_blank\"]http://blucode.sytes.net/ukchat/profiles/login.phps[/a]

*SLAPS HEAD*
I haven't seen anything obvious yet.

I would change this bit though

[code]if ($password !== $user['password']) {
$error="Password invalid for $username";
header("location: ../index.php");
} [/code]

Remove the header() line. You redirect to index.php at the end of the script. If you do it there then the session error message doesn't get set.
After the session_start() in the login page I'd put

[code]$_SESSION['username'] = $_SESSION['logged_in'] = NULL;[/code]

As new values are only set if the login is valid, this should ensure they are cleared if it fails.
hmmm any idea how this fixed it? i change $username to $imgusername and now it's all working.. i had noticed that what ever username was in the profiles list on the left hand side thats what username the session changed too... how could setting $username='matthew'; change a $_session['username'] ???

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.