asdf
This commit is contained in:
parent
f44412079f
commit
c0ad034e58
@ -7,7 +7,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
$email = $_POST['email'];
|
$email = $_POST['email'];
|
||||||
$password = $_POST['password'];
|
$password = $_POST['password'];
|
||||||
|
|
||||||
// Prepare and execute the SQL query using prepared statements
|
// Validate login credentials and fetch user details
|
||||||
$query = "SELECT id, username, password, isAdmin FROM users WHERE email = ?";
|
$query = "SELECT id, username, password, isAdmin FROM users WHERE email = ?";
|
||||||
$stmt = $mysqli->prepare($query);
|
$stmt = $mysqli->prepare($query);
|
||||||
$stmt->bind_param("s", $email);
|
$stmt->bind_param("s", $email);
|
||||||
@ -17,7 +17,9 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
// Fetch the result
|
// Fetch the result
|
||||||
if ($stmt->fetch() && password_verify($password, $user_password)) {
|
if ($stmt->fetch() && password_verify($password, $user_password)) {
|
||||||
$_SESSION['user_id'] = $user_id;
|
$_SESSION['user_id'] = $user_id;
|
||||||
header('Location: index.php');
|
|
||||||
|
// Redirect to the main domain after successful login
|
||||||
|
header('Location: http://watch.twip-network.org');
|
||||||
exit();
|
exit();
|
||||||
} else {
|
} else {
|
||||||
echo "Invalid email or password.";
|
echo "Invalid email or password.";
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h2>Login</h2>
|
<h2>Login</h2>
|
||||||
<form action="../index.php" method="post">
|
<form action="../login.php" method="post">
|
||||||
<input type="email" name="email" id="email-field" placeholder="E-Mail" required>
|
<input type="email" name="email" id="email-field" placeholder="E-Mail" required>
|
||||||
<input type="password" name="password" id="password-field" pattern=".{3,32}" placeholder="Password" required>
|
<input type="password" name="password" id="password-field" pattern=".{3,32}" placeholder="Password" required>
|
||||||
<input type="submit" value="Login">
|
<input type="submit" value="Login">
|
||||||
|
Loading…
Reference in New Issue
Block a user