Login/LoginAction.class.php

夹谷晋
2023-12-01
<?php
// 本类由系统自动生成,仅供测试用途
class LoginAction extends Action {
    public function index(){
$this->display();
    }
function do_login(){
//dump($_SESSION);
$username=$_POST['username'];
$password=$_POST['password'];
$code=$_POST['code'];
if($_SESSION['verify'] !== md5($code)){
$this->error("验证码错误!");
}
$m=M('User');
$where['username']=$username;
$where['password']=$password;
$i=$m->where($where)->count();
if($i > 0) {
$this->redirect('User/index');
}else{
$this->error('该用户不存在');
}
}
}
 类似资料: