- include_once libfile('function/member');
- include_once libfile('class/member');
- $userName = 'test3';
- $password = '222222';
- $result = userlogin($userName, $password, '', '', 'username', $_G['clientip']);
- if ($result['ucresult']['uid'] == '-3') {
- echo '登陆失败';
- } else{
- $uid = $_G['uid'] = $result['ucresult']['uid'];
- $userName = $result['ucresult']['username'];
- $userAvatar = avatar($_G['uid'], 'big', true);
- $userAvatar = str_replace("\r", '', $userAvatar);
- $userAvatar = str_replace("\n", '', $userAvatar);
- $ctlObj = new logging_ctl();
- $ctlObj->setting = $_G['setting'];
- if($result['status'] == -1) {
- if(!$ctlObj->setting['fastactivation']) {
- echo '登陆失败';
- die(0);
- }
- $init_arr = explode(',', $ctlObj->setting['initcredits']);
- $groupid = $ctlObj->setting['regverify'] ? 8 : $ctlObj->setting['newusergroupid'];
- C::t('common_member')->insert($uid, $result['ucresult']['username'], md5(random(10)), $result['ucresult']['email'], $_G['clientip'], $groupid, $init_arr);
- $result['member'] = getuserbyuid($uid);
- $result['status'] = 1;
- }
- if($result['status'] > 0) {
- if($ctlObj->extrafile && file_exists($ctlObj->extrafile)) {
- require_once $ctlObj->extrafile;
- }
- setloginstatus($result['member'], $_GET['cookietime'] ? 2592000 : 0);
- checkfollowfeed();
- C::t('common_member_status')->update($_G['uid'], array('lastip' => $_G['clientip'], 'lastvisit' =>TIMESTAMP, 'lastactivity' => TIMESTAMP));
- if(isset($result['member']['password'])){
- unset($result['member']['password']);
- }
- if(isset($result['member']['credits'])){
- unset($result['member']['credits']);
- }
- echo 'login_succeed';
- die(0);
- }
- if($_G['member_loginperm'] > 1) {
- echo 'login_failed';
- }elseif($_G['member_loginperm'] == -1) {
- echo 'error_password';
- }else{
- echo 'too_many_errors';
- }
- }
复制代码
|