Dynadot โ€” .com Registration $8.99

Problems with serialize and unserialize

Spaceship Spaceship
Watch

Albino

Munky DesignsEstablished Member
Impact
17
EDIT: bah, ive posted in the wrong section, can a mod move to programming please :)

hey,

ok, I am saving 2 values in my cookie, like so:

Code:
$cookie = @serialize(array($u, $c));
setcookie("siteLogin", $cookie, time() + 36000, "/");

$u is username, $c is a cookie value (this is part of a remember script for logins).

now, when I come to extract it, I have this:

Code:
if (isset($_COOKIE['siteLogin'])){

    echo $_COOKIE['siteLogin']."<br />";
    echo unserialize($cookie)."<br />";
    list($u, $c) = @unserialize($cookie);
    echo "username: ".$u."  cookie: ".$c;

}

the echo is just for debugging, ive checked if the cookie contains a value, it does (and looks serialized). I can;t echo it unserialized or listed, am I doing something wrong?

here is a test url:

http://munkydesigns.co.uk/ScrtipsNew/login.php

u: username
p: password

make sure you check remember me lol

thanks in advance :)
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Dynadot โ€” .com Registration $8.99Dynadot โ€” .com Registration $8.99
Appraise.net
Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back