<?php
if(empty($_POST))sysmsg('POST来的数据不能为空');
if(empty($_POST['username']))sysmsg('用户名不能为空');
if(empty($_POST['password']))sysmsg('密码不能为空');

$aes=new lib\Aes();
$username=$_POST['username'];
$password=$aes->encrypt($_POST['password']);

$login=new user\account();
$userinfo=$login->login($username,$password);
if($userinfo['uid']<0){//登录失败
    alert($userinfo['msg']);
}else{
    if ($userinfo['adminer']==1)$cookie::set('admin',$userinfo['uid']."@admin.com",null,'/');
    $cookie::set('uid',$userinfo['uid'],null,'/');
    alert('登录成功');
}
go('-1');
