STC_APP / generate_id.php
Presidor1's picture
Create generate_id.php
0aff64c verified
Raw History Blame Contribute Delete
1.83 kB
<?php
if (!isset($_GET['id'])) {
echo "Invalid request.";
exit();
}
$conn = new mysqli("localhost", "root", "", "stc_db");
if ($conn->connect_error) die("Connection failed: " . $conn->connect_error);
$id = intval($_GET['id']);
$result = $conn->query("SELECT * FROM applications WHERE id = $id AND status = 'Approved'");
if ($result->num_rows !== 1) {
echo "Application not found or not approved yet.";
exit();
}
$data = $result->fetch_assoc();
?>
<!DOCTYPE html>
<html>
<head>
<title>ID Card</title>
<style>
body { font-family: Arial, sans-serif; }
.id-card {
width: 340px; height: 210px;
border: 2px solid #004e56; border-radius: 12px;
padding: 15px; background: #f4f4f4;
box-shadow: 0 0 10px rgba(0,0,0,0.2);
}
.id-card h2 { color: #004e56; font-size: 16px; text-align: center; }
.id-card img { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; display: block; margin: 0 auto; }
.id-details { text-align: center; margin-top: 10px; font-size: 14px; }
.print-btn {
margin-top: 20px; display: block;
padding: 10px 20px; background: #004e56; color: white;
text-align: center; text-decoration: none;
border-radius: 5px;
}
</style>
</head>
<body>
<div class="id-card">
<h2>Shelleng Team for Change (STC)</h2>
<img src="uploads/<?= htmlspecialchars($data['passport']) ?>" alt="Passport">
<div class="id-details">
<strong><?= htmlspecialchars($data['fullname']) ?></strong><br>
<?= htmlspecialchars($data['gender']) ?> | <?= htmlspecialchars($data['dob']) ?><br>
<?= htmlspecialchars($data['state']) ?>, <?= htmlspecialchars($data['lga']) ?><br>
Phone: <?= htmlspecialchars($data['phone']) ?>
</div>
</div>
<a href="#" class="print-btn" onclick="window.print()">Print ID</a>
</body>
</html>