示例#1
0
        } else {
            ?>
<fieldset><legend>忘記密碼</legend>
<label>查無此帳號!!</label></fieldset>
<?php 
        }
        break;
    case 2:
        $A = new db();
        $account = get("account");
        $answer = get("answer");
        $A->query("select * from accounts where account = '{$account}' and answer='{$answer}'");
        if ($A->count() > 0) {
            $A->fetch();
            setsession("account", get("account"));
            setsession("id", $A->element("id"));
            ?>
<form action="/44/member/" method="post">
<fieldset><legend>忘記密碼</legend>
<label>已成功回答問題,已將您登入。</label><br>
<input type="submit" value="確定">
</fieldset>
</form>
<?php 
        } else {
            ?>
<fieldset><legend>忘記密碼</legend>
<label>答案錯誤!!</label></fieldset>
<?php 
            redirect("/login/forget.php");
        }
示例#2
0
<?php

include $_SERVER["DOCUMENT_ROOT"] . "/44/func/mysql.php";
if (post("your_answer") != post("correct_answer")) {
    echo "驗證碼錯誤!";
    session_destroy();
    redirect("/login");
    die;
}
if (post("account") == "admin" && post("password") == "1234") {
    setsession("account", "admin");
    setsession("id", "-1");
    redirect("/admin");
    echo "請稍後...";
} else {
    $A = new db();
    $A->query("select * from accounts where account = '" . post("account") . "' and password = '******'") ?: $A->error();
    if ($A->fetch()) {
        setsession("account", post("account"));
        setsession("id", $A->element("id"));
        setsession("name", $A->element("name"));
        echo "請稍後...";
        redirect("/member");
    } else {
        echo "帳號密碼錯誤!";
        redirect("/login");
    }
}