Exemplo n.º 1
0
 public function login()
 {
     $username = jget('username', 'txt');
     $password = jget('password');
     $openid = jget('openid');
     if ($username == "" || $password == "") {
         json_error("无法登录,用户名或密码不能为空");
     }
     if ($this->Config['login_by_uid']) {
         is_numeric($username) && json_error("禁止使用UID登录");
     }
     if ($GLOBALS['_J']['plugins']['func']['login']) {
         hookscript('login', 'funcs', array('param' => $this->Post, 'step' => 'check'), 'login');
     }
     $rets = jsg_member_login($username, $password);
     $uid = (int) $rets['uid'];
     if ($uid < 1) {
         json_error(array_iconv($this->Config['charset'], 'utf-8', $rets['error']));
     }
     $r = false;
     if ($openid && $uid) {
         $r = jlogic('wechat')->do_bind($openid, $uid);
     }
     if ($r) {
         json_result("绑定成功!");
     } else {
         json_error("绑定失败!");
     }
 }
Exemplo n.º 2
0
 function login()
 {
     $username = trim($this->Post['user_name']);
     $password = trim($this->Post['password']);
     if ($username == "" || $password == "") {
         Mobile::error("UserName Or PassWord Is Empty", 320);
     }
     jfunc('member');
     $rets = jsg_member_login($username, $password);
     if ($rets['uid'] < 1) {
         $_msgs = array('0' => array('tips' => 'Unknown Error', 'code' => 403), '-1' => array('tips' => 'Username Error', 'code' => 321), '-2' => array('tips' => 'Password Error', 'code' => 322), '-3' => array('tips' => 'Input Error', 'code' => 323));
         Mobile::error($_msgs[$rets['uid']]['tips'], $_msgs[$rets['uid']]['code']);
     }
     $ret = $this->_getMemberInfoByUid($rets['uid']);
     Mobile::output($ret);
 }
Exemplo n.º 3
0
 function DoLogin()
 {
     $this->Username = wap_iconv($this->Username, 'utf-8', $this->Config['charset'], 1);
     $this->Password = wap_iconv($this->Password, 'utf-8', $this->Config['charset'], 1);
     if ($this->Username == "" || $this->Password == "") {
         $this->Messager("无法登录,用户名或密码不能为空", 'index.php?mod=login');
     }
     $username = $this->Username;
     $password = $this->Password;
     if ($this->Config['reg_email_verify'] == '1') {
         $member_info = DB::fetch_first("select `uid`,`username` from " . DB::table('members') . " where `username`='{$username}' limit 0,1");
         if ($member_info) {
             $member_validate = DB::fetch_first("select `uid`,`status` from " . DB::table('member_validate') . " where `uid`='{$member_info['uid']}' ");
         }
         if ($member_validate) {
             if ($member_validate['status'] != '1') {
                 $this->Messager("必须完成邮件激活,才能正常访问!进入注册时填写的邮箱激活即可。", 'index.php?mod=login');
             }
         }
     }
     $referer = jget('referer');
     if (!$referer) {
         $referer = jsg_getcookie('referer');
     }
     $rets = jsg_member_login($username, $password);
     if ($rets['uid'] < 1) {
         $this->Messager(wap_iconv($rets['error']), null);
     }
     $uid = $rets['uid'];
     if ($this->Config['extcredits_enable'] && $rets['uid'] > 0) {
         update_credits_by_action('login', $rets['uid']);
     }
     $redirecto = $referer ? $referer : referer('index.php');
     if (strpos($redirecto, 'login') !== false) {
         $redirecto = "index.php?mod=topic&code=myhome";
     }
     if ($this->Post['loginType'] == 'share') {
         $redirecto = $this->Post['return_url'];
     }
     $this->Messager('登录成功', $redirecto, 0);
 }
Exemplo n.º 4
0
 function do_other_login()
 {
     $username = $this->Post['username'];
     $password = $this->Post['password'];
     $savelogin = $this->Post['savelogin'];
     if (!$username || !$password) {
         $this->other_login();
         return false;
     }
     $member = jsg_member_login($username, $password);
     if ($member['uid'] < 0) {
         include template('login/login_index_other');
         return FALSE;
     } else {
         if ($savelogin) {
             jsg_member_login_set_status($member);
         }
         $member = jsg_member_info($member['uid']);
         $this->show_user($member);
     }
 }
