鼠笼管理系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

26 lines
1.1 KiB

<?php
class Admin_LoginController extends Ctrl_Admin{
public function IndexAction(){
session_destroy();
unset($_SESSION);
$HospitalInfo = $this->HospitalInfo();
$this->assign('HospitalInfo',$HospitalInfo);
}
public function LoginAction(){
$tAMO = new AdminModel;
$REQUEST =json_decode(file_get_contents('php://input'),true);
$pPasswd = empty($REQUEST['password'])?Tool_Fnc::ajaxMsg('密码不能为空'):trim($REQUEST['password']);
$pName = empty($REQUEST['username'])?Tool_Fnc::ajaxMsg('用户名不能为空'):Tool_Fnc::safe_string($REQUEST['username']);
$AdminInfo = $tAMO->field("*")->where("admin_username='{$pName}'")->fRow();
if (empty($AdminInfo)) {
Tool_Fnc::apiMsg('用户名错误',500);
}
$password = $AdminInfo['admin_password'];
$QueryPwd = Tool_Fnc::markmd5($pPasswd,$AdminInfo['admin_token']);
if ($password!=$QueryPwd) {
Tool_Fnc::apiMsg('密码错误',500);
}
$data['token'] = Tool_Fnc::markmd5($AdminInfo['admin_token'],$AdminInfo['admin_password']);
Tool_Fnc::apiMsg('登陆成功',20000,$data);
}
}