File: /home/nyiet8349bzl/www/oldwebsite.sbsc.in/faculty/cv/index.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
include "../config/database.php";
$dept = $_GET['dept'] ?? '';
$name = $_GET['name'] ?? '';
if (!$dept || !$name) {
die("Invalid CV URL");
}
/* ======================
FETCH TEACHER (SAFE)
====================== */
$stmt = $conn->prepare("
SELECT id, name, designation, department, phone, photo
FROM teachers
WHERE dept_slug = ? AND slug = ?
");
$stmt->bind_param("ss", $dept, $name);
$stmt->execute();
$stmt->bind_result(
$teacher_id,
$t_name,
$designation,
$department,
$phone,
$photo
);
$stmt->fetch();
$stmt->close();
if (!$teacher_id) {
die("Faculty record not found");
}
/* ======================
FETCH EDUCATION
====================== */
$edu = [];
$stmt = $conn->prepare("
SELECT degree, institution, year
FROM teacher_education
WHERE teacher_id = ?
");
$stmt->bind_param("i", $teacher_id);
$stmt->execute();
$stmt->bind_result($degree, $institution, $year);
while ($stmt->fetch()) {
$edu[] = "$degree – $institution ($year)";
}
$stmt->close();
/* ======================
FETCH FELLOWSHIP
====================== */
$fell = [];
$stmt = $conn->prepare("
SELECT title, level
FROM teacher_fellowship
WHERE teacher_id = ?
");
$stmt->bind_param("i", $teacher_id);
$stmt->execute();
$stmt->bind_result($title, $level);
while ($stmt->fetch()) {
$fell[] = "$title – $level";
}
$stmt->close();
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="../assets/css/style.css" rel="stylesheet">
</head>
<body>
<div class="cv-card container mt-4">
<table class="table table-bordered">
<tr>
<th>Name</th>
<td><?=htmlspecialchars($t_name)?></td>
<td rowspan="4" class="text-center">
<?php if($photo){ ?>
<img src="../<?=htmlspecialchars($photo)?>" width="120">
<?php } ?>
</td>
</tr>
<tr><th>Designation</th><td><?=htmlspecialchars($designation)?></td></tr>
<tr><th>Department</th><td><?=htmlspecialchars($department)?></td></tr>
<tr><th>Phone</th><td><?=htmlspecialchars($phone)?></td></tr>
</table>
<h5>Education</h5>
<ul>
<?php foreach($edu as $e){ echo "<li>".htmlspecialchars($e)."</li>"; } ?>
</ul>
<h5>Fellowship</h5>
<ul>
<?php foreach($fell as $f){ echo "<li>".htmlspecialchars($f)."</li>"; } ?>
</ul>
<a class="btn btn-primary"
href="/faculty/cv/pdf.php?dept=<?=urlencode($_GET['dept'])?>&name=<?=urlencode($_GET['name'])?>">
Download PDF
</a>
</div>
</body>
</html>