Exemplo n.º 5
0
 function DoLogin()
 {
     $this->_check_oauth2();
     $this->_hash_check();
     if (false != ($check_result = $this->_login_check())) {
         $this->Messager($check_result, null);
     }
     $timestamp = time();
     $username = trim($this->Post['username']);
     $password = trim($this->Post['password']);
     $rets = jsg_member_login($username, $password);
     $bind_info = $this->Post['bind_info'];
     if ($bind_info) {
         $this->_bind($rets['uid'], $bind_info);
     }
     if ($rets['uc_syn_html']) {
         $this->Messager("登录成功,现在为您转入到首页{$rets['uc_syn_html']}", $this->Config['site_url'], 5);
     } else {
         $this->Messager(null, $this->Config['site_url']);
     }
 }
Exemplo n.º 6
0
 function DoRegister()
 {
     if (MEMBER_ID != 0 and false == $this->IsAdmin) {
         $this->Messager('您已经是注册用户,无需再注册!', -1);
     }
     $regstatus = jsg_member_register_check_status();
     if ($regstatus['error']) {
         $this->Messager($regstatus['error'], null);
     }
     $message = array();
     $timestamp = time();
     $noemail = 0;
     $sms_ckret = 0;
     if ($this->_sms_register()) {
         $sms_bind_num = $this->Post['sms_bind_num'];
         $sms_bind_key = $this->Post['sms_bind_key'];
         $sms_ckret = sms_check_bind_key($sms_bind_num, $sms_bind_key);
         if ($sms_ckret) {
             $this->Messager($sms_ckret, -1);
         }
         $noemail = jconf::get('sms', 'register_verify', 'noemail');
         if ($noemail) {
             $this->Post['email'] = $sms_bind_num . '@139.com';
         }
     }
     if ($this->Config['seccode_enable'] == 1 && $this->Config['seccode_register']) {
         if (!ckseccode(@$_POST['seccode'])) {
             $this->Messager("验证码输入错误", -1);
         }
     } elseif ($this->Config['seccode_enable'] > 1 && $this->Config['seccode_register'] && $this->yxm_title && $this->Config['seccode_pub_key'] && $this->Config['seccode_pri_key']) {
         $YinXiangMa_response = jlogic('seccode')->CheckYXM(@$_POST['add_YinXiangMa_challenge'], @$_POST['add_YXM_level'][0], @$_POST['add_YXM_input_result']);
         if ($YinXiangMa_response != "true") {
             $this->Messager("验证码输入错误", -1);
         }
     }
     $inviter_member = array();
     $invite_code = $this->Post['invite_code'] ? $this->Post['invite_code'] : $this->Get['invite_code'];
     $check_result = jsg_member_register_check_invite($invite_code);
     if ($regstatus['invite_enable'] && !$regstatus['normal_enable']) {
         if (!$invite_code) {
             $this->Messager("本站目前需要有好友邀请链接才能注册。<br><br>看看<a href=\"?mod=topic&code=top\">达人榜</a>中有没有你认识的人,让他给你发一个好友邀请。", null);
         }
         if (!$check_result) {
             $this->Messager("对不起,您访问的邀请链接不正确或者因邀请数已满而失效,请重新与邀请人索取链接。", null);
         }
     }
     if ($check_result['uid'] > 0) {
         $inviter_member = jsg_member_info($check_result['uid']);
     }
     if (!$inviter_member && $this->Config['register_invite_input']) {
         $inviter_member = jsg_member_info($this->Post['inviter_nickname'], 'nickname');
     }
     $password = $this->Post['password'];
     $email = $this->Post['email'];
     $username = $nickname = $this->Post['nickname'];
     if (strlen($password) < 5) {
         $this->Messager("密码过短,请设置至少5位", -1);
     }
     if ($password != $this->Post['password2']) {
         $this->Messager("两次输入的密码不相同", -1);
     }
     if ($GLOBALS['_J']['plugins']['func']['reg']) {
         hookscript('reg', 'funcs', array('param' => $this->Post, 'step' => 'check'), 'reg');
     }
     $uid = jsg_member_register($nickname, $password, $email);
     if ($uid < 1) {
         $regconf = jconf::get('register');
         $rets = array('0' => '【注册失败】有可能是站点关闭了注册功能', '-1' => '帐户/昵称 不合法,含有不允许注册的字符,请尝试更换一个。', '-2' => '帐户/昵称 不允许注册,含有被保留的字符,请尝试更换一个。', '-3' => '帐户/昵称 已经存在了,请尝试更换一个。', '-4' => 'Email 不合法,请输入正确的Email地址。', '-5' => 'Email 不允许注册,请尝试更换一个。', '-6' => 'Email 已经存在了,请尝试更换一个。', '-7' => '您的IP地址 ' . $GLOBALS['_J']['client_ip'] . ' 已经被限制注册了(一个IP地址 ' . $regconf['time_html'] . ' 之内,最多只能注册 ' . $regconf['limit'] . ' 个用户),请稍后再试或联系管理员');
         $this->Messager($rets[$uid], null);
     }
     $datas = array();
     $datas['uid'] = $uid;
     if ($this->_sms_register()) {
         $datas['phone'] = $sms_bind_num;
     }
     jtable('members')->update($datas);
     if ($this->_sms_register()) {
         $_sms_info = _sms_client_user($sms_bind_num);
         $_sms_sets = array('uid' => $uid, 'username' => $username, 'bind_key' => 0, 'bind_key_time' => 0, 'try_bind_times' => '+1', 'last_try_bind_time' => $timestamp);
         sms_client_user_update($_sms_sets, $_sms_info);
     }
     if ($inviter_member) {
         jsg_member_register_by_invite($inviter_member['uid'], $uid, $check_result);
     }
     $rets = jsg_member_login($uid, $password, 'uid');
     $redirect_to = jget('referer');
     if (!$redirect_to || $redirect_to == $this->Config['site_url']) {
         if ($this->Config['reg_email_verify']) {
             $redirect_to = jurl('index.php?mod=member&code=setverify&ids=' . $uid . '&from=reg');
         } elseif ($this->Config['reg_step3_radio']) {
             $redirect_to = jurl('index.php?mod=member&code=follow_channel');
         } elseif ($this->Config['reg_step4_radio']) {
             $redirect_to = jurl('index.php?mod=member&code=follow_member');
         } elseif ($this->Config['reg_step5_radio']) {
             $redirect_to = jurl('index.php?mod=member&code=add_face');
         } elseif ($this->Config['reg_step6_radio']) {
             $redirect_to = jurl('index.php?mod=member&code=member_profile');
         } elseif ($this->Config['reg_step7_radio']) {
             $redirect_to = jurl('index.php?mod=member&code=do_first_topic');
         } else {
             $redirect_to = jurl('index.php?mod=topic');
         }
     }
     $this->Messager(NULL, $redirect_to, 0);
 }
