0

誰が何がうまくいかないのか知っていますか?私はすべてを試し、すべてを検索しましたが、何も見つかりませんでした。見えないだけの誤字かもしれません。

関数クラス

function validate_credentials($user_name, $user_password) {
    $user_name      = mysql_real_escape_string($user_name);
    $user_password  = sha1($user_password);

    $result = mysql_query("SELECT `user_id` FROM `users` WHERE `user_name` = '{$user_name}' AND `user_password` = '{$user_password}'");

    if (mysql_num_rows($result) !== 1) {
        return false;
    }

    return mysql_result($result, 0);
}

クラス

include('./core/user.inc.php');

if (isset($_POST['user_name'], $_POST['user_password'])) {
    if (($user_id = validate_credentials($_POST['user_name'], $_POST['user_password'])) != false) {
        $_SESSION['user_id'] = $user_id;

        header('Location: ./messages/');

        die();
    }
}

これは私のHTMLです:

<form method="post" action="./sign-in.php">
    <input type="text" name="user_name" id="user_name" placeholder="Username" />
    <input type="password" name="user_password" id="user_password" placeholder="Password" />
    <input type="submit" placeholder="Confirm Password" value="Sign in" />
</form>
4

2 に答える 2