Refactor HTML and CSS file structure: update stylesheet paths, add new scripts, and enhance login functionality

This commit is contained in:
vista-man
2025-04-10 17:00:57 +02:00
parent 7c2d11591f
commit 15ce96681f
15 changed files with 66 additions and 43 deletions

7
php/logout.php Normal file
View File

@@ -0,0 +1,7 @@
<!-- filepath: c:\xampp\htdocs\Spik-en-span\logout.php -->
<?php
session_start();
session_destroy();
header("Location: employee-login.html");
exit();
?>

40
php/process_login.php Normal file
View File

@@ -0,0 +1,40 @@
<!-- filepath: c:\xampp\htdocs\Spik-en-span\process_login.php -->
<?php
// Database connection
$servername = "localhost";
$username = "root";
$password = "";
$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 = $_POST['username'];
$password = $_POST['password'];
// Validate credentials
$sql = "SELECT id, password_hash FROM employees WHERE username = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("s", $username);
$stmt->execute();
$stmt->bind_result($user_id, $password_hash);
$stmt->fetch();
if ($password_hash && password_verify($password, $password_hash)) {
// Start session and store user ID
session_start();
$_SESSION['user_id'] = $user_id;
echo "Login successful!";
header("Location: ../qr/qr.html"); // Redirect to QR scanner page
} else {
echo "Invalid login credentials.";
}
$stmt->close();
$conn->close();
?>

36
php/process_ticket.php Normal file
View File

@@ -0,0 +1,36 @@
<!-- filepath: c:\xampp\htdocs\Spik-en-span\process_ticket.php -->
<?php
// Database connection
$servername = "localhost";
$username = "root";
$password = "";
$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
$name = $_POST['name'];
$email = $_POST['email'];
$category = $_POST['category'];
$quantity = $_POST['quantity'];
$ticket_id = "TICKET-" . time();
// Insert ticket into database
$sql = "INSERT INTO tickets (ticket_id, name, email, category, quantity) VALUES (?, ?, ?, ?, ?)";
$stmt = $conn->prepare($sql);
$stmt->bind_param("ssssi", $ticket_id, $name, $email, $category, $quantity);
if ($stmt->execute()) {
echo "Ticket successfully purchased! Your Ticket ID is: " . $ticket_id;
} else {
echo "Error: " . $stmt->error;
}
$stmt->close();
$conn->close();
?>