Exemplo n.º 7
0
 function DoLogin()
 {
     if ($this->Config['seccode_enable'] == 1 && $this->Config['seccode_login']) {
         if (!ckseccode(@$_POST['seccode'])) {
             $this->Messager("验证码输入错误", -1);
         }
     } elseif ($this->Config['seccode_enable'] > 1 && $this->Config['seccode_login'] && $this->yxm_title && $this->Config['seccode_pub_key'] && $this->Config['seccode_pri_key']) {
         $YinXiangMa_response = jlogic('seccode')->CheckYXM(@$_POST['YinXiangMa_challenge'], @$_POST['YXM_level'][0], @$_POST['YXM_input_result']);
         if ($YinXiangMa_response != "true") {
             $this->Messager("验证码输入错误", -1);
         }
     }
     if ($this->Username == "" || $this->Password == "") {
         $this->Messager("无法登录,用户名或密码不能为空", -1);
     }
     $username = $this->Username;
     $password = $this->Password;
     $referer = jget('referer');
     if (!$referer) {
         $referer = jsg_getcookie('referer');
     }
     $rets = jsg_member_login($username, $password);
     $uid = (int) $rets['uid'];
     if ($uid < 1) {
         $this->Messager($rets['error'], null);
     }
     $member = jsg_member_info(MEMBER_ID);
     $this->Config['reg_email_verify'] == 1 && $member['email_checked'] == 0 && ($referer = 'index.php?mod=member&code=setverify&ids=' . $uid);
     $this->Config['email_must_be_true'] == 2 && $member['email_checked'] == 0 && ($referer = 'index.php?mod=member&code=setverify&ids=' . $uid);
     if ($this->Config['extcredits_enable'] && $uid > 0) {
         update_credits_by_action('login', $uid);
     }
     Load::logic('other');
     $otherLogic = new OtherLogic();
     $sql = "SELECT m.id as medal_id,m.medal_img,m.medal_name,m.medal_depict,m.conditions,u.dateline,y.apply_id\r\n\t\t\t\tFROM " . TABLE_PREFIX . "medal m\r\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "user_medal u ON (u.medalid = m.id AND u.uid = '{$uid}')\r\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "medal_apply y ON (y.medal_id = m.id AND y.uid = '{$uid}')\r\n\t\t\t\tWHERE m.is_open = 1\r\n\t\t\t\tORDER BY u.dateline DESC,m.id";
     $query = $this->DatabaseHandler->Query($sql);
     while (false != ($rs = $query->GetRow())) {
         $rs['conditions'] = unserialize($rs['conditions']);
         if (in_array($rs['conditions']['type'], array('topic', 'reply', 'tag', 'invite', 'fans', 'sign')) && !$rs['dateline']) {
             $result .= $otherLogic->autoCheckMedal($rs['medal_id'], $uid);
         }
     }
     $redirecto = $referer ? $referer : referer();
     $redirecto = str_replace('#', '', $redirecto);
     if ($this->Post['loginType'] == 'share') {
         $redirecto = $this->Post['return_url'];
         $this->Messager(null, $redirecto, 0);
     }
     if ($this->Post['loginType'] == 'show_login') {
         $this->Messager(NULL, $redirecto, 0);
     }
     if ($rets['uc_syn_html']) {
         $this->Messager("登录成功{$rets['uc_syn_html']}", $redirecto, 3);
     } else {
         $this->Messager(null, $redirecto);
     }
 }
