Jump to content

Session Cookies with URL Variables?


Kristoff1875
Go to solution Solved by Kristoff1875,

Recommended Posts

I've got a login script, all working fine, but i've recently added a remember me cookie:

 

$year = time() + 31536000;
	
if($_POST['remember']) {
setcookie('remember_me', $_POST['username'], $year);
}
elseif(!$_POST['remember']) {
	if(isset($_COOKIE['remember_me'])) {
		$past = time() - 100;
		setcookie(remember_me, gone, $past);
	}
}

 

All works fine on the normal login page, however, when clicking on the email link with url variables in it:

 

login.php?clientid=1&jobid=1

 

It can't seem to pull the cookie that recalls the username and ticks the box.

 

Anyone got any idea why this could be?

 

Link to comment
Share on other sites

Should it be something like:

 

$year = time() + 31536000;
	
if($_POST['remember']) {
setcookie('remember_me', $_POST['username'], $year, '/', '.mydomain.co.uk');
}
elseif(!$_POST['remember']) {
	if(isset($_COOKIE['remember_me'])) {
		$past = time() - 100;
		setcookie(remember_me, gone, $past);
	}
}
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.