mirror of
https://github.com/Alvin-Zilverstand/Spik-en-span.git
synced 2026-03-06 11:17:09 +01:00
Refactor code: remove unnecessary comments and clean up whitespace in various files
This commit is contained in:
@@ -1,23 +1,18 @@
|
||||
<!-- filepath: c:\xampp\htdocs\Spik-en-span\process_login.php -->
|
||||
<?php
|
||||
// Database connection
|
||||
$servername = "localhost";
|
||||
$username = "database12"; // Updated username
|
||||
$password = "181t$1lJg"; // Updated password
|
||||
$username = "database12";
|
||||
$password = "181t$1lJg";
|
||||
$dbname = "spik_en_span";
|
||||
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
// Retrieve form data
|
||||
$username = isset($_POST['username']) ? trim(htmlspecialchars($_POST['username'])) : '';
|
||||
$password = isset($_POST['password']) ? trim(htmlspecialchars($_POST['password'])) : '';
|
||||
|
||||
// Validate credentials
|
||||
$sql = "SELECT id, password_hash FROM employees WHERE username = ?";
|
||||
$stmt = $conn->prepare($sql);
|
||||
if ($stmt) {
|
||||
@@ -32,13 +27,11 @@ if ($stmt) {
|
||||
|
||||
try {
|
||||
if ($password_hash && password_verify($password, $password_hash)) {
|
||||
// Start session and store user ID
|
||||
session_start();
|
||||
$_SESSION['user_id'] = $user_id;
|
||||
header("Location: "); // Redirect to the QR scanner page
|
||||
header("Location: ");
|
||||
exit();
|
||||
} else {
|
||||
// Redirect back to login page with an error message
|
||||
header("Location: ../employee-login.php?error=invalid_credentials");
|
||||
exit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user