问题描述
- PHP+MYSQL,注销时,保存最后登陆的IP及时间,代码为何未生效?
-
//-----------注销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; }
解决方案
这个我建议是把sql语句打印出来,然后去mysql里面执行一下
时间: 2024-10-28 21:19:49