Changes to some things

This commit is contained in:
Richard Mikloš 2024-01-23 11:03:46 +01:00
parent f6a485f697
commit b0ccd2653a
6 changed files with 42 additions and 39 deletions

@ -1,34 +0,0 @@
<?php
session_start();
require_once 'config.php';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Handle login form submission
$email = $_POST['email'];
$password = $_POST['password'];
// Validate login credentials and fetch user details
$query = "SELECT id, username, password, email, isAdmin FROM users WHERE email = ?";
$stmt = $mysqli->prepare($query);
$stmt->bind_param("s", $email);
$stmt->execute();
$stmt->bind_result($user_id, $user_username, $user_password, $user_email, $user_isAdmin);
// Fetch the result
if ($stmt->fetch() && password_verify($password, $user_password)) {
$_SESSION['user_id'] = $user_id;
$_SESSION['user_username'] = $user_username;
$_SESSION['user_email'] = $user_email;
$_SESSION['user_isAdmin'] = $user_isAdmin;
// Redirect to the main domain after successful login
header('Location: http://watch.twip-network.org');
exit();
} else {
echo "Invalid email or password.";
}
// Close the statement
$stmt->close();
}
?>

@ -1,3 +1,35 @@
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Handle login form submission
$email = $_POST['email'];
$password = $_POST['password'];
// Validate login credentials and fetch user details
$query = "SELECT id, username, password, email, isAdmin FROM users WHERE email = ?";
$stmt = $mysqli->prepare($query);
$stmt->bind_param("s", $email);
$stmt->execute();
$stmt->bind_result($user_id, $user_username, $user_password, $user_email, $user_isAdmin);
// Fetch the result
if ($stmt->fetch() && password_verify($password, $user_password)) {
$_SESSION['user_id'] = $user_id;
$_SESSION['user_username'] = $user_username;
$_SESSION['user_email'] = $user_email;
$_SESSION['user_isAdmin'] = $user_isAdmin;
// Redirect to the main domain after successful login
header('Location: http://watch.twip-network.org');
exit();
} else {
echo "Invalid email or password.";
}
// Close the statement
$stmt->close();
}
?>
<h2>Login</h2>
<form action="login.php" method="post">
<input type="email" name="email" id="email-field" placeholder="E-Mail" required>

@ -21,3 +21,7 @@ a {
margin-top: 10px;
text-align: center;
}
.pfp {
border-radius: 50px;
}

@ -1,3 +1,4 @@
<!--PAGENAME=You stupid-->
<h2>How can a human being be this dumb?</h2>
<h1>404</h1>
<!--PAGENAME=404-->
<h2>Sorry,</h2>
<h1>404</h1>
<h2>We couldn't find the website you are looking for</h2>

@ -2,9 +2,9 @@
<ul>
<li><a href=""><i class="ri-settings-4-fill"></i></a></li>
<div class="links">
<li><a href="">Home</a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
<li><a href="" class="pfp"><template name="gravatar image"></template></a></li>
</div>
</ul>
</nav>