Jump to content

no cookies recall


feyrerm

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.

<?php

$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.
Link to comment
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!!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.