Esempio n. 1
0
if (is_login()) {
    header('Location:' . $siteRoot . 'my.php');
    exit;
}
require_once "{$dbConfFile}";
// init $dbServs
if (isset($_POST['submitted'])) {
    // 处理用户提交的数据
    $dbo = new dbex($dbServs);
    $err_msg = array();
    $code = trim($_POST['vericode']);
    if ($code != $_SESSION['verifyCode']) {
        $err_msg[] = '验证码错误,请重新输入';
    }
    $e = trim($_POST['email']);
    if (check_email_fail($e)) {
        $err_msg[] = "请填写正确的邮箱地址";
    } else {
        if ($dbo->checkExist($e)) {
            $err_msg[] = "对不起,该邮箱已经被使用了";
        }
    }
    if (empty($err_msg)) {
        global $token_salt;
        // initial in config.php
        $token = generate_token($e, $token_salt);
        // func in check.php
        include_once $webRoot . 'mail/class-phpmailer.php';
        include_once $webRoot . 'mail/class-smtp.php';
        $mail = new PHPMailer();
        $mail->IsSmtp();
Esempio n. 2
0
 * 一些检测函数尚未完善
 */
include_once "../config.php";
include_once $webRoot . "foundation/check.func.php";
include_once $webRoot . "foundation/switch.php";
include_once $webRoot . "foundation/price.php";
if (isset($_SEEEION['uid']) && isset($_SEISSION['name'])) {
    // 已经登录,跳转
    header('Location:' . $siteRoot . 'my.php');
    exit;
}
// 尚未登录,进行登录
if (isset($_POST['submitted']) && isset($_POST['email']) && isset($_POST['pass'])) {
    $e = trim($_POST['email']);
    $p = trim($_POST['pass']);
    if (check_email_fail($e) || check_password_fail($p)) {
        // 邮箱或密码格式不对
        header('Location:' . $siteRoot . 'index.php?login_error=wrong_format');
        exit;
    }
    include_once $webRoot . "lib/dbo.class.php";
    include_once $dbConfFile;
    $dbo = new dbex($dbServs);
    $e = $dbo->real_escape_string($e);
    $ency_p = md5($p);
    $sql = "select user_id, nick_name, role, level, realtime_money from user where email = '{$e}' and pass = sha1('{$ency_p}') limit 1";
    $res = $dbo->query($sql);
    if (1 != $res->num_rows) {
        // 邮箱与密码不匹配
        header('Location:' . $siteRoot . 'index.php?login_error=mismatch');
        exit;