ajax - Remember me login function and user session php -


i tried implement remember me function in login page. have ajax login page , part of code check users after clicking login button. problem php's default lifetime session until browser closed. can change session lifetime think it's not point.

also have added remember me check box @ login page. it's simple html.

code:

session_start(); include('db.php');  $_post = mysql_real_escape_array($_post);  if($_post['ahd_username'] && $_post['ahd_password']) {     $pass = md5($_post['ahd_password']);       $result = mysql_query('select * members username="'.$_post['ahd_username'].'" , password="'.$pass.'" , validate="0"');     if(mysql_num_rows($result) > 0) {         $_session['username'] = $_post['ahd_username'];          $_session['password'] = md5($_post['ahd_password']);          $row = mysql_fetch_array($result);              $_session['userid'] = $row['record_id'];             $_session['email'] = $row['email'];              $_session['user_level'] = $row['user_level'];             $_session['premium'] = $row['premium'];             $_session['tokens'] = $row['tokens'];              $_session['ip'] = $_server['remote_addr'];              $time = time();         mysql_query("update users set lastlogin = '".$time."', last_ip = '".$_server['remote_addr']."' record_id = '".$_session['userid']."'");             echo "1";     }else{         echo "0";} }else{     echo "0"; exit(); }  


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -