commit | author | age
|
e2b48d
|
1 |
<?php |
B |
2 |
|
|
3 |
/** |
|
4 |
* 获取登录信息 |
|
5 |
*/ |
|
6 |
define('IN_ECS', true); |
|
7 |
require('includes/init.php'); |
|
8 |
|
|
9 |
if($_POST['acr'] == 'app') |
|
10 |
{ |
|
11 |
if($_POST['act'] == 'reg') |
|
12 |
{ |
|
13 |
$user= isset($_POST['user'])? $_POST['user'] : ''; |
|
14 |
$email= isset($_POST['email']) ? $_POST['email'] : ''; |
|
15 |
$sex= $_POST['sex']; |
|
16 |
$pwd=md5($_POST['pwd']); |
|
17 |
$result=array(); |
|
18 |
$row = $db -> getRow("SELECT * FROM ".$ecs->table('users')." WHERE `user_name`='$user'"); |
|
19 |
if(!empty($row)){ |
|
20 |
$result['code']=2; |
|
21 |
$result['info']="该用户名已经存在"; |
|
22 |
print_r(json_encode($result)); |
|
23 |
exit(); |
|
24 |
} |
|
25 |
$row = $db -> getRow("SELECT * FROM ".$ecs->table('users')." WHERE `email`='$email'"); |
|
26 |
if(!empty($row)){ |
|
27 |
$result['code']=3; |
|
28 |
$result['info']="该邮箱已经存在"; |
|
29 |
print_r(json_encode($result)); |
|
30 |
exit(); |
|
31 |
} |
|
32 |
$add = array( |
|
33 |
'user_name' => $user, |
|
34 |
'email' => $email, |
|
35 |
'password' => $pwd, |
|
36 |
'reg_time' => gmtime(), |
|
37 |
'sex' => $sex |
|
38 |
); |
|
39 |
$set=$db->autoExecute($ecs->table('users'), $add, 'INSERT'); |
|
40 |
if($set){ |
|
41 |
/*注册赠送积分*/ |
|
42 |
$sql="SELECT value FROM ".$ecs->table('shop_config')." WHERE id='220'"; |
|
43 |
$shop_config=$db ->getRow($sql); |
|
44 |
$shop_config_integral=intval($shop_config['value']); |
|
45 |
if($shop_config_integral>0){ |
|
46 |
$row = $db -> getRow("SELECT * FROM ".$ecs->table('users')." WHERE `user_name`='$user'"); |
|
47 |
$uid=$row['user_id']; |
|
48 |
$user_log=array(); |
|
49 |
$user_log['user_id'] = $uid; |
|
50 |
$user_log['user_money'] = '0.00'; |
|
51 |
$user_log['frozen_money'] = '0.00'; |
|
52 |
$user_log['rank_points'] ='0'; |
|
53 |
$user_log['pay_points'] = $shop_config_integral; |
|
54 |
$user_log['change_desc'] = '注册赠送积分'; |
|
55 |
$user_log['change_type'] = '99'; |
|
56 |
$user_log['change_time'] = gmtime(); |
|
57 |
$db->autoExecute($ecs->table('account_log'), $user_log, 'INSERT'); |
|
58 |
$sql="UPDATE ".$ecs->table('users') . " SET `pay_points`=`pay_points`+$shop_config_integral WHERE `user_id`='$uid'"; |
|
59 |
$db->query($sql); |
|
60 |
} |
|
61 |
|
|
62 |
|
|
63 |
$row = $db -> getRow("SELECT * FROM ".$ecs->table('users')." WHERE `user_name`='$user'"); |
|
64 |
$result['code']=1; |
|
65 |
$result['info']=$row; |
|
66 |
print_r(json_encode($result)); |
|
67 |
exit(); |
|
68 |
} |
|
69 |
} |
|
70 |
} |
|
71 |
else |
|
72 |
{ |
|
73 |
$redirect_url = "http://".$_SERVER["HTTP_HOST"].str_replace("user.php", "index.php"); |
|
74 |
header('Location: '.$redirect_url); |
|
75 |
} |
|
76 |
?> |