Mountain Water Posted December 29, 2009 Share Posted December 29, 2009 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 More sharing options...
Mountain Water Posted December 29, 2009 Author Share Posted December 29, 2009 Haha all i did was put this ontop of my index.php thx Link to comment https://forums.phpfreaks.com/topic/186615-checking-for-remember-me-button/#findComment-985617 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.