Jump to content

Checking for Remember me Button..


Mountain Water

Recommended Posts

But it is always works only when they refresh the browser, not when they open it..

 

 

//check for cookies
//If no username, Is a Guest, Has COOKIE_ID and cookie USER_NAME and COOKIe PASSWORD
if(!isset($_SESSION['user_name']) && isset($_SESSION['is_guest']) &&
isset($_COOKIE['user_id']) && isset($_COOKIE['user_name']) && isset($_COOKIE['password'])){

$user_cond = "user_name='{$_COOKIE['user_name']}'";
$sql = "SELECT `id`,`user_name`,`approved` FROM users WHERE 
           $user_cond
		AND `pwd` = '{$_COOKIE['password']}' AND `banned` = '0'
		"; 
$result = mysql_query($sql) or die (mysql_error()); 
$num = mysql_num_rows($result);
  // Match row found with more than 1 results  - the user is authenticated. 
    if ( $num > 0 ) { 
list($id,$full_name,$approved) = mysql_fetch_row($result);	
if(!$approved) {
echo "YOU FREAKING HACKER";
 exit();
 }
   // this sets variables in the session 
	$_SESSION['user_id']= $id;  
	$_SESSION['user_name'] = $full_name;
   }
}

 

I want it to assign those so when they open new browser and they pressed remember me when they logged in last night that they dont have to refresh to see that there logged in...

Link to comment
https://forums.phpfreaks.com/topic/186615-checking-for-remember-me-button/
Share on other sites

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.