Problem while retrieving data from cookie with unserialize

From: Date: Thu, 19 Jun 2003 21:42:48 +0000
Subject: Problem while retrieving data from cookie with unserialize
Groups: php.general 
Request: Send a blank email to php-general+get-152245@lists.php.net to get a copy of this message
Hi, I’m having this problem: I set a cookie using this: $sql = "UPDATE member SET cookie=$cookie WHERE ". "id = $this->id"; $this->mysql->query($sql); $cookie = urlencode(serialize(array($_SESSION['username'], $cookie))); setcookie('auth', $cookie, time() + 31104000, '/', 'www.reddast.is'); And then when I check the cookie using this: list($username, $cookie) = @unserialize(urldecode($cookie)); using this query: "SELECT * FROM member WHERE (username = $username) AND (cookie = $cookie)"; it looks like this when I debug the script and see the actual query that is sent to Mysql: "SELECT * FROM member WHERE (username = 'ofjord') AND (cookie = '\'86aa5f7e6469efe09a17089957f59b0f\'')"; I hope someone has any answers on this. Best regards, Sævar Öfjörð Magnússon ofjord@simnet.is ICELAND

« previous php.general (#152245) next »