Jump to content

Recommended Posts

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>
';
}

Link to comment
https://forums.phpfreaks.com/topic/263638-setting-a-cookie/
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.