HDFilmMaker2112 Posted June 4, 2012 Share Posted June 4, 2012 This is the first I've tried using cookies for a website. The below isn't setting a cookie. I have my log-in form on the home page. Which submits to this script "login.php", if the credentials match the database, then it redirects to index.php?home. On ?home I'm trying to echo out the cookies and they're coming up blank. I also checked the cookies set in my browser, and the only one set for this domain name is the PHPSESSID. The $login_stay_logged_in variable is set and it does = yes. if($login_stay_logged_in=="yes"){ $hased_value = kam3(md5(generatepassword())); $hashed_username = md5s($rows["email_address"]); $time = time(); setcookie("emtco_hash", $hased_value, time()+(86400*180), "/", "beta.area51entertainment.com"); setcookie("emtco_username", $hased_username, time()+(86400*180), "/", "beta.area51entertainment.com"); setcookie("emtco_visited", $time, time()+(86400*180), "/", "beta.area51entertainment.com"); } if(isset($_GET['home'])){ $content.=' <div class="left"></div> <div class="center">'.$_SESSION['username'].'<br /> '.$_SESSION['password'].'<br /> '.$_SESSION['login_stay_logged_in'].' <br />'.$_COOKIE["emtco_hash"].' <br />'.$_COOKIE["emtco_username"].' <br />'.$_COOKIE["emtco_visited"].'</div> <div class="right"></div> '; } Quote Link to comment https://forums.phpfreaks.com/topic/263638-setting-a-cookie/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.