Example #1
0
    } else {
        echo '用户注册失败,3秒钟后跳转到注册页面';
        echo '<meta http-equiv="refresh" content="3;url=index.php#toregister"/>';
    }
} elseif ($act === 'login') {
    //完成登陆的功能
    $row = $PdoMySQL->find($table, "username='******' AND password='******'", 'status');
    if ($row['status'] == 0) {
        echo '请先激活在登陆';
        echo '<meta http-equiv="refresh" content="3;url=index.php#tologin"/>';
    } else {
        echo '登陆成功,3秒钟后跳转到首页';
        echo '<meta http-equiv="refresh" content="3;url=http://www.imooc.com"/>';
    }
} elseif ($act === 'active') {
    $token = addslashes($_GET['token']);
    $row = $PdoMySQL->find($table, "token='{$token}' AND status=0", array('id', 'token_exptime'));
    $now = time();
    if ($now > $row['token_exptime']) {
        echo '激活时间过期,请重新登陆激活';
    } else {
        $res = $PdoMySQL->update(array('status' => 1), $table, 'id=' . $row['id']);
        if ($res) {
            echo '激活成功,3秒钟后跳转到登陆页面';
            echo '<meta http-equiv="refresh" content="3;url=index.php#tologin"/>';
        } else {
            echo '激活失败,请重新激活';
            echo '<meta http-equiv="refresh" content="3;url=index.php"/>';
        }
    }
}