こんにちは、私はxamppでビルドしているのですが、それはうまく動作しないのでダッシュボードにログインしてセッションを作成し、その後ユーザーはログアウトできます。しかし、私はサイトを起動した後、ユーザーはそれを記録することはできませんが、サイトは応答していません。私は適切なスクリプトを置く場合、それは同じログインページにリダイレクトすると、ログイン画面では、私はスクリプトを変更しようとしたと私が得るすべては白いページです。私のホストはLinuxのcpanelを使用しています。あなたはサイトが正常に動作することを念頭に置いてデータベースに接続し、dbで利用可能なユーザーを引き出すこともできますが、問題はバックエンドにあります。誰もが手掛かりを持っている場合は、ここで私は..オンラインでCPANELを使用しているときにバックエンドへのログインが失敗する
<?php
/* Main page with two forms: sign up and log in */
require '../config/config.php';
session_start();
?>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
if (isset($_POST['login'])) { //user logging in
require '../sessions/login.php';
}
elseif (isset($_POST['register'])) { //user registering
require '../sessions/register.php';
}
}
?>
<?php
\t // Check if form submitted with method="post"
\t if ($_SERVER['REQUEST_METHOD'] == 'POST')
\t {
\t \t if (isset($_POST['reset'])) {
\t \t \t
\t \t $email = $mysqli->escape_string($_POST['email']);
\t \t $result = $mysqli->query("SELECT * FROM staff WHERE email='$email'");
\t \t if ($result->num_rows == 0) // User doesn't exist
\t \t {
\t \t \t header("location: index.php?msg=".urlencode("User with this email does not exist!"));
\t \t }
\t \t else { // User exists (num_rows != 0)
\t \t \t $user = $result->fetch_assoc(); // $user becomes array with user data
\t \t \t
\t \t \t $email = $user['email'];
\t \t \t $hash = $user['hash'];
\t \t \t $first_name = $user['first_name'];
\t \t \t // Send registration confirmation link (reset.php)
\t \t \t $to = $email;
\t \t \t $subject = 'Password Reset Link (site)';
\t \t \t $message_body = '
\t \t \t Hello '.$first_name.',
\t \t \t You have requested password reset!
\t \t \t Please click this link to reset your password:
\t \t \t http://sitename/reset.php?email='.$email.'&hash='.$hash;
\t \t \t mail($to, $subject, $message_body);
\t \t \t header("location: reset.php?msg=".urlencode("<p>Please check your email <span>$email</span>"
\t \t \t . " for a confirmation link to complete your password reset!</p>"));
\t }
\t }
\t }
?>
を使用していたコードは、これはログインスクリプト
// Escape email to protect against SQL injections
$email = $mysqli->escape_string($_POST['email']);
$result = $mysqli->query("SELECT * FROM staff WHERE email='$email'");
if ($result->num_rows == 0){ // User doesn't exist
header("location: index.php?msg=".urlencode("User with that email doesn't exist!"));
}
else { // User exists
$user = $result->fetch_assoc();
if (password_verify($_POST['password'], $user['password'])) {
$_SESSION['email'] = $user['email'];
$_SESSION['f_name'] = $user['f_name'];
$_SESSION['l_name'] = $user['l_name'];
\t \t $_SESSION['image'] = $user['image'];
\t \t $_SESSION['id'] = $user['id'];
$_SESSION['active'] = $user['active'];
// This is how we'll know the user is logged in
$_SESSION['logged_in'] = true;
header("location: home.php");
}
else {
\t \t
header("location: ../index.php?msg=".urlencode('You have entered wrong password, try again!'));
}
}
?>
ですか?
タイトルからCAPSを削除できますか?あなたが私たちに叫んでいると考えられます。 –