Skip to content
Snippets Groups Projects
Commit 25296b24 authored by ZHANG David's avatar ZHANG David
Browse files

Upload New File

parent a3fdf02e
No related branches found
No related tags found
No related merge requests found
<?php
include 'config.php';
session_start();
if (!isset($_SESSION['user']) || $_SESSION['user']['role'] !== 'tutor') {
header('Location: login.php');
exit;
}
$user = $_SESSION['user'];
// Récupérer les informations des sessions et des étudiants
$students = [];
$stmt = $conn->prepare("
SELECT s.subject AS session_subject, s.created_at AS session_date,
u.first_name, u.last_name, u.email
FROM SessionStudent ss
JOIN Session s ON ss.session_id = s.id
JOIN User u ON ss.student_id = u.id
WHERE s.tutor_id = ?
");
$stmt->bind_param("i", $user['id']);
$stmt->execute();
$result = $stmt->get_result();
while ($row = $result->fetch_assoc()) {
$students[] = $row;
}
$stmt->close();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Students in Your Sessions</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<?php include 'sidebar.php'; ?>
<div class="main-content">
<div class="students-sessions-page">
<h1>Students in Your Sessions</h1>
<?php if (!empty($students)): ?>
<table border="1" cellpadding="10" cellspacing="0">
<thead>
<tr>
<th>Subject</th>
<th>Session Date</th>
<th>Student Name</th>
<th>Student Email</th>
</tr>
</thead>
<tbody>
<?php foreach ($students as $student): ?>
<tr>
<td><?= htmlspecialchars($student['session_subject']) ?></td>
<td><?= htmlspecialchars($student['session_date']) ?></td>
<td><?= htmlspecialchars($student['first_name']) . ' ' . htmlspecialchars($student['last_name']) ?></td>
<td><a href="mailto:<?= htmlspecialchars($student['email']) ?>"><?= htmlspecialchars($student['email']) ?></a></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<p>No students are enrolled in your sessions yet.</p>
<?php endif; ?>
<br>
</div>
</div>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment