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

session variable is not updating with new one session variable

P: 50
Hi

I have script where $_SESSION['ID'] is assigned while login or registeration when i echo it will have some value but when call other pages then $_SESSION['ID'] is changed to something else (or the assigned way back )

example while login "ssid":"70fa1308537985b9ff46d565b89f480e",
even $_SESSION['ID'] is this
but
then call other file it has other $_SESSION['ID'] like
"1bbf5d2b93f99957e70eff17e05fe63d" but one's

i used $_SESSION['ID']= md5(microtime()); i try to use session_id() but even session_id() didn't change so used md5(microtime())

what i need is
i have URL like this
page1.php?action=login&loginMail=email@teamof.com& pass=1234 late assume
it will in post for just for testing i have given it in get method
gives json result like this {"success":"0","userid":"111","ssid":"ca3940cdbc0a 64c8d64b97fc8cc0f64e"}
this ssid obtained by assign value to $_SESION['ID']

page1.php?action=getcategory&uid=111&ssid=ca3940cd bc0a64c8d64b97fc8cc0f64e
{"success":"1"} bz when compare $_SESSION['ID']==$_REQUEST['ssid'] it gives other value
like this when i echoed it 1bbf5d2b93f99957e70eff17e05fe63d for $_SESSION['ID']

why this is happening first it assign's it then when comparing it with another call it will change

need some help plz
regards
Sach
Feb 16 '12 #1
Share this Question
Share on Google+
2 Replies


Dormilich
Expert Mod 5K+
P: 8,639
i used $_SESSION['ID']= md5(microtime()); i try to use session_id() but even session_id() didn't change so used md5(microtime())
those two are completely unrelated. $_SESSION['ID'] is a value in your session while session_id() gets you the identifyer of your PHP session (so that you access the right set of data).

but without code this is hard to judge.
Feb 16 '12 #2

P: 50
hi Dormilich

im doing api for web and device.web side it gives different but works for device.
i know this $_SESSION['ID'] and session_id() is a different.
im say that one's i assign $_SESSION['ID'] to something as $_SESSION['ID']='123' then if i recheck that $_SESSION['ID'] from different response page it shows different value. i don't assign value here i just call $_SESSION['ID'] here.

when login i do this $_SESSION['ID']= md5(microtime());

then call other page with this variable $_SESSION['ID'] value changes its only ,if this file is accessed from different server, if i check this using url it works fine for device.
Feb 22 '12 #3

Post your reply

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