Skip to content

Commit

Permalink
Update login-hustoj.php
Browse files Browse the repository at this point in the history
  • Loading branch information
zhblue authored Nov 27, 2024
1 parent 50aef9d commit f407984
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions trunk/web/include/login-hustoj.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ function check_login($user_id,$password){
session_start();
$sql="SELECT `user_id`,`password` FROM `users` WHERE `user_id`=? and defunct='N' and expiry_date >= curdate() "; //有效期当天可以登录
$result=pdo_query($sql,$user_id);
if($result==-1){
//database need update
$sql="alter table users add column expiry_date date not null default '2099-01-01' after reg_time;"; // 更新库结构
$result=pdo_query($sql);
$sql="SELECT `user_id`,`password` FROM `users` WHERE `user_id`=? and defunct='N' and expiry_date >= curdate() "; //有效期当天可以登录
$result=pdo_query($sql,$user_id);
}
if(count($result)==1){
$row = $result[0];
if( pwCheck($password,$row['password'])){
Expand Down

0 comments on commit f407984

Please sign in to comment.