Jump to content

Session Cookies with URL Variables?


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
https://forums.phpfreaks.com/topic/276191-session-cookies-with-url-variables/
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);
	}
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.