connect_error) { die("Connection failed: " . $conn->connect_error); } // Retrieve user credentials from POST request $username = $_POST['username']; $password = $_POST['password']; // Check if the user exists in the database $sql = "SELECT * FROM users WHERE username='$username' AND password='$password'"; $result = $conn->query($sql); if ($result->num_rows > 0) { echo "Login successful!"; // Redirect to the video page header("Location: videos.php"); } else { echo "Invalid username or password."; } $conn->close(); ?>