Cookies
Results 1 to 5 of 5

Thread: Cookies

  1. #1
    Junior Member
    Join Date
    Jan 2013
    Posts
    3

    Cookies

    Hello all,

    Really dumb question.

    I am recoding a site to PHP and the cookies are set in asp on another page as ("ENROLLER")("COOKIE")

    In ASP I would <%Request.cookies("ENROLLER")("COOKIE")%>

    How do I get the specific COOKIE as above in php?

  2. #2
    Junior Member
    Join Date
    Jan 2013
    Posts
    3
    I have used

    <?php echo $_COOKIE["ENROLLER"]["SNAME"]?>

    like ASP would pull them but that doesn't work.

    <?php echo $_COOKIE["ENROLLER"]?>

    returns all ENROLLER cookies with & between them.

    I just want the ENROLLER:SNAME cookie.

  3. #3
    Senior Member
    Join Date
    Apr 2003
    Location
    Silver Lake
    Posts
    4,830
    If you want to look at what's in the $_COOKIE variable, you can use var_dump or print_r:
    PHP Code:
    // recursively prints out contents of all cookies available in this script
    print_r($_COOKIE); 
    As for what that ASP code accomplishes, I'm not certain. If you could use it to set the code in ASP and then redirect to your PHP script, you could use the statement above to inspect what is in there. Alternatively, you could visually inspect the cookie file.
    IMPORTANT: STOP using the mysql extension. Use mysqli or pdo instead.
    World War One happened 100 years ago. Visit Old Grey Horror for the agony and irony.

  4. #4
    Junior Member
    Join Date
    Jan 2013
    Posts
    3
    array(2) { ["ENROLLER"]=> string(205) "ADMIN=3&SCHOOL=0&STUDENTID=119&ATSCHOOL=1&EXAMINER=1&INSTRUCTORID=35&INSTRUCTOR=1&SSIRNAME=Doe&SNAME=John&DURATION=30 Mins&SEMAIL=test@email.com&CUSTOMERID=0&CAATESTFEE=1&VISASENT=1&TSAR=1" ["ASPSESSIONIDACBQQTAC"]=> string(24) "DCBLNLMAIJGJPIPJAHLHAJID" }

    In ASP you can pull the sub COOKIE such as ENROLLER and SSIRNAME or ENROLLER and SNAME.

  5. #5
    Pedantic Curmudgeon Weedpacket's Avatar
    Join Date
    Aug 2002
    Location
    General Systems Vehicle "Thrilled To Be Here"
    Posts
    21,840
    So in other words the ASP page is storing a whole array of cookies in a single cookie.

    It looks like parse_str would be able to deal with that string.
    THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER
    FAQs! FAQs! FAQs! Most forums have them!
    Search - Debugging 101 - Collected Solutions - General Guidelines - Getting help at all

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •