修改使用登录及添加用户在线验证
This commit is contained in:
1 parent
1b4abd1ee3
commit
2cb2202ed2
9 files changed
+68
-76
No files matched your search
@@ -6,22 +6,41 @@ namespace app\http\middleware;
|
||||
use think\Controller;
|
||||
// 引用权限验证类
|
||||
use \php4world\Auth;
|
||||
// 引用用户数据模型
|
||||
use app\member\model\Member;
|
||||
|
||||
|
||||
class YanZheng extends Controller
|
||||
{
|
||||
public function handle($request, \Closure $next)
|
||||
{
|
||||
// 验证用户在否登录
|
||||
if(!session('?userid') && cookie('name') == null )
|
||||
// 声明帐号密码变量
|
||||
$username = 0;
|
||||
$password = 0;
|
||||
|
||||
// 实例化用户类
|
||||
$membermod = new Member();
|
||||
|
||||
// 如果用户没有登录直接跳转到登录页面
|
||||
if( session('?userid') )
|
||||
{
|
||||
// 跳转到首页
|
||||
$this->redirect('/login');
|
||||
return '验证失败';
|
||||
$username = session('username');
|
||||
$password = session('password');
|
||||
}elseif(cookie('username') != null)
|
||||
{
|
||||
// 获取用户名和密码
|
||||
$username = cookie('username');
|
||||
$password = cookie('password');
|
||||
}else{
|
||||
//
|
||||
dump('检验密码对不对');
|
||||
$this->error('登录超时啦,请登录登录');
|
||||
}
|
||||
|
||||
// 检验用户名或密码是否正确
|
||||
$yz = action('login/index/check',['username'=>$username,'password'=>$password]);
|
||||
if($yz == null){
|
||||
$this->error('请使用新密码登录');
|
||||
}
|
||||
|
||||
// 验证用户名和密码是否正确
|
||||
// 验证用户权限
|
||||
|
||||
|
||||
Reference in new issue
Block a user