PHP Session Help

Discussion in 'OT Technology' started by TheDarkHorizon, Jul 30, 2004.

  1. TheDarkHorizon

    TheDarkHorizon \xC0\xFF\xEE

    Joined:
    Sep 26, 2002
    Messages:
    2,396
    Likes Received:
    0
    Location:
    San Francisco, CA
    Do the Windows and Linux versions of PHP handle escape characters in sessions differently? I wrote a script and tested it on my Windows machine, and quotation marks (") would display as simply quotation marks ("). But when I tested the code on my Linux machine, it would automatically add the \ in front of the quotation mark, messing up parts of my script. Is there a function I can use to undo this, or do I have to str_replace every single instance of \\\" with \"?
     
  2. tac

    tac (:-|)=|=

    Joined:
    Jan 3, 2001
    Messages:
    21
    Likes Received:
    0
    Location:
    vancouver
    http://ca3.php.net/manual/en/function.stripslashes.php

    php escapes strings automatically when the magic_quotes_gpc directive in the php.ini file is set to On

    I'm assuming the data you are putting into the session var is from a get,post, or cookie var?


    anyways, use stripslashes() to remove the backslashes
     
  3. TheDarkHorizon

    TheDarkHorizon \xC0\xFF\xEE

    Joined:
    Sep 26, 2002
    Messages:
    2,396
    Likes Received:
    0
    Location:
    San Francisco, CA
    Thanks a lot. That was the function I was looking for. For some reason, I thought it was unescape. And yeah, it was from a POST var, what does that change?
     

Share This Page