-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
113 lines (103 loc) · 3.84 KB
/
index.php
File metadata and controls
113 lines (103 loc) · 3.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
// index.php
session_start();
// Check if user is logged in
if (!isset($_SESSION['user_id'])) {
header('Location: login.php');
exit();
}
include('db.php');
$db = getDbConnection();
$user_id = $_SESSION['user_id'];
// Get tickets with proper joins - without debug output
$query = "
SELECT
t.*,
c.name as computer_name
FROM tickets t
LEFT JOIN computers c ON t.computer_id = c.id
WHERE t.user_id = " . $user_id . "
ORDER BY t.created_at DESC";
$result = $db->query($query);
$tickets = array();
// Fetch all tickets into an array
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
$tickets[] = $row;
}
// Remove all debug output and error logging
$totalTickets = count($tickets);
// Start the HTML output without any debug information
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Support Dashboard</title>
<link rel="icon" href="https://bedfordcollegegroup.ac.uk/hideout-app/themes/the-hideout-theme-group/img/themes/bedford-college/favicon.png">
<link rel="stylesheet" href="style.css">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
</head>
<body>
<!-- Simplified Header -->
<nav class="admin-header">
<h1>Support Dashboard</h1>
<div class="header-actions">
<?php if ($_SESSION['is_admin']): ?>
<a href="admin.php" class="btn btn-secondary">
<i class="fas fa-cog"></i>
Admin Panel
</a>
<?php endif; ?>
<a href="create_ticket.php" class="btn btn-secondary">
<i class="fas fa-plus"></i>
New Ticket
</a>
<a href="logout.php" class="btn btn-secondary">
<i class="fas fa-sign-out-alt"></i>
Logout
</a>
</div>
</nav>
<div class="app-container">
<main class="main-content">
<div class="page-header">
<div class="header-title">
<h2>Your Tickets</h2>
<span class="ticket-count"><?php echo $totalTickets; ?> total</span>
</div>
</div>
<div class="ticket-container">
<?php if ($totalTickets > 0): ?>
<table>
<tr>
<th>Title</th>
<th>Description</th>
<th>Status</th>
<th></th>
</tr>
<?php foreach ($tickets as $ticket): ?>
<tr>
<td><?php echo htmlspecialchars($ticket['title']); ?></td>
<td><?php echo htmlspecialchars($ticket['description']); ?></td>
<td><?php echo htmlspecialchars($ticket['status']); ?></td>
<td><a href="view_ticket.php?id=<?php echo $ticket['id']; ?>">View Ticket</a></td>
</tr>
<?php endforeach; ?>
</table>
<?php else: ?>
<div class="empty-state">
<i class="fas fa-ticket-alt"></i>
<h3>No Tickets Found</h3>
<p>You haven't created any support tickets yet.</p>
<a href="create_ticket.php" class="nav-button primary">
Create Your First Ticket
</a>
</div>
<?php endif; ?>
</div>
</main>
</div>
</body>
</html>