Changes to some things
This commit is contained in:
		
							
								
								
									
										34
									
								
								login.php
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								login.php
									
									
									
									
									
								
							@@ -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>
 | 
					<h2>Login</h2>
 | 
				
			||||||
<form action="login.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>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,3 +21,7 @@ a {
 | 
				
			|||||||
    margin-top: 10px;
 | 
					    margin-top: 10px;
 | 
				
			||||||
    text-align: center;
 | 
					    text-align: center;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.pfp {
 | 
				
			||||||
 | 
					    border-radius: 50px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,3 +1,4 @@
 | 
				
			|||||||
<!--PAGENAME=You stupid-->
 | 
					<!--PAGENAME=404-->
 | 
				
			||||||
<h2>How can a human being be this dumb?</h2>
 | 
					<h2>Sorry,</h2>
 | 
				
			||||||
<h1>404</h1>
 | 
					<h1>404</h1>
 | 
				
			||||||
 | 
					<h2>We couldn't find the website you are looking for</h2>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,9 +2,9 @@
 | 
				
			|||||||
    <ul>
 | 
					    <ul>
 | 
				
			||||||
        <li><a href=""><i class="ri-settings-4-fill"></i></a></li>
 | 
					        <li><a href=""><i class="ri-settings-4-fill"></i></a></li>
 | 
				
			||||||
        <div class="links">
 | 
					        <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>
 | 
				
			||||||
            <li><a href=""></a></li>
 | 
					 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    </ul>
 | 
					    </ul>
 | 
				
			||||||
</nav>
 | 
					</nav>
 | 
				
			||||||
		Reference in New Issue
	
	Block a user