葬2017-12-05 08:34:43
这是use.php
<?php
namespace appindexcontroller;
use appindexcontrollerBase;
use thinkRequest;
use appindexmodelUser as UserModel;
class user extends Base
{
//登录界面
public function login()
{
return $this-> view ->fetch();
}
//验证登录 $this ->validate($data,$rule,$msq)
public function checklogin(Request $request)
{
//厨师返回值
$status = 0;
$result = '';
$data = $request -> param();
//创建验证规则
$rule = [
'name|用户名' => 'require', //用户名必填
"password|密码" => 'require', //用户名必填
'verify|验证码' => 'require|captcha', //用户名必填
];
//进行验证
$result = $this -> validate($data,$rule);
//如果验证通过
if ($result === true){
//构造查询条件
$map =[
'name' => $data['name'],
"password" => md5($data["password"]),
];
//查询用户信息
$user =UserModel::get($map);
if($user == null){
$result = '没有找到该用户';
}else{
$status = 1;
$result = '验证通过,点击【确定】进入';
}
}
return ['status'=>$status,'message'=>$result,'data'=>$data];
}
//退出登录
public function logout()
{
}
}
这是登录页面的html login.html
<title>后台登录 - H-ui.admin.page v3.0</title>
<meta name="keywords" content="H-ui.admin v3.0,H-ui网站后台模版,后台模版下载,后台管理系统模版,HTML后台模版下载">
<meta name="description" content="H-ui.admin v3.0,是一款由国人开发的轻量级扁平化网站后台模板,完全免费开源的网站后台管理系统模版,适合中小型CMS后台系统。">
</head>
<body>
<input type="hidden" id="TenantId" name="TenantId" value="" />
<div class="header"></div>
<div class="loginWraper">
<div id="loginform" class="loginBox">
<form class="form form-horizontal" action="index.html" method="post">
<div class="row cl">
<label class="form-label col-xs-3"><i class="Hui-iconfont"></i></label>
<div class="formControls col-xs-8">
<input id="" name="name" type="text" placeholder="账户" class="input-text size-L">
</div>
</div>