Beispiel #1
0
<?php

require dirname(__FILE__) . "/global.php";
if (isset($_GET['do'], $_POST['username'], $_POST['userpwd'], $_POST['repwd'], $_POST['useremail']) && $_GET['do'] == "reg") {
    $uname = strAddslashes(trim($_POST['username']));
    $checkname = usernameCheck($uname);
    if (!empty($checkname)) {
        die("1 " . $checkname);
    }
    $passwd = stripslashes(trim($_POST['userpwd']));
    $repasswd = stripslashes(trim($_POST['repwd']));
    if (strlen($passwd) < 6 || strlen($passwd) > 18) {
        die("1 密码长度应控制在6至18个字符之间。");
    }
    if ($passwd != $repasswd) {
        die("1 两次输入的密码不一致。");
    }
    $email = strtolower(trim($_POST['useremail']));
    if (strlen($email) > 45 || !emailcheck($email)) {
        die("1 电子邮件地址不合法。");
    }
    $actionTime = time();
    $actionIp = getClientIP();
    $DB->connect($mysql_host, $mysql_user, $mysql_pass, $mysql_dbname);
    if ($DB->fetch_one("SELECT COUNT(`bid`) FROM `" . $table_black . "` WHERE `uname`='" . $actionIp . "'") != 0) {
        echo "1 很抱歉,系统拒绝了您的注册!请与管理员联系。";
    } else {
        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) {
Beispiel #2
0
<?php

require dirname(__FILE__) . "/global.php";
if (isset($_POST['nickname'])) {
    $nickname = strAddslashes(trim($_POST['nickname']));
    if (!empty($nickname)) {
        $checkname = usernameCheck($nickname);
        if (!empty($checkname)) {
            echo "1 " . $checkname;
        } else {
            $DB->connect($mysql_host, $mysql_user, $mysql_pass, $mysql_dbname);
            $N = $DB->fetch_one("SELECT COUNT(`uid`) FROM `" . $table_member . "` WHERE lower(`name`)='" . strtolower($nickname) . "'");
            $DB->close();
            if ($N > 0) {
                echo "1 昵称“" . $nickname . "”已被注册,换一个吧 ^_^";
            } else {
                setcookie("TouristName", Xxtea::encrypt($nickname, $cookie_key_login), time() + 63072000, $cookie_path, $cookie_domain);
                echo "0 成功";
            }
        }
    } else {
        setcookie("TouristName", '', time() - 3600, $cookie_path, $cookie_domain);
        echo "1";
    }
} else {
    $tmp = template("anonymity.html");
    $tmp->assign('loginArr', $loginArr);
    $tmp->output();
}
ob_end_flush();