session variable is not updating with new one session variable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sidhx
    New Member
    • Dec 2009
    • 50

    session variable is not updating with new one session variable

    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":"70fa130 8537985b9ff46d5 65b89f480e",
    even $_SESSION['ID'] is this
    but
    then call other file it has other $_SESSION['ID'] like
    "1bbf5d2b93f999 57e70eff17e05fe 63d" 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?actio n=login&loginMa il=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":"ca3940c dbc0a64c8d64b97 fc8cc0f64e"}
    this ssid obtained by assign value to $_SESION['ID']

    page1.php?actio n=getcategory&u id=111&ssid=ca3 940cdbc0a64c8d6 4b97fc8cc0f64e
    {"success":" 1"} bz when compare $_SESSION['ID']==$_REQUEST['ssid'] it gives other value
    like this when i echoed it 1bbf5d2b93f9995 7e70eff17e05fe6 3d 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
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    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.

    Comment

    • sidhx
      New Member
      • Dec 2009
      • 50

      #3
      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.

      Comment

      Working...