Refactor code: remove unnecessary comments and clean up whitespace in various files

This commit is contained in:
vista-man
2025-04-10 22:53:25 +02:00
parent e46044682e
commit 4e0f6238b6
8 changed files with 62 additions and 98 deletions

View File

@@ -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();
}