chengkun
2025-04-27 a0402d122fee696e2b7684ef7edfc504ade12640
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
 
/*
    EDOOG.COM (C) 2009-2012 EDOOG Inc.
    This is NOT a freeware, use is subject to license terms
    V2.0  2012.3.5
*/
 
define('S_DIR',dirname(__FILE__)."/");
define('P_W','admincp');
define('PHPYUN',dirname(dirname(dirname(__FILE__))));
@require_once(S_DIR.'security.php');
@require_once(S_DIR.'pw_common.php');
@require_once(PHPYUN.'/data/api/pw_api/pw_config.php');
@include_once(S_DIR.'pw_client/uc_client.php');
 
class PwClientAPI{
       public $username;
     public $password;
     public $usermail;
       public $db;
       function __construct($username='',$password='',$usermail=''){
           $this->username=$username;
           $this->password=$password;
           $this->usermail=$usermail;
 
           error_reporting('E_ALL ^ E_NOTICE');
       }
       function register(){
           return uc_user_register($this->username,md5($this->password),$this->usermail);
       }
       function get_user($userid='',$type=0){
            return uc_user_get($userid,$type);
       }
       function checkename(){
           $checkuser =uc_check_username($this->username);
           if($checkuser==1){
               return 1;
           }elseif($checkuser==-1){
               return -1;
           }else{
               return -3;
           }
       }
       function checkemail(){
           $emailcount=uc_check_email($this->usermail);
           if($emailcount>0){
               return 1;
           }elseif($emailcount==-3){
               return -4;
           }else{
               return -6;
           }
       }
       function logout(){
           return uc_user_synlogout();
       }
       function user_login(){
           $userarr =uc_user_get($this->username,0);
           return uc_user_check($userarr['uid'],md5(UC_KEY.md5($this->password)));
       }
       function login($userid){
           $user_login=uc_user_login($userid,md5($this->password),1);
           return $user_login['synlogin'];
       }
       function getavatar($userid,$type){
           $userarr =uc_user_get($userid,1);
           $usericonarr=explode('|',$userarr['avatar']);
           if($usericonarr[0]=='none.gif' || empty($usericonarr[0]) || $usericonarr[1]==1){
                if($type){
                     $avatar='<img src="'.TURL.'member/images/no_avatar_middle.gif"/>';
                }else{
                     $avatar='<img src="'.TURL.'member/images/no_avatar_small.gif"/>';
                }
           }else{
                if($usericonarr[1]==2){
                     $avatar='<img src="'.$usericonarr[0].'" />';
                }else{
                      if($type){
                           $avatar='<img src="'.UC_API.'/attachment/upload/middle/'.$usericonarr[0].'" />';
                      }else{
                           $avatar='<img src="'.UC_API.'/attachment/upload/small/'.$usericonarr[0].'" />';
                      }
                }
           }
           return $avatar;
 
       }
       function avatar($userid){
           return '<p><a href="'.UC_API.'/profile.php?action=modify&info_type=face" class="my_avatar_icon" style="font-weight:bold;">[点击同步修改头像]</a></p>';
       }
       function send_sms($fromuid=0,$msgto=0,$subject='',$message=''){
            $user=$this->GetMysqlOne('username'," ".$this->GetTable('member')."  WHERE uid='$fromuid'");
            return  uc_msg_send($fromuid,$user['username'],$msgto,$subject,$message);
       }
       function credit_add($uid,$point){
          $credit=array("$uid"=> array('credit'=>$point));
          return uc_credit_add($credit);
       }
       function user_edit($newpassword='',$ignoreoldpw=0){
            $userarr=uc_user_get($this->username,0);
            $checkedit=uc_user_edit($userarr['uid'],$this->username,md5($newpassword),$this->usermail);
            if($checkedit==1){
                return 1;
            }else{
                return -1;
            }
       }
       function get_creditsettings(){
           return false;
       }
              function feed_add($feed){
           return false;
       }
}
?>