Rumah >pembangunan bahagian belakang >tutorial php >mysql-PHP+MYSQL,注销时,保存最后登陆的IP及时间,代码为何未生效?
mysqlphp
<code>//-----------注销begin------------------------------------------if ( $_GET['action'] == "logout" ){ //注销前,记录最后一次成功登陆的IP及日期 include('conn.php'); $client_ip = $_SERVER["HTTP_CLIENTIP"]; $user_id = $_SESSION['user_id']; echo $client_ip; echo $user_id; sleep(10); mysql_query("update users SET user_last_log_ip = $client_ip,user_last_log_date = unix_timestamp(now()) where user_id = $user_id limit 1"); mysql_close($con); //删除SESSION unset($_SESSION['user_id']); unset($_SESSION['user_email']); unset($_SESSION['user_nickname']); echo '<br>'.'注销成功!'; exit;}</code>