$loginPwd = stripslashes(trim($_POST['login-pwd'])); if (strlen($loginUser) < 2 || strlen($loginUser) > 45 || strlen($loginPwd) < 6 || strlen($loginPwd) > 18) { echo "0 用户名或者密码不符合要求"; } else { $DB->connect($mysql_host, $mysql_user, $mysql_pass, $mysql_dbname); if (!emailcheck($loginUser)) { $LoginType = "lower(`name`)"; } else { $LoginType = "`email`"; } $userArr = $TB->getMemberInfo($LoginType, strtolower($loginUser)); if (!empty($userArr['uid'])) { if ($userArr['password'] == md5($loginPwd)) { $loginTime = time(); $loginIp = getClientIP(); loginCookie($userArr['uid'], $userArr['name'], $userArr['groupid'], $loginIp, $loginTime); $loginInfo['securekey'] = createSecureKey(10); $loginInfo['lastdate'] = $loginTime; $loginInfo['lastip'] = $loginIp; if ($userArr['lastdate'] != date("Y.m.d")) { $loginInfo['integral'] = array("`integral`+1"); } $DB->query($DB->update_sql("`" . $table_member . "`", $loginInfo, "`uid`=" . $userArr['uid'])); echo "1 登录成功"; } else { echo "0 您输入的密码不正确"; } } else { echo "0 通行证账号不存在"; } $DB->close();
if ($DB->fetch_one("SELECT COUNT(`uid`) FROM `" . $table_member . "` WHERE lower(`name`)='" . strtolower($uname) . "'") != 0) { echo "1 用户昵称已被占用"; } else { if ($DB->fetch_one("SELECT COUNT(`uid`) FROM `" . $table_member . "` WHERE `email` = '" . $email . "'") != 0) { echo "1 电子邮箱地址已被注册"; } else { $passport_info['name'] = $uname; $passport_info['email'] = $email; $passport_info['password'] = md5($passwd); $passport_info['securekey'] = createSecureKey(8); $passport_info['regdate'] = $actionTime; $passport_info['regip'] = $actionIp; $passport_info['lastdate'] = $actionTime; $passport_info['lastip'] = $actionIp; $passport_info['groupid'] = 1; if ($DB->query($DB->insert_sql("`" . $table_member . "`", $passport_info))) { $user_id = $DB->insert_id(); loginCookie($user_id, stripslashes($uname), 1, $actionIp, $actionTime); echo "0 恭喜您,注册成功!"; } else { echo "1 数据库繁忙,请重新提交!"; } } } } $DB->close(); } else { $tmp = template("register.html"); $tmp->output(); } ob_end_flush();
function handreg($nickname, $email, $password) { require_once "../global.php"; error_reporting(~E_ALL); $email = strtolower(stripslashes(trim($email))); $nickname = filterCode($nickname, true); $password = stripslashes($password); if (!emailCheck($email)) { $remsg["msg"] = "邮件地址不正确1" . $email; $remsg["jg"] = "2"; return $remsg; } $nicknameError = checkNickname($nickname); if ($nicknameError != "") { $remsg["msg"] = $nicknameError; $remsg["jg"] = "2"; return $remsg; } if (substr_count($password, " ") > 0) { $remsg["msg"] = "密码不能使用空格2"; $remsg["jg"] = "2"; return $remsg; } if (strlen($password) < 6 || strlen($password) > 26) { $remsg["msg"] = "密码长度不合法3"; $remsg["jg"] = "2"; return $remsg; } $DB = database(); if (PHPSay::getMemberCount($DB, "email", $email) != 0) { $remsg["msg"] = "邮件地址已被占用,请进行帐号绑定4"; $remsg["jg"] = "3"; return $remsg; } else { if (PHPSay::getMemberCount($DB, "nickname", $nickname) != 0) { $remsg["msg"] = "昵称已被占用,请进行帐号绑定5"; $remsg["jg"] = "3"; return $remsg; } else { $userID = PHPSay::memberJoin($DB, $nickname, $email, md5($password), ""); if ($userID > 0) { newAvatar($userID, ""); loginCookie($PHPSayConfig['ppsecure'], $userID, $nickname, 1); $remsg["msg"] = "注册成功"; $remsg["jg"] = "1"; return $remsg; } else { $remsg["msg"] = "注册失败6"; $remsg["jg"] = "2"; return $remsg; } } } $DB->close(); }