wangtengyu
2018-12-07 f459412e0dac4ed94106da043b4c6f8576bfe496
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
 
/**
 * 获取登录信息
*/
    require('includes/safety_mysql.php');
    define('IN_ECS', true);
    require('includes/init.php');
    $user=$_POST['user'];
    
    $pwd=$_POST['pwd'];
    
    $row = $db -> getRow("SELECT * FROM ".$ecs->table('users')." WHERE `user_id`='$user' or `email`='$user' or `user_name`='$user'");
    $result=array();
    if(empty($row)){
        $result['code']=0;
        $result['info']="不存在该用户";
    }else{
        $result['code']=0;
        if(empty($row['ec_salt'])){
            if(md5($pwd)!=$row['password']){
                $result['code']=0;
                $result['info']="密码不正确";
            }else{
                $result['code']=1;
                /*查找代付款的数据   jx*/
                $user_id = $row['user_id'];
                $sql = "SELECT COUNT(*) FROM ".$GLOBALS['ecs']->table('order_info')."WHERE user_id = '$user_id' AND pay_status = 0";
                $row['payment'] = $GLOBALS['db']->getOne($sql);
                /*查找代发货的数据   jx*/
                $sql = "SELECT COUNT(*) FROM ".$GLOBALS['ecs']->table('order_info')."WHERE user_id = '$user_id' AND shipping_status = 0";
                $row['deliver'] = $GLOBALS['db']->getOne($sql);
                /*查找代收货的数据   jx*/
                $sql = "SELECT COUNT(*) FROM ".$GLOBALS['ecs']->table('order_info')."WHERE user_id = '$user_id' AND shipping_status = 1";
                $row['receipt'] = $GLOBALS['db']->getOne($sql);
                /*查找全部订单数据   jx*/
                $sql = "SELECT COUNT(*) FROM ".$GLOBALS['ecs']->table('order_info')."WHERE user_id = '$user_id'";
                $row['quan'] = $GLOBALS['db']->getOne($sql);
                /*会员等级    jx*/
                if($row['user_rank'] == 0)
                {
                    $row['user_rank'] = "非会员";
                    $result['info']=$row;
                }else
                {
                    $rank_id = $row['user_rank'];
                    $sql = "SELECT rank_name FROM ".$GLOBALS['ecs']->table('user_rank')."WHERE rank_id='$rank_id'";
                    $row['user_rank'] = $GLOBALS['db']->getOne($sql);
                    $result['info'] = $row; 
                }
            }
        }else{
            if(md5(md5($pwd).$row['ec_salt'])!=$row['password']){
                $result['code']=0;
                $result['info']="密码不正确";
            }else{
                $result['code']=1;
                /*查找代付款的数据   jx*/
                $user_id = $row['user_id'];
                $sql = "SELECT COUNT(*) FROM ".$GLOBALS['ecs']->table('order_info')."WHERE user_id = '$user_id' AND pay_status = 0";
                $row['payment'] = $GLOBALS['db']->getOne($sql);
                /*查找代发货的数据   jx*/
                $sql = "SELECT COUNT(*) FROM ".$GLOBALS['ecs']->table('order_info')."WHERE user_id = '$user_id' AND shipping_status = 0";
                $row['deliver'] = $GLOBALS['db']->getOne($sql);
                /*查找代收货的数据   jx*/
                $sql = "SELECT COUNT(*) FROM ".$GLOBALS['ecs']->table('order_info')."WHERE user_id = '$user_id' AND shipping_status = 1";
                $row['receipt'] = $GLOBALS['db']->getOne($sql);
                /*查找全部订单数据   jx*/
                $sql = "SELECT COUNT(*) FROM ".$GLOBALS['ecs']->table('order_info')."WHERE user_id = '$user_id'";
                $row['quan'] = $GLOBALS['db']->getOne($sql);
                /*会员等级    jx*/
                if($row['user_rank'] == 0)
                {
                    $row['user_rank'] = "非会员";
                    $result['info']=$row;
                }else
                {
                    $rank_id = $row['user_rank'];
                    $sql = "SELECT rank_name FROM ".$GLOBALS['ecs']->table('user_rank')."WHERE rank_id='$rank_id'";
                    $row['user_rank'] = $GLOBALS['db']->getOne($sql);
                    $result['info'] = $row; 
                }
                
                
            }
        }
        
 
    }
    print_r(json_encode($result));
 
?>