This commit is contained in:
Flatlogic Bot 2025-10-22 12:05:20 +00:00
parent 59d1fd0157
commit a30c5e71e8
9 changed files with 11 additions and 11 deletions

View File

@ -1,5 +1,5 @@
<?php
session_start();
require_once '../db/config.php';
// Admin role check

View File

@ -1,5 +1,5 @@
<?php
session_start();
include_once '../includes/header.php';
include_once '../db/config.php';

View File

@ -1,5 +1,5 @@
<?php
session_start();
include_once '../db/config.php';
// Ensure the user is an admin

View File

@ -1,5 +1,5 @@
<?php
session_start();
include_once '../includes/header.php';
include_once '../db/config.php';

View File

@ -1,5 +1,5 @@
<?php
session_start();
include_once '../db/config.php';
// Ensure the user is an admin

View File

@ -1,5 +1,4 @@
<?php
session_start();
require_once __DIR__ . '/../db/config.php';

View File

@ -1,5 +1,5 @@
<?php
session_start();
session_unset();
session_destroy();
header("Location: /auth/login.php");

View File

@ -1,4 +1,4 @@
<?php session_start(); ?>
<?php if (session_status() === PHP_SESSION_NONE) { session_start(); } ?>
<!DOCTYPE html>
<html lang="en">
<head>

View File

@ -8,7 +8,7 @@ if (!isset($_SESSION['id']) || $_SESSION['role'] !== 'Student') {
}
$pdo = db();
$stmt = $pdo->prepare("SELECT r.room_number, r.details FROM Allocations a JOIN Rooms r ON a.room_id = r.id WHERE a.student_id = ?");
$stmt = $pdo->prepare("SELECT r.room_no, r.type, r.block FROM Allocations a JOIN Rooms r ON a.room_id = r.id WHERE a.student_id = ?");
$stmt->execute([$_SESSION['id']]);
$allocation = $stmt->fetch();
?>
@ -23,8 +23,9 @@ $allocation = $stmt->fetch();
</div>
<div class="card-body">
<?php if ($allocation): ?>
<h5 class="card-title">You are allocated to Room: <?php echo htmlspecialchars($allocation['room_number']); ?></h5>
<p class="card-text"><strong>Details:</strong> <?php echo htmlspecialchars($allocation['details']); ?></p>
<h5 class="card-title">You are allocated to Room: <?php echo htmlspecialchars($allocation['room_no']); ?></h5>
<p class="card-text"><strong>Type:</strong> <?php echo htmlspecialchars($allocation['type']); ?></p>
<p class="card-text"><strong>Block:</strong> <?php echo htmlspecialchars($allocation['block']); ?></p>
<?php else: ?>
<p class="card-text">You have not been allocated a room yet.</p>
<?php endif; ?>