Skip to content

Instantly share code, notes, and snippets.

@sivagao
Created June 15, 2013 02:10
Show Gist options
  • Save sivagao/5786502 to your computer and use it in GitHub Desktop.
Save sivagao/5786502 to your computer and use it in GitHub Desktop.
onlogin_discuz.php
global $_G;
// not working, always been none
// $from_connect = $this->setting['connect']['allow'] && !empty($_GET['from']) ? 1 : 0;
// $seccodecheck = $from_connect ? false : $this->setting['seccodestatus'] & 2;
// $seccodestatus = !empty($_GET['lssubmit']) ? false : $seccodecheck;
// $invite = getinvite();
$_G['uid'] = $_G['member']['uid'] = 0;
$_G['username'] = $_G['member']['username'] = $_G['member']['password'] = '';
// need to change these...
$result = userlogin('ghlndsl', '282331561', '0', '', 'auto', $_G['clientip']);
$uid = $result['ucresult']['uid'];
if($this->extrafile && file_exists($this->extrafile)) {
require_once $this->extrafile;
}
setloginstatus($result['member'], 0);
checkfollowfeed();
if($_G['member']['lastip'] && $_G['member']['lastvisit']) {
dsetcookie('lip', $_G['member']['lastip'].','.$_G['member']['lastvisit']);
}
C::t('common_member_status')->update($_G['uid'], array('lastip' => $_G['clientip'], 'lastvisit' =>TIMESTAMP, 'lastactivity' => TIMESTAMP));
$ucsynlogin = $this->setting['allowsynlogin'] ? uc_user_synlogin($_G['uid']) : '';
$param = array(
'username' => $result['ucresult']['username'],
'usergroup' => $_G['group']['grouptitle'],
'uid' => $_G['member']['uid'],
'groupid' => $_G['groupid'],
'syn' => $ucsynlogin ? 1 : 0
);
$extra = array(
'showdialog' => true,
'locationtime' => true,
'extrajs' => $ucsynlogin
);
$loginmessage = $_G['groupid'] == 8 ? 'login_succeed_inactive_member' : 'login_succeed';
$location = dreferer();
showmessage($loginmessage, $location, $param, $extra);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment