Beispiel #1
0
function register($add)
{
    global $empire, $dbtbpre, $public_r, $ecms_config;
    //关闭注册
    if ($public_r['register_ok']) {
        printerror('CloseRegister', '', 1);
    }
    //验证时间段允许操作
    eCheckTimeCloseDo('reg');
    //验证IP
    eCheckAccessDoIp('register');
    if (!empty($ecms_config['member']['registerurl'])) {
        Header("Location:" . $ecms_config['member']['registerurl']);
        exit;
    }
    //已经登陆不能注册
    if (getcvar('mluserid')) {
        printerror('LoginToRegister', '', 1);
    }
    CheckCanPostUrl();
    //验证来源
    $username = trim($add['username']);
    $password = trim($add['password']);
    $username = RepPostVar($username);
    $password = RepPostVar($password);
    $email = RepPostStr($add['email']);
    if (!$username || !$password || !$email) {
        printerror("EmptyMember", "history.go(-1)", 1);
    }
    $tobind = (int) $add['tobind'];
    //验证码
    $keyvname = 'checkregkey';
    if ($public_r['regkey_ok']) {
        ecmsCheckShowKey($keyvname, $add['key'], 1);
    }
    $user_groupid = eReturnMemberDefGroupid();
    $groupid = (int) $add['groupid'];
    $groupid = empty($groupid) ? $user_groupid : $groupid;
    CheckMemberGroupCanReg($groupid);
    //IP
    $regip = egetip();
    $regipport = egetipport();
    //用户字数
    $pr = $empire->fetch1("select min_userlen,max_userlen,min_passlen,max_passlen,regretime,regclosewords,regemailonly from {$dbtbpre}enewspublic limit 1");
    $userlen = strlen($username);
    if ($userlen < $pr[min_userlen] || $userlen > $pr[max_userlen]) {
        printerror('FaiUserlen', '', 1);
    }
    //密码字数
    $passlen = strlen($password);
    if ($passlen < $pr[min_passlen] || $passlen > $pr[max_passlen]) {
        printerror('FailPasslen', '', 1);
    }
    if ($add['repassword'] !== $password) {
        printerror('NotRepassword', '', 1);
    }
    if (!chemail($email)) {
        printerror('EmailFail', '', 1);
    }
    if (strstr($username, '|') || strstr($username, '*')) {
        printerror('NotSpeWord', '', 1);
    }
    //同一IP注册
    eCheckIpRegTime($regip, $pr['regretime']);
    //保留用户
    toCheckCloseWord($username, $pr['regclosewords'], 'RegHaveCloseword');
    $username = RepPostStr($username);
    //重复用户
    $num = $empire->gettotal("select count(*) as total from " . eReturnMemberTable() . " where " . egetmf('username') . "='{$username}' limit 1");
    if ($num) {
        printerror('ReUsername', '', 1);
    }
    //重复邮箱
    if ($pr['regemailonly']) {
        $num = $empire->gettotal("select count(*) as total from " . eReturnMemberTable() . " where " . egetmf('email') . "='{$email}' limit 1");
        if ($num) {
            printerror('ReEmailFail', '', 1);
        }
    }
    //注册时间
    $lasttime = time();
    $registertime = eReturnAddMemberRegtime();
    $rnd = make_password(20);
    //产生随机密码
    $userkey = eReturnMemberUserKey();
    //密码
    $truepassword = $password;
    $salt = eReturnMemberSalt();
    $password = eDoMemberPw($password, $salt);
    //审核
    $checked = ReturnGroupChecked($groupid);
    if ($checked && $public_r['regacttype'] == 1) {
        $checked = 0;
    }
    //验证附加表必填项
    $mr['add_filepass'] = ReturnTranFilepass();
    $fid = GetMemberFormId($groupid);
    $member_r = ReturnDoMemberF($fid, $add, $mr, 0, $username);
    $sql = $empire->query("insert into " . eReturnMemberTable() . "(" . eReturnInsertMemberF('username,password,rnd,email,registertime,groupid,userfen,userdate,money,zgroupid,havemsg,checked,salt,userkey') . ") values('{$username}','{$password}','{$rnd}','{$email}','{$registertime}','{$groupid}','{$public_r['reggetfen']}','0','0','0','0','{$checked}','{$salt}','{$userkey}');");
    //取得userid
    $userid = $empire->lastid();
    //附加表
    $addr = $empire->fetch1("select * from {$dbtbpre}enewsmemberadd where userid='{$userid}'");
    if (!$addr[userid]) {
        $spacestyleid = ReturnGroupSpaceStyleid($groupid);
        $sql1 = $empire->query("insert into {$dbtbpre}enewsmemberadd(userid,spacestyleid,regip,lasttime,lastip,loginnum,regipport,lastipport" . $member_r[0] . ") values('{$userid}','{$spacestyleid}','{$regip}','{$lasttime}','{$regip}','1','{$regipport}','{$regipport}'" . $member_r[1] . ");");
    }
    //更新附件
    UpdateTheFileOther(6, $userid, $mr['add_filepass'], 'member');
    ecmsEmptyShowKey($keyvname);
    //清空验证码
    //绑定帐号
    if ($tobind) {
        MemberConnect_BindUser($userid);
    }
    if ($sql) {
        //邮箱激活
        if ($checked == 0 && $public_r['regacttype'] == 1) {
            include 'class/member_actfun.php';
            SendActUserEmail($userid, $username, $email);
        }
        //审核
        if ($checked == 0) {
            $location = DoingReturnUrl("../../", $_POST['ecmsfrom']);
            printerror("RegisterSuccessCheck", $location, 1);
        }
        $logincookie = 0;
        if ($ecms_config['member']['regcookietime']) {
            $logincookie = time() + $ecms_config['member']['regcookietime'];
        }
        $r = $empire->fetch1("select " . eReturnSelectMemberF('*') . " from " . eReturnMemberTable() . " where " . egetmf('userid') . "='{$userid}' limit 1");
        $set1 = esetcookie("mlusername", $username, $logincookie);
        $set2 = esetcookie("mluserid", $userid, $logincookie);
        $set3 = esetcookie("mlgroupid", $groupid, $logincookie);
        $set4 = esetcookie("mlrnd", $rnd, $logincookie);
        //验证符
        qGetLoginAuthstr($userid, $username, $rnd, $groupid, $logincookie);
        //登录附加cookie
        AddLoginCookie($r);
        $location = "../member/cp/";
        $returnurl = getcvar('returnurl');
        if ($returnurl && !strstr($returnurl, "e/member/iframe") && !strstr($returnurl, "e/member/register") && !strstr($returnurl, "enews=exit")) {
            $location = $returnurl;
        }
        $set5 = esetcookie("returnurl", "");
        //易通行系统
        DoEpassport('reg', $userid, $username, $truepassword, $salt, $email, $groupid, $registertime);
        $location = DoingReturnUrl($location, $_POST['ecmsfrom']);
        printerror("RegisterSuccess", $location, 1);
    } else {
        printerror("DbError", "history.go(-1)", 1);
    }
}
Beispiel #2
0
function ViewCheckLogin($infor)
{
    global $empire, $public_r, $ecms_config, $toreturnurl, $gotourl;
    $userid = (int) getcvar('mluserid');
    $rnd = RepPostVar(getcvar('mlrnd'));
    if (!$userid) {
        if (!getcvar('returnurl')) {
            esetcookie("returnurl", $toreturnurl, 0);
        }
        $msg = "您还未登陆,<a href='{$gotourl}'><u>点击这里</u></a>进行登陆操作;注册请<a href='" . $public_r['newsurl'] . "e/member/register/'><u>点击这里</u></a>。";
        ShowViewInfoMsg($infor, $msg);
    }
    $cr = $empire->fetch1("select " . eReturnSelectMemberF('checked,userid,username,groupid,userfen,userdate,zgroupid') . " from " . eReturnMemberTable() . " where " . egetmf('userid') . "='{$userid}' and " . egetmf('rnd') . "='{$rnd}' limit 1");
    if (!$cr['userid']) {
        EmptyEcmsCookie();
        if (!getcvar('returnurl')) {
            esetcookie("returnurl", $toreturnurl, 0);
        }
        $msg = "同一帐号只能一人在线,<a href='{$gotourl}'><u>点击这里</u></a>重新登陆;注册请<a href='" . $public_r['newsurl'] . "e/member/register/'><u>点击这里</u></a>。";
        ShowViewInfoMsg($infor, $msg);
    }
    if ($cr['checked'] == 0) {
        EmptyEcmsCookie();
        if (!getcvar('returnurl')) {
            esetcookie("returnurl", $toreturnurl, 0);
        }
        $msg = "您的帐号还未审核通过,<a href='{$gotourl}'><u>点击这里</u></a>重新登陆;注册请<a href='" . $public_r['newsurl'] . "e/member/register/'><u>点击这里</u></a>。";
        ShowViewInfoMsg($infor, $msg);
    }
    //默认会员组
    if (empty($cr['groupid'])) {
        $user_groupid = eReturnMemberDefGroupid();
        $usql = $empire->query("update " . eReturnMemberTable() . " set " . egetmf('groupid') . "='{$user_groupid}' where " . egetmf('userid') . "='" . $cr[userid] . "'");
        $cr['groupid'] = $user_groupid;
    }
    //是否过期
    if ($cr['userdate']) {
        if ($cr['userdate'] - time() <= 0) {
            OutTimeZGroup($cr['userid'], $cr['zgroupid']);
            $cr['userdate'] = 0;
            if ($cr['zgroupid']) {
                $cr['groupid'] = $cr['zgroupid'];
                $cr['zgroupid'] = 0;
            }
        }
    }
    $re[userid] = $cr['userid'];
    $re[username] = $cr['username'];
    $re[userfen] = $cr['userfen'];
    $re[groupid] = $cr['groupid'];
    $re[userdate] = $cr['userdate'];
    $re[zgroupid] = $cr['zgroupid'];
    return $re;
}
Beispiel #3
0
  <input name="tobind" type="hidden" id="tobind" value="<?php 
