//Login Verification Submission Public functionDologin () {$use= M ("Users"); $username=i (' Post.username '); $yh=$use->where ("User_login = ' {$username} ' ")->select ();//Search for user- created time based on user-submitted user name $tim=$yh[0] [' Create_time '];//time the user was created $timec=Strtotime("$tim+ 1 Year ");//Timestamp (time + 1 years) of the creation of the user $notim=Strtotime(' Now ');//The time stamp now, if the timestamp is now greater than the timestamp (created time + 1), performs a pull-black operation (user_status = 0) and a friendly prompt, else performs normal access if($notim>$timec) { $data[' user_status '] = 0; $use->where ("User_login = ' {$username} ' ")->save ($data); $this->error ("Your registered member has expired, please contact customer service or renew use!") "); } Else { if(!Sp_check_verify_code ()) { $this->error ("Captcha Error! "); } $users _model=m ("Users"); $rules=Array( //Array (validation fields, validation rules, error prompts, validation criteria, additional rules, validation time) Array(' username ', ' require ', ' mobile phone number/email/username cannot be empty! ', 0),Array(' Password ', ' Require ', ' password cannot be empty! ', 0), ); if($users _model->validate ($rules)->create () = = =false){ $this->error ($users _model-GetError ()); } $username=i (' Post.username '); if(Preg_match('/(^ (13\d|15[^4\d]|17[13678]|18\d) \d{8}|170[^346\d]\d{7}) $/',$username)){//Mobile phone Number login $this-_do_mobile_login (); }Else{ $this->_do_email_login ();//user name or email loginSession (' Uname ',$username); } } }
View Code
Thinkphp member registration expires after 1 years auto-black