Jump to content


This topic is now archived and is closed to further replies.


no cookies recall

Recommended Posts

I cant figure out why this code is not working. I created a test script wich esentually is the same as in my full site and it still isnt recalling the cookies. it sets them and the info inside is correct, but on a revisit to the page it does not recall the cookie.
here is the script.


$domain = "";
$duration = time()+(60*60*24*30);
$loginUsername = "user";
$password = "password";

if (!isset($_COOKIE['visited'])) {
    // if a cookie does not exist
    // set it
    setcookie("lr_user", $loginUsername, $duration, $domain);
    setcookie("lr_pass", $password, $duration, $domain) or die("Could not set cookie");
    echo "This is your first visit here today.";
else {
    // if a cookie already exists
    echo "Nice to see you again, old friend!";


any help would be great.

Share this post

Link to post
Share on other sites
neither of your cookies are called 'visited' - why set two cookies - decalre an aray of values in one cookie - much neater

Share this post

Link to post
Share on other sites
Man I can't even believe I couldent figure that one out. Sometimes you just need somone elses eyes!!

The two cookies thing is just the way it was written in the borrowed script, I wanted to get it working as written before I modify it becase as you can tell I have enough sintax problems figuing out others code, without trying to write my own. Thanks again!!

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.