Exemplo n.º 8
0
 function DoLogin()
 {
     $this->_hash_check();
     if (false != ($check_result = $this->_login_check())) {
         $this->Messager($check_result, null);
     }
     $timestamp = TIMESTAMP;
     $username = trim($this->Post['username']);
     $password = trim($this->Post['password']);
     $rets = jsg_member_login($username, $password);
     $this->_bind($rets['uid']);
     if ($rets['uc_syn_html']) {
         $this->Messager("登录成功{$rets['uc_syn_html']}", $this->redirect_to, 5);
     } else {
         $this->Messager(null, $this->redirect_to);
     }
 }
Exemplo n.º 9
0
 function Login2()
 {
     $username = trim(jget('username'));
     $password = jget('password');
     if ($username == "" || $password == "") {
         json_error("无法登录,用户名或密码不能为空");
     }
     if ($GLOBALS['_J']['plugins']['func']['login']) {
         hookscript('login', 'funcs', array('param' => $this->Post, 'step' => 'check'), 'login');
     }
     $referer = jget('referer');
     if (!$referer) {
         $referer = jsg_getcookie('referer');
     }
     $rets = jsg_member_login($username, $password);
     $uid = (int) $rets['uid'];
     if ($uid < 1) {
         json_error($rets['error']);
     }
     $member = jsg_member_info($uid);
     $this->Config['email_must_be_true'] == 2 && $member['email_checked'] == 0 && ($referer = 'index.php?mod=member&code=setverify&ids=' . $uid);
     if ($this->Config['extcredits_enable'] && $uid > 0) {
         update_credits_by_action('login', $uid);
     }
     Load::logic('other');
     $otherLogic = new OtherLogic();
     $sql = "SELECT m.id as medal_id,m.medal_img,m.medal_name,m.medal_depict,m.conditions,u.dateline,y.apply_id\r\n\t\t\t\tFROM " . TABLE_PREFIX . "medal m\r\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "user_medal u ON (u.medalid = m.id AND u.uid = '{$uid}')\r\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "medal_apply y ON (y.medal_id = m.id AND y.uid = '{$uid}')\r\n\t\t\t\tWHERE m.is_open = 1\r\n\t\t\t\tORDER BY u.dateline DESC,m.id";
     $query = $this->DatabaseHandler->Query($sql);
     while (false != ($rs = $query->GetRow())) {
         $rs['conditions'] = unserialize($rs['conditions']);
         if (in_array($rs['conditions']['type'], array('topic', 'reply', 'tag', 'invite', 'fans')) && !$rs['dateline']) {
             $result .= $otherLogic->autoCheckMedal($rs['medal_id'], $uid);
         }
     }
     header("location:mobile/index.php");
 }