-
Notifications
You must be signed in to change notification settings - Fork 3
/
_reg.php
46 lines (45 loc) · 1.42 KB
/
_reg.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
//开启session
session_start();
require_once '../lib/config.php';
//引入AES
require_once '../lib/Ss/AES/aes.class.php';
require_once '../lib/Ss/AES/aesctr.class.php';
$email = $_POST['email'];
$email = strtolower($email);
$passwd = AesCtr::decrypt($_POST['passwd'], $_SESSION['randomChar'], 256);
$name = $_POST['name'];
$repasswd = AesCtr::decrypt($_POST['repasswd'], $_SESSION['randomChar'], 256);
$agree = $_POST['agree'];
$code = $_POST['code'];
$c = new \Ss\User\UserCheck();
$code = new \Ss\User\InviteCode($code);
if(!$code->IsCodeOk()){
$a['msg'] = "邀请码无效";
}elseif(!$c->IsEmailLegal($email)){
$a['msg'] = "邮箱无效";
}elseif($c->IsEmailUsed($email)){
$a['msg'] = "邮箱已被使用";
}elseif($repasswd != $passwd){
$a['msg'] = "两次密码输入不符";
}elseif(strlen($passwd)<8){
$a['msg'] = "密码太短";
}elseif(strlen($name)<7){
$a['msg'] = "用户名太短";
}elseif($c->IsUsernameUsed($name)){
$a['msg'] = "用户名已经被使用";
}else{
// get value
$ref_by = $code->GetCodeUser();
$passwd = \Ss\User\Comm::SsPW($passwd);
$plan = "A";
$transfer = $a_transfer;
$invite_num = rand($user_invite_min,$user_invite_max);
//do reg
$reg = new \Ss\User\Reg();
$reg->Reg($name,$email,$passwd,$plan,$transfer,$invite_num,$ref_by);
$code->Del();
$a['ok'] = '1';
$a['msg'] = "注册成功";
}
echo json_encode($a,JSON_UNESCAPED_UNICODE);