echo $tobind;
?>
">
    <tr class="header"> 
      <td height="25"><div align="center">选择注册会员类型<?php 
echo $tobind ? ' (绑定账号)' : '';
?>
</div></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td width="70%" height="25"><table width="100%" border="0" cellspacing="1" cellpadding="3">
		<?php 
while ($r = $empire->fetch($sql)) {
    $checked = '';
    if ($r[groupid] == eReturnMemberDefGroupid()) {
        $checked = ' checked';
    }
    ?>
          <tr>
            <td height="23">
			<input type="radio" name="groupid" value="<?php 
    echo $r[groupid];
    ?>
"<?php 
    echo $checked;
    ?>
>
              <?php 
    echo $r[groupname];
    ?>
Beispiel #4
0
function qlogin($add)
{
    global $empire, $dbtbpre, $public_r, $ecms_config;
    if ($ecms_config['member']['loginurl']) {
        Header("Location:" . $ecms_config['member']['loginurl']);
        exit;
    }
    $dopr = 1;
    if ($_POST['prtype']) {
        $dopr = 9;
    }
    $username = trim($add['username']);
    $password = trim($add['password']);
    if (!$username || !$password) {
        printerror("EmptyLogin", "history.go(-1)", $dopr);
    }
    $tobind = (int) $add['tobind'];
    //验证码
    $keyvname = 'checkloginkey';
    if ($public_r['loginkey_ok']) {
        ecmsCheckShowKey($keyvname, $add['key'], $dopr);
    }
    $username = RepPostVar($username);
    $password = RepPostVar($password);
    $num = 0;
    $r = $empire->fetch1("select " . eReturnSelectMemberF('*') . " from " . eReturnMemberTable() . " where " . egetmf('username') . "='{$username}' limit 1");
    if (!$r['userid']) {
        printerror("FailPassword", "history.go(-1)", $dopr);
    }
    if (!eDoCkMemberPw($password, $r['password'], $r['salt'])) {
        printerror("FailPassword", "history.go(-1)", $dopr);
    }
    if ($r['checked'] == 0) {
        if ($public_r['regacttype'] == 1) {
            printerror('NotCheckedUser', '../member/register/regsend.php', 1);
        } else {
            printerror('NotCheckedUser', '', 1);
        }
    }
    //绑定帐号
    if ($tobind) {
        MemberConnect_BindUser($r['userid']);
    }
    $rnd = make_password(20);
    //取得随机密码
    //默认会员组
    if (empty($r['groupid'])) {
        $r['groupid'] = eReturnMemberDefGroupid();
    }
    $r['groupid'] = (int) $r['groupid'];
    $lasttime = time();
    //IP
    $lastip = egetip();
    $lastipport = egetipport();
    $usql = $empire->query("update " . eReturnMemberTable() . " set " . egetmf('rnd') . "='{$rnd}'," . egetmf('groupid') . "='{$r['groupid']}' where " . egetmf('userid') . "='{$r['userid']}'");
    $empire->query("update {$dbtbpre}enewsmemberadd set lasttime='{$lasttime}',lastip='{$lastip}',loginnum=loginnum+1,lastipport='{$lastipport}' where userid='{$r['userid']}'");
    //设置cookie
    $lifetime = (int) $add['lifetime'];
    $logincookie = 0;
    if ($lifetime) {
        $logincookie = time() + $lifetime;
    }
    $set1 = esetcookie("mlusername", $username, $logincookie);
    $set2 = esetcookie("mluserid", $r['userid'], $logincookie);
    $set3 = esetcookie("mlgroupid", $r['groupid'], $logincookie);
    $set4 = esetcookie("mlrnd", $rnd, $logincookie);
    //验证符
    qGetLoginAuthstr($r['userid'], $username, $rnd, $r['groupid'], $logincookie);
    //登录附加cookie
    AddLoginCookie($r);
    $location = "../member/cp/";
    $returnurl = getcvar('returnurl');
    if ($returnurl) {
        $location = $returnurl;
    }
    if (strstr($_SERVER['HTTP_REFERER'], "e/member/iframe")) {
        $location = "../member/iframe/";
    }
    if (strstr($location, "enews=exit") || strstr($location, "e/member/register") || strstr($_SERVER['HTTP_REFERER'], "e/member/register")) {
        $location = "../member/cp/";
        $_POST['ecmsfrom'] = '';
    }
    ecmsEmptyShowKey($keyvname);
    //清空验证码
    $set6 = esetcookie("returnurl", "");
    if ($set1 && $set2) {
        //易通行系统
        DoEpassport('login', $r['userid'], $username, $password, $r['salt'], $r['email'], $r['groupid'], $r['registertime']);
        $location = DoingReturnUrl($location, $_POST['ecmsfrom']);
        printerror("LoginSuccess", $location, $dopr);
    } else {
        printerror("NotCookie", "history.go(-1)", $dopr);
    }
}
Beispiel #5
0
$tobind = (int) $_GET['tobind'];
//转向注册
if (!empty($ecms_config['member']['registerurl'])) {
    Header("Location:" . $ecms_config['member']['registerurl']);
    exit;
}
//已经登陆不能注册
if (getcvar('mluserid')) {
    printerror("LoginToRegister", "history.go(-1)", 1);
}
if (!empty($ecms_config['member']['changeregisterurl']) && !$_GET['groupid']) {
    $changeregisterurl = $ecms_config['member']['changeregisterurl'];
    if ($tobind) {
        $changeregisterurl .= '?tobind=1';
    }
    Header("Location:" . $changeregisterurl);
    exit;
}
$groupid = (int) $_GET['groupid'];
$groupid = $groupid ? $groupid : eReturnMemberDefGroupid();
CheckMemberGroupCanReg($groupid);
$formid = GetMemberFormId($groupid);
if (empty($formid)) {
    printerror('ErrorUrl', '', 1);
}
$ecmsfirstpost = 1;
$formfile = '../../data/html/memberform' . $formid . '.php';
//导入模板
require ECMS_PATH . DASHBOARD . '/template/member/register.php';
db_close();
$empire = null;
Beispiel #6
0
$loginrnd = $lur['rnd'];
$loginlevel = $lur['groupid'];
$loginadminstyleid = $lur['adminstyleid'];
//ehash
$ecms_hashur = hReturnEcmsHashStrAll();
//验证权限
CheckLevel($logininid, $loginin, $classid, "member");
$userdate = 0;
$enews = ehtmlspecialchars($_GET['enews']);
$changegroupid = (int) $_GET['changegroupid'];
$url = "<a href=ListMember.php" . $ecms_hashur['whehref'] . ">管理会员</a>&nbsp;>&nbsp;增加会员";
if ($enews == "EditMember") {
    $userid = (int) $_GET['userid'];
    //取得用户资料
    $r = ReturnUserInfo($userid);
    $r['groupid'] = $r['groupid'] ? $r['groupid'] : eReturnMemberDefGroupid();
    $addr = $empire->fetch1("select * from {$dbtbpre}enewsmemberadd where userid='{$userid}' limit 1");
    $url = "<a href=ListMember.php" . $ecms_hashur['whehref'] . ">管理会员</a>&nbsp;>&nbsp;修改会员资料:<b>" . $r[username] . "</b>";
    //时间
    if ($r[userdate]) {
        $userdate = $r[userdate] - time();
        if ($userdate <= 0) {
            OutTimeZGroup($userid, $r['zgroupid']);
            if ($r['zgroupid']) {
                $r['groupid'] = $r['zgroupid'];
                $r['zgroupid'] = 0;
            }
            $userdate = 0;
        } else {
            $userdate = round($userdate / (24 * 3600));
        }
Beispiel #7
0
	include("../../data/dbcache/MemberLevel.php");
	$link=db_connect();
	$empire=new mysqlquery();
	$mhavelogin=1;
	//数据
	$myusername=RepPostVar(getcvar('mlusername'));
	$myrnd=RepPostVar(getcvar('mlrnd'));
	$r=$empire->fetch1("select ".eReturnSelectMemberF('userid,username,groupid,userfen,money,userdate,havemsg,checked')." from ".eReturnMemberTable()." where ".egetmf('userid')."='$myuserid' and ".egetmf('rnd')."='$myrnd' limit 1");
	if(empty($r[userid])||$r[checked]==0)
	{
		EmptyEcmsCookie();
		$mhavelogin=0;
	}
	//会员等级
	if(empty($r[groupid]))
	{$groupid=eReturnMemberDefGroupid();}
	else
	{$groupid=$r[groupid];}
	$groupname=$level_r[$groupid]['groupname'];
	//点数
	$userfen=$r[userfen];
	//余额
	$money=$r[money];
	//天数
	$userdate=0;
	if($r[userdate])
	{
		$userdate=$r[userdate]-time();
		if($userdate<=0)
		{$userdate=0;}
		else
Beispiel #8
0
function DoEcmsMemberLogin($r, $lifetime = 0)
{
    global $empire, $dbtbpre, $ecms_config;
    $rnd = make_password(20);
    //取得随机密码
    //默认会员组
    if (empty($r['groupid'])) {
        $r['groupid'] = eReturnMemberDefGroupid();
    }
    $r['groupid'] = (int) $r['groupid'];
    $empire->query("update " . eReturnMemberTable() . " set " . egetmf('rnd') . "='{$rnd}'," . egetmf('groupid') . "='{$r['groupid']}' where " . egetmf('userid') . "='{$r['userid']}'");
    //设置cookie
    $lifetime = (int) $lifetime;
    $logincookie = 0;
    if ($lifetime) {
        $logincookie = time() + $lifetime;
    }
    esetcookie("mlusername", $r['username'], $logincookie);
    esetcookie("mluserid", $r['userid'], $logincookie);
    esetcookie("mlgroupid", $r['groupid'], $logincookie);
    esetcookie("mlrnd", $rnd, $logincookie);
    //验证符
    qGetLoginAuthstr($r['userid'], $r['username'], $rnd, $r['groupid'], $logincookie);
    //登录附加cookie
    AddLoginCookie($r);
}