<?php
include INDEX_ROOT.'admin/head.php';
admin_head('用户处理层');
if($_GET['m']=='delete'){
    $deluid=$_GET['uid'];
    if((new user\account())->deluser($deluid)==1){
        alert('删除成功');
        go('-1');
    }
}elseif($_GET['m']=='new'){
    if(empty($_POST))sysmsg('POST来的数据不能为空');
    if(empty($_POST['username']))sysmsg('用户名不能为空');
    if(empty($_POST['password']))sysmsg('密码不能为空');
    if(empty($_POST['name']))sysmsg('姓名不能为空');
    if(empty($_POST['gander']))sysmsg('性别不能为空');
    if(empty($_POST['phone']))sysmsg('手机号不能为空');
    if(empty($_POST['email']))sysmsg('邮箱地址不能为空');
    if(empty($_POST['eid']))sysmsg('组卡序号不能为空');
    $aes=new lib\Aes();
    $username=$_POST['username'];
    $password=$aes->encrypt($_POST['password']);
    $name=$_POST['name'];
    $gander=$_POST['gander'];
    $phone=$_POST['phone'];
    $email=$_POST['email'];
    $eid=$_POST['eid'];
    $dep=$_POST['dep'];
    $alias=$_POST['alias'];
    $address=$_POST['address'];
    $post=$_POST['post'];

    $account=new \user\account();
    //基础信息注册
    if($account->check('username',$username)==1)sysmsg('用户名重复');
    if($account->check('callnumber',$phone)==1)sysmsg('手机号重复');
    if($account->check('email',$email)==1)sysmsg('电子邮箱重复');
    if($account->check('eid',$eid)==1)sysmsg('组卡序号重复');
    $uid=$account->basereg($username,$password,$email,$phone,$eid);
    $account->inforeg($uid,$name,$gander,$alias,$address,$post,$dep);

    alert('注册成功');
    go('-1');
}else{
    alert('参数错误，请重新输入');
    go('-1');
}





admin_foot();
?>