feyrerm Posted August 18, 2006 Share Posted August 18, 2006 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 https://forums.phpfreaks.com/topic/17981-no-cookies-recall/ Share on other sites More sharing options...
ToonMariner Posted August 18, 2006 Share Posted August 18, 2006 neither of your cookies are called 'visited' - why set two cookies - decalre an aray of values in one cookie - much neater Link to comment https://forums.phpfreaks.com/topic/17981-no-cookies-recall/#findComment-76949 Share on other sites More sharing options...
feyrerm Posted August 18, 2006 Author Share Posted August 18, 2006 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 https://forums.phpfreaks.com/topic/17981-no-cookies-recall/#findComment-76951 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.