final version
This commit is contained in:
parent
0d60435469
commit
20924b930b
76
admin/donors.php
Normal file
76
admin/donors.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
$pageTitle = "Manage Donors";
|
||||
require_once __DIR__ . '/../db/config.php';
|
||||
require_once __DIR__ . '/partials/header.php';
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
$stmt = $pdo->query("SELECT id, name, age, blood_type, status, created_at FROM donors ORDER BY created_at DESC");
|
||||
$donors = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
} catch (PDOException $e) {
|
||||
// In a real app, you'd log this error and show a user-friendly message.
|
||||
die("Error: Could not fetch donors. " . $e->getMessage());
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="container mt-5">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h1 class="display-5">Donor Registrations</h1>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>Age</th>
|
||||
<th>Blood Type</th>
|
||||
<th>Status</th>
|
||||
<th>Registered At</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($donors)): ?>
|
||||
<tr>
|
||||
<td colspan="7" class="text-center">No donor registrations found.</td>
|
||||
</tr>
|
||||
<?php else: ?>
|
||||
<?php foreach ($donors as $donor): ?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($donor['id']); ?></td>
|
||||
<td><?php echo htmlspecialchars($donor['name']); ?></td>
|
||||
<td><?php echo htmlspecialchars($donor['age']); ?></td>
|
||||
<td><?php echo htmlspecialchars($donor['blood_type']); ?></td>
|
||||
<td>
|
||||
<span class="badge <?php echo $donor['status'] === 'Pending Verification' ? 'bg-warning' : 'bg-success'; ?>">
|
||||
<?php echo htmlspecialchars($donor['status']); ?>
|
||||
</span>
|
||||
</td>
|
||||
<td><?php echo htmlspecialchars($donor['created_at']); ?></td>
|
||||
<td>
|
||||
<?php if ($donor['status'] === 'Pending Verification'): ?>
|
||||
<form action="update_donor_status.php" method="POST" class="d-inline">
|
||||
<input type="hidden" name="donor_id" value="<?php echo $donor['id']; ?>">
|
||||
<input type="hidden" name="status" value="Active">
|
||||
<button type="submit" class="btn btn-sm btn-success">Approve</button>
|
||||
</form>
|
||||
<form action="update_donor_status.php" method="POST" class="d-inline">
|
||||
<input type="hidden" name="donor_id" value="<?php echo $donor['id']; ?>">
|
||||
<input type="hidden" name="status" value="Rejected">
|
||||
<button type="submit" class="btn btn-sm btn-danger">Reject</button>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<span class="text-muted">N/A</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php require_once __DIR__ . '/partials/footer.php'; ?>
|
||||
85
admin/hospitals.php
Normal file
85
admin/hospitals.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
$pageTitle = "Manage Hospitals";
|
||||
require_once __DIR__ . '/../db/config.php';
|
||||
require_once __DIR__ . '/partials/header.php';
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
$stmt = $pdo->query("SELECT id, name, license_number, email, has_transplant_capability, status, created_at FROM hospitals ORDER BY created_at DESC");
|
||||
$hospitals = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
} catch (PDOException $e) {
|
||||
die("Error: Could not fetch hospitals. " . $e->getMessage());
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="container mt-5">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h1 class="display-5">Hospital Registrations</h1>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>License Number</th>
|
||||
<th>Email</th>
|
||||
<th>Transplant Ready</th>
|
||||
<th>Status</th>
|
||||
<th>Registered At</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($hospitals)): ?>
|
||||
<tr>
|
||||
<td colspan="8" class="text-center">No hospital registrations found.</td>
|
||||
</tr>
|
||||
<?php else: ?>
|
||||
<?php foreach ($hospitals as $hospital): ?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($hospital['id']); ?></td>
|
||||
<td><?= htmlspecialchars($hospital['name']); ?></td>
|
||||
<td><?= htmlspecialchars($hospital['license_number']); ?></td>
|
||||
<td><?= htmlspecialchars($hospital['email']); ?></td>
|
||||
<td><span class="badge <?= $hospital['has_transplant_capability'] ? 'bg-info' : 'bg-secondary'; ?>"><?= $hospital['has_transplant_capability'] ? 'Yes' : 'No'; ?></span></td>
|
||||
<td>
|
||||
<?php
|
||||
$status_classes = [
|
||||
'Pending Verification' => 'bg-warning text-dark',
|
||||
'Verified' => 'bg-success',
|
||||
'Rejected' => 'bg-danger',
|
||||
];
|
||||
$class = $status_classes[$hospital['status']] ?? 'bg-secondary';
|
||||
?>
|
||||
<span class="badge <?php echo $class; ?>">
|
||||
<?= htmlspecialchars($hospital['status']); ?>
|
||||
</span>
|
||||
</td>
|
||||
<td><?= htmlspecialchars($hospital['created_at']); ?></td>
|
||||
<td>
|
||||
<?php if ($hospital['status'] === 'Pending Verification'): ?>
|
||||
<form action="update_hospital_status.php" method="POST" class="d-inline">
|
||||
<input type="hidden" name="hospital_id" value="<?= $hospital['id']; ?>">
|
||||
<input type="hidden" name="status" value="Verified">
|
||||
<button type="submit" class="btn btn-sm btn-success">Approve</button>
|
||||
</form>
|
||||
<form action="update_hospital_status.php" method="POST" class="d-inline">
|
||||
<input type="hidden" name="hospital_id" value="<?= $hospital['id']; ?>">
|
||||
<input type="hidden" name="status" value="Rejected">
|
||||
<button type="submit" class="btn btn-sm btn-danger">Reject</button>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<span class="text-muted">N/A</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php require_once __DIR__ . '/partials/footer.php'; ?>
|
||||
66
admin/index.php
Normal file
66
admin/index.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../db/config.php';
|
||||
$pageTitle = "Admin Dashboard";
|
||||
require_once __DIR__ . '/partials/header.php';
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
|
||||
// Fetch count of pending donors
|
||||
$stmt_donors = $pdo->prepare("SELECT COUNT(*) FROM donors WHERE status = 'Pending'");
|
||||
$stmt_donors->execute();
|
||||
$pending_donors_count = $stmt_donors->fetchColumn();
|
||||
|
||||
// Fetch count of pending hospitals
|
||||
$stmt_hospitals = $pdo->prepare("SELECT COUNT(*) FROM hospitals WHERE status = 'Pending Verification'");
|
||||
$stmt_hospitals->execute();
|
||||
$pending_hospitals_count = $stmt_hospitals->fetchColumn();
|
||||
|
||||
} catch (PDOException $e) {
|
||||
// Handle database errors
|
||||
$pending_donors_count = 0;
|
||||
$pending_hospitals_count = 0;
|
||||
// Optionally log the error
|
||||
error_log("Admin dashboard DB error: " . $e->getMessage());
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="container mt-5">
|
||||
<h1 class="display-4">Admin Dashboard</h1>
|
||||
<p class="lead">Welcome to the administration area. From here you can manage donors, hospitals, and system settings.</p>
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-md-6">
|
||||
<div class="card text-center">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Donors</h5>
|
||||
<p class="card-text">Manage and verify donor registrations.</p>
|
||||
<?php if ($pending_donors_count > 0): ?>
|
||||
<a href="donors.php" class="btn btn-primary">
|
||||
Manage Donors <span class="badge bg-danger ms-2"><?= $pending_donors_count ?> Pending</span>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<a href="donors.php" class="btn btn-primary">Manage Donors</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="card text-center">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Hospitals</h5>
|
||||
<p class="card-text">Manage and verify hospital registrations.</p>
|
||||
<?php if ($pending_hospitals_count > 0): ?>
|
||||
<a href="hospitals.php" class="btn btn-primary">
|
||||
Manage Hospitals <span class="badge bg-danger ms-2"><?= $pending_hospitals_count ?> Pending</span>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<a href="hospitals.php" class="btn btn-primary">Manage Hospitals</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php require_once __DIR__ . '/partials/footer.php'; ?>
|
||||
83
admin/login.php
Normal file
83
admin/login.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../db/config.php';
|
||||
|
||||
session_start();
|
||||
|
||||
if (isset($_SESSION['admin_logged_in']) && $_SESSION['admin_logged_in'] === true) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$error = '';
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$username = $_POST['username'] ?? '';
|
||||
$password = $_POST['password'] ?? '';
|
||||
|
||||
if (empty($username) || empty($password)) {
|
||||
$error = "Username and password are required.";
|
||||
} else {
|
||||
try {
|
||||
$pdo = db();
|
||||
$stmt = $pdo->prepare("SELECT * FROM admin WHERE username = ?");
|
||||
$stmt->execute([$username]);
|
||||
$admin = $stmt->fetch();
|
||||
|
||||
if ($admin && password_verify($password, $admin['password_hash'])) {
|
||||
$_SESSION['admin_logged_in'] = true;
|
||||
$_SESSION['admin_username'] = $admin['username'];
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
} else {
|
||||
$error = "Invalid username or password.";
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
$error = "Database error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$pageTitle = "Admin Login";
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?php echo htmlspecialchars($pageTitle); ?> - Organ Donation</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container mt-5">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="text-center">Admin Login</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<?php if ($error): ?>
|
||||
<div class="alert alert-danger"><?php echo htmlspecialchars($error); ?></div>
|
||||
<?php endif; ?>
|
||||
<form action="login.php" method="POST">
|
||||
<div class="mb-3">
|
||||
<label for="username" class="form-label">Username</label>
|
||||
<input type="text" class="form-control" id="username" name="username" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">Password</label>
|
||||
<input type="password" class="form-control" id="password" name="password" required>
|
||||
</div>
|
||||
<div class="d-grid">
|
||||
<button type="submit" class="btn btn-primary">Login</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
7
admin/logout.php
Normal file
7
admin/logout.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
session_start();
|
||||
session_unset();
|
||||
session_destroy();
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
?>
|
||||
10
admin/partials/footer.php
Normal file
10
admin/partials/footer.php
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
<footer class="bg-dark text-white text-center p-3 mt-auto">
|
||||
<div class="container">
|
||||
<p>© <?php echo date("Y"); ?> Organ Donation System - Admin</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
48
admin/partials/header.php
Normal file
48
admin/partials/header.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
if (!isset($_SESSION['admin_logged_in']) || $_SESSION['admin_logged_in'] !== true) {
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?php echo isset($pageTitle) ? htmlspecialchars($pageTitle) : "Admin"; ?> - Organ Donation</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="index.php"><i class="fas fa-user-shield"></i> Admin Panel</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#adminNav" aria-controls="adminNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="adminNav">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'index.php' ? 'active' : ''; ?>" href="index.php">Dashboard</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'donors.php' ? 'active' : ''; ?>" href="donors.php">Donors</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?php echo basename($_SERVER['PHP_SELF']) == 'hospitals.php' ? 'active' : ''; ?>" href="hospitals.php">Hospitals</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/" target="_blank">View Public Site <i class="fas fa-external-link-alt"></i></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="logout.php">Logout <i class="fas fa-sign-out-alt"></i></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
23
admin/update_donor_status.php
Normal file
23
admin/update_donor_status.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../db/config.php';
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$donorId = $_POST['donor_id'] ?? null;
|
||||
$newStatus = $_POST['status'] ?? null;
|
||||
|
||||
if ($donorId && ($newStatus === 'Active' || $newStatus === 'Rejected')) {
|
||||
try {
|
||||
$pdo = db();
|
||||
$stmt = $pdo->prepare("UPDATE donors SET status = :status WHERE id = :id");
|
||||
$stmt->execute(['status' => $newStatus, 'id' => $donorId]);
|
||||
} catch (PDOException $e) {
|
||||
// In a real app, log this and handle it more gracefully.
|
||||
die("Database error: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Redirect back to the donors list
|
||||
header("Location: donors.php");
|
||||
exit;
|
||||
?>
|
||||
26
admin/update_hospital_status.php
Normal file
26
admin/update_hospital_status.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../db/config.php';
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$hospitalId = $_POST['hospital_id'] ?? null;
|
||||
$newStatus = $_POST['status'] ?? null;
|
||||
|
||||
// Define allowed statuses to prevent arbitrary updates
|
||||
$allowed_statuses = ['Verified', 'Rejected'];
|
||||
|
||||
if ($hospitalId && in_array($newStatus, $allowed_statuses)) {
|
||||
try {
|
||||
$pdo = db();
|
||||
$stmt = $pdo->prepare("UPDATE hospitals SET status = :status WHERE id = :id");
|
||||
$stmt->execute(['status' => $newStatus, 'id' => $hospitalId]);
|
||||
} catch (PDOException $e) {
|
||||
// In a real app, log this and handle it more gracefully.
|
||||
die("Database error: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Redirect back to the hospitals list
|
||||
header("Location: hospitals.php");
|
||||
exit;
|
||||
?>
|
||||
20
api/pexels.php
Normal file
20
api/pexels.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
require_once __DIR__.'/../includes/pexels.php';
|
||||
$q = isset($_GET['query']) ? $_GET['query'] : 'nature';
|
||||
$orientation = isset($_GET['orientation']) ? $_GET['orientation'] : 'portrait';
|
||||
$url = 'https://api.pexels.com/v1/search?query=' . urlencode($q) . '&orientation=' . urlencode($orientation) . '&per_page=1&page=1';
|
||||
$data = pexels_get($url);
|
||||
if (!$data || empty($data['photos'])) { echo json_encode(['error'=>'Failed to fetch image']); exit; }
|
||||
$photo = $data['photos'][0];
|
||||
$src = $photo['src']['large2x'] ?? ($photo['src']['large'] ?? $photo['src']['original']);
|
||||
$target = __DIR__ . '/../assets/images/pexels/' . $photo['id'] . '.jpg';
|
||||
download_to($src, $target);
|
||||
// Return minimal info and local relative path
|
||||
echo json_encode([
|
||||
'id' => $photo['id'],
|
||||
'local' => 'assets/images/pexels/' . $photo['id'] . '.jpg',
|
||||
'photographer' => $photo['photographer'] ?? null,
|
||||
'photographer_url' => $photo['photographer_url'] ?? null,
|
||||
]);
|
||||
?>
|
||||
BIN
assets/images/pexels/3698024.jpg
Normal file
BIN
assets/images/pexels/3698024.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 158 KiB |
BIN
assets/images/pexels/4047073.jpg
Normal file
BIN
assets/images/pexels/4047073.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
208
donor_registration.php
Normal file
208
donor_registration.php
Normal file
@ -0,0 +1,208 @@
|
||||
<?php
|
||||
$pageTitle = "Donor Registration";
|
||||
$pageDescription = "Register as an organ donor.";
|
||||
$successMessage = "";
|
||||
$errorMessage = "";
|
||||
|
||||
// Handle form submission
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
require_once 'db/config.php';
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
|
||||
// Idempotent table creation
|
||||
$pdo->exec("
|
||||
CREATE TABLE IF NOT EXISTS donors (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
age INT NOT NULL,
|
||||
blood_type VARCHAR(3) NOT NULL,
|
||||
weight_kg FLOAT NOT NULL,
|
||||
phone VARCHAR(20) NOT NULL,
|
||||
email VARCHAR(255) NOT NULL UNIQUE,
|
||||
emergency_contact_name VARCHAR(255) NOT NULL,
|
||||
emergency_contact_phone VARCHAR(20) NOT NULL,
|
||||
status VARCHAR(20) DEFAULT 'Pending Verification',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
)
|
||||
");
|
||||
|
||||
// Validation
|
||||
$required_fields = ['name', 'age', 'blood_type', 'weight_kg', 'phone', 'email', 'emergency_contact_name', 'emergency_contact_phone'];
|
||||
foreach ($required_fields as $field) {
|
||||
if (empty($_POST[$field])) {
|
||||
throw new Exception("All fields are required.");
|
||||
}
|
||||
}
|
||||
|
||||
if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
|
||||
throw new Exception("Invalid email format.");
|
||||
}
|
||||
|
||||
if ($_POST['age'] < 18 || $_POST['age'] > 75) {
|
||||
throw new Exception("Age must be between 18 and 75.");
|
||||
}
|
||||
|
||||
// Insert data
|
||||
$stmt = $pdo->prepare(
|
||||
"INSERT INTO donors (name, age, blood_type, weight_kg, phone, email, emergency_contact_name, emergency_contact_phone) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
|
||||
);
|
||||
|
||||
$stmt->execute([
|
||||
$_POST['name'],
|
||||
$_POST['age'],
|
||||
$_POST['blood_type'],
|
||||
$_POST['weight_kg'],
|
||||
$_POST['phone'],
|
||||
$_POST['email'],
|
||||
$_POST['emergency_contact_name'],
|
||||
$_POST['emergency_contact_phone']
|
||||
]);
|
||||
|
||||
$successMessage = "Thank you for registering! Your application is pending verification.";
|
||||
|
||||
} catch (PDOException $e) {
|
||||
if ($e->errorInfo[1] == 1062) { // Duplicate entry for email
|
||||
$errorMessage = "This email address is already registered.";
|
||||
} else {
|
||||
$errorMessage = "Database error: " . $e->getMessage();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$errorMessage = $e->getMessage();
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?= htmlspecialchars($pageTitle) ?> - Organ Donation System</title>
|
||||
<meta name="description" content="<?= htmlspecialchars($pageDescription) ?>">
|
||||
<!-- Bootstrap 5 CSS -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
.form-container {
|
||||
max-width: 800px;
|
||||
margin: 50px auto;
|
||||
background: #fff;
|
||||
padding: 30px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="index.php">
|
||||
<i class="bi bi-heart-pulse-fill text-primary"></i>
|
||||
Organ Donation
|
||||
</a>
|
||||
<div class="collapse navbar-collapse">
|
||||
<ul class="navbar-nav ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="index.php">Home</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container">
|
||||
<div class="form-container">
|
||||
<h2 class="text-center mb-4">Donor Registration</h2>
|
||||
<p class="text-center text-muted mb-4">Complete the form below to become a registered organ donor.</p>
|
||||
|
||||
<?php if ($successMessage): ?>
|
||||
<div class="alert alert-success">
|
||||
<i class="bi bi-check-circle-fill"></i>
|
||||
<?= htmlspecialchars($successMessage) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($errorMessage): ?>
|
||||
<div class="alert alert-danger">
|
||||
<i class="bi bi-exclamation-triangle-fill"></i>
|
||||
<?= htmlspecialchars($errorMessage) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!$successMessage): ?>
|
||||
<form action="donor_registration.php" method="POST" novalidate>
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="name" class="form-label">Full Name</label>
|
||||
<input type="text" class="form-control" id="name" name="name" required>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="email" class="form-label">Email Address</label>
|
||||
<input type="email" class="form-control" id="email" name="email" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4 mb-3">
|
||||
<label for="age" class="form-label">Age (18-75)</label>
|
||||
<input type="number" class="form-control" id="age" name="age" min="18" max="75" required>
|
||||
</div>
|
||||
<div class="col-md-4 mb-3">
|
||||
<label for="blood_type" class="form-label">Blood Type</label>
|
||||
<select class="form-select" id="blood_type" name="blood_type" required>
|
||||
<option value="">Select...</option>
|
||||
<option value="A+">A+</option>
|
||||
<option value="A-">A-</option>
|
||||
<option value="B+">B+</option>
|
||||
<option value="B-">B-</option>
|
||||
<option value="AB+">AB+</option>
|
||||
<option value="AB-">AB-</option>
|
||||
<option value="O+">O+</option>
|
||||
<option value="O-">O-</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-4 mb-3">
|
||||
<label for="weight_kg" class="form-label">Weight (kg)</label>
|
||||
<input type="number" step="0.1" class="form-control" id="weight_kg" name="weight_kg" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="phone" class="form-label">Phone Number</label>
|
||||
<input type="tel" class="form-control" id="phone" name="phone" required>
|
||||
</div>
|
||||
|
||||
<hr class="my-4">
|
||||
<h5 class="mb-3">Emergency Contact</h5>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="emergency_contact_name" class="form-label">Contact Name</label>
|
||||
<input type="text" class="form-control" id="emergency_contact_name" name="emergency_contact_name" required>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="emergency_contact_phone" class="form-label">Contact Phone</label>
|
||||
<input type="tel" class="form-control" id="emergency_contact_phone" name="emergency_contact_phone" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-grid mt-4">
|
||||
<button type="submit" class="btn btn-primary btn-lg">Submit Registration</button>
|
||||
</div>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="text-center py-4 text-muted">
|
||||
<p>© <?= date("Y") ?> Organ Donation System. All rights reserved.</p>
|
||||
</footer>
|
||||
|
||||
<!-- Bootstrap 5 JS -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
103
hospital_dashboard.php
Normal file
103
hospital_dashboard.php
Normal file
@ -0,0 +1,103 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
if (!isset($_SESSION['hospital_id'])) {
|
||||
header("Location: hospital_login.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$hospitalName = $_SESSION['hospital_name'];
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Hospital Dashboard - Organ Donation</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Poppins', sans-serif;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="bg-gray-100">
|
||||
|
||||
<nav class="bg-white shadow-md">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div class="flex justify-between h-16">
|
||||
<div class="flex">
|
||||
<a href="index.php" class="flex-shrink-0 flex items-center">
|
||||
<span class="font-bold text-xl text-blue-600">OrganConnect</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<span class="mr-4">Welcome, <?php echo htmlspecialchars($hospitalName); ?>!</span>
|
||||
<a href="logout.php" class="px-3 py-2 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-200">Logout</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container mx-auto px-4 py-12">
|
||||
<h1 class="text-3xl font-bold text-gray-800 mb-6">Hospital Dashboard</h1>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<div class="bg-white p-6 rounded-lg shadow-lg">
|
||||
<h2 class="text-xl font-bold mb-4">Recipient Management</h2>
|
||||
<p class="text-gray-600 mb-4">Register new recipients and manage existing patient records.</p>
|
||||
<a href="recipient_registration.php" class="text-blue-600 hover:underline">Register a New Recipient →</a>
|
||||
</div>
|
||||
<div class="bg-white p-6 rounded-lg shadow-lg">
|
||||
<h2 class="text-xl font-bold mb-4">View Registered Recipients</h2>
|
||||
<p class="text-gray-600 mb-4">View a list of all patients registered by your hospital.</p>
|
||||
<a href="hospital_dashboard.php?view=recipients" class="text-blue-600 hover:underline">View Recipients →</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if (isset($_GET['view']) && $_GET['view'] == 'recipients'):
|
||||
require_once 'db/config.php';
|
||||
$pdo = db();
|
||||
$stmt = $pdo->prepare("SELECT * FROM recipients WHERE hospital_id = ? ORDER BY created_at DESC");
|
||||
$stmt->execute([$_SESSION['hospital_id']]);
|
||||
$recipients = $stmt->fetchAll();
|
||||
?>
|
||||
<div class="mt-12 bg-white p-8 rounded-lg shadow-lg">
|
||||
<h2 class="text-2xl font-bold text-gray-800 mb-6">Registered Recipients</h2>
|
||||
<div class="overflow-x-auto">
|
||||
<table class="min-w-full bg-white">
|
||||
<thead class="bg-gray-200">
|
||||
<tr>
|
||||
<th class="text-left py-3 px-4 uppercase font-semibold text-sm">Patient Name</th>
|
||||
<th class="text-left py-3 px-4 uppercase font-semibold text-sm">Organ Needed</th>
|
||||
<th class="text-left py-3 px-4 uppercase font-semibold text-sm">Blood Type</th>
|
||||
<th class="text-left py-3 px-4 uppercase font-semibold text-sm">Registered On</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($recipients)): ?>
|
||||
<tr>
|
||||
<td colspan="4" class="text-center py-4 text-gray-500">No recipients registered yet.</td>
|
||||
</tr>
|
||||
<?php else: ?>
|
||||
<?php foreach ($recipients as $recipient): ?>
|
||||
<tr class="border-b">
|
||||
<td class="py-3 px-4"><?= htmlspecialchars($recipient['patient_name']) ?></td>
|
||||
<td class="py-3 px-4"><?= htmlspecialchars($recipient['organ_needed']) ?></td>
|
||||
<td class="py-3 px-4"><?= htmlspecialchars($recipient['blood_type']) ?></td>
|
||||
<td class="py-3 px-4"><?= date("M d, Y", strtotime($recipient['created_at'])) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
107
hospital_login.php
Normal file
107
hospital_login.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once 'db/config.php';
|
||||
|
||||
$error = '';
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$email = trim($_POST['email']);
|
||||
$password = $_POST['password'];
|
||||
|
||||
if (empty($email) || empty($password)) {
|
||||
$error = "Email and password are required.";
|
||||
} else {
|
||||
$pdo = db();
|
||||
$stmt = $pdo->prepare("SELECT * FROM hospitals WHERE email = ?");
|
||||
$stmt->execute([$email]);
|
||||
$hospital = $stmt->fetch();
|
||||
|
||||
if ($hospital && password_verify($password, $hospital['password_hash'])) {
|
||||
if ($hospital['status'] == 'Verified') {
|
||||
$_SESSION['hospital_id'] = $hospital['id'];
|
||||
$_SESSION['hospital_name'] = $hospital['name'];
|
||||
header("Location: hospital_dashboard.php");
|
||||
exit;
|
||||
} else {
|
||||
$error = "Your hospital account is not yet verified.";
|
||||
}
|
||||
} else {
|
||||
$error = "Invalid email or password.";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Hospital Login - Organ Donation</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Poppins', sans-serif;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="bg-gray-100">
|
||||
|
||||
<nav class="bg-white shadow-md">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div class="flex justify-between h-16">
|
||||
<div class="flex">
|
||||
<a href="index.php" class="flex-shrink-0 flex items-center">
|
||||
<span class="font-bold text-xl text-blue-600">OrganConnect</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<a href="index.php" class="px-3 py-2 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-200">Home</a>
|
||||
<a href="donor_registration.php" class="px-3 py-2 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-200">Become a Donor</a>
|
||||
<a href="hospital_registration.php" class="px-3 py-2 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-200">Hospital Registration</a>
|
||||
<a href="hospital_login.php" class="px-3 py-2 rounded-md text-sm font-medium text-blue-600 bg-blue-100">Hospital Portal</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container mx-auto px-4 py-12">
|
||||
<div class="max-w-md mx-auto bg-white p-8 rounded-lg shadow-lg">
|
||||
<h1 class="text-3xl font-bold text-center text-gray-800 mb-6">Hospital Login</h1>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative mb-4" role="alert">
|
||||
<span class="block sm:inline"><?php echo htmlspecialchars($error); ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form action="hospital_login.php" method="POST" class="space-y-6">
|
||||
<div>
|
||||
<label for="email" class="block text-sm font-medium text-gray-700">Email Address</label>
|
||||
<input type="email" name="email" id="email" required class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
|
||||
</div>
|
||||
<div>
|
||||
<label for="password" class="block text-sm font-medium text-gray-700">Password</label>
|
||||
<input type="password" name="password" id="password" required class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" class="w-full flex justify-center py-3 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
|
||||
Login
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="bg-white fixed bottom-0 w-full">
|
||||
<div class="max-w-7xl mx-auto py-4 px-4 sm:px-6 lg:px-8">
|
||||
<div class="flex justify-between items-center">
|
||||
<p class="text-center text-gray-500 text-sm">© <?php echo date("Y"); ?> OrganConnect. All rights reserved.</p>
|
||||
<a href="admin/" class="text-sm text-gray-500 hover:text-gray-700">Admin Login</a>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
169
hospital_registration.php
Normal file
169
hospital_registration.php
Normal file
@ -0,0 +1,169 @@
|
||||
<?php
|
||||
require_once 'db/config.php';
|
||||
|
||||
$pdo = db();
|
||||
|
||||
// Create hospitals table if it doesn't exist
|
||||
try {
|
||||
$sql = "
|
||||
CREATE TABLE IF NOT EXISTS hospitals (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
license_number VARCHAR(255) NOT NULL,
|
||||
address TEXT NOT NULL,
|
||||
phone VARCHAR(20) NOT NULL,
|
||||
email VARCHAR(255) NOT NULL UNIQUE,
|
||||
password_hash VARCHAR(255) NOT NULL,
|
||||
has_transplant_capability BOOLEAN NOT NULL DEFAULT 0,
|
||||
status VARCHAR(50) DEFAULT 'Pending Verification',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
)";
|
||||
$pdo->exec($sql);
|
||||
} catch (PDOException $e) {
|
||||
die("Could not create table: " . $e->getMessage());
|
||||
}
|
||||
|
||||
$message = '';
|
||||
$error = '';
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
// Collect and sanitize input
|
||||
$name = trim($_POST['name']);
|
||||
$license_number = trim($_POST['license_number']);
|
||||
$address = trim($_POST['address']);
|
||||
$phone = trim($_POST['phone']);
|
||||
$email = trim($_POST['email']);
|
||||
$password = $_POST['password'];
|
||||
$has_transplant_capability = isset($_POST['has_transplant_capability']) ? 1 : 0;
|
||||
|
||||
// Validation
|
||||
if (empty($name) || empty($license_number) || empty($address) || empty($phone) || empty($email) || empty($password)) {
|
||||
$error = "All fields except transplant capability are required.";
|
||||
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||
$error = "Invalid email format.";
|
||||
} else {
|
||||
// Check if email already exists
|
||||
$stmt = $pdo->prepare("SELECT id FROM hospitals WHERE email = ?");
|
||||
$stmt->execute([$email]);
|
||||
if ($stmt->fetch()) {
|
||||
$error = "This email address is already registered.";
|
||||
} else {
|
||||
// Hash password and insert data
|
||||
$password_hash = password_hash($password, PASSWORD_DEFAULT);
|
||||
$sql = "INSERT INTO hospitals (name, license_number, address, phone, email, password_hash, has_transplant_capability) VALUES (?, ?, ?, ?, ?, ?, ?)";
|
||||
$stmt = $pdo->prepare($sql);
|
||||
|
||||
try {
|
||||
$stmt->execute([$name, $license_number, $address, $phone, $email, $password_hash, $has_transplant_capability]);
|
||||
$message = "Registration successful! Your application is pending verification from an administrator.";
|
||||
} catch (PDOException $e) {
|
||||
$error = "Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Hospital Registration - Organ Donation</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Poppins', sans-serif;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="bg-gray-100">
|
||||
|
||||
<nav class="bg-white shadow-md">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div class="flex justify-between h-16">
|
||||
<div class="flex">
|
||||
<a href="index.php" class="flex-shrink-0 flex items-center">
|
||||
<span class="font-bold text-xl text-blue-600">OrganConnect</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<a href="index.php" class="px-3 py-2 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-200">Home</a>
|
||||
<a href="donor_registration.php" class="px-3 py-2 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-200">Become a Donor</a>
|
||||
<a href="hospital_registration.php" class="px-3 py-2 rounded-md text-sm font-medium text-blue-600 bg-blue-100">Hospital Portal</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container mx-auto px-4 py-12">
|
||||
<div class="max-w-2xl mx-auto bg-white p-8 rounded-lg shadow-lg">
|
||||
<h1 class="text-3xl font-bold text-center text-gray-800 mb-6">Hospital Registration</h1>
|
||||
|
||||
<?php if ($message): ?>
|
||||
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded relative mb-4" role="alert">
|
||||
<span class="block sm:inline"><?php echo htmlspecialchars($message); ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($error): ?>
|
||||
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative mb-4" role="alert">
|
||||
<span class="block sm:inline"><?php echo htmlspecialchars($error); ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!$message): ?>
|
||||
<form action="hospital_registration.php" method="POST" class="space-y-6">
|
||||
<div>
|
||||
<label for="name" class="block text-sm font-medium text-gray-700">Hospital Name</label>
|
||||
<input type="text" name="name" id="name" required class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
|
||||
</div>
|
||||
<div>
|
||||
<label for="license_number" class="block text-sm font-medium text-gray-700">Official License Number</label>
|
||||
<input type="text" name="license_number" id="license_number" required class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
|
||||
</div>
|
||||
<div>
|
||||
<label for="address" class="block text-sm font-medium text-gray-700">Full Address</label>
|
||||
<textarea name="address" id="address" rows="3" required class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm"></textarea>
|
||||
</div>
|
||||
<div>
|
||||
<label for="phone" class="block text-sm font-medium text-gray-700">Contact Phone</label>
|
||||
<input type="tel" name="phone" id="phone" required class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
|
||||
</div>
|
||||
<div>
|
||||
<label for="email" class="block text-sm font-medium text-gray-700">Contact Email</label>
|
||||
<input type="email" name="email" id="email" required class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
|
||||
</div>
|
||||
<div>
|
||||
<label for="password" class="block text-sm font-medium text-gray-700">Create Password</label>
|
||||
<input type="password" name="password" id="password" required class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
|
||||
</div>
|
||||
<div class="flex items-start">
|
||||
<div class="flex items-center h-5">
|
||||
<input id="has_transplant_capability" name="has_transplant_capability" type="checkbox" value="1" class="focus:ring-blue-500 h-4 w-4 text-blue-600 border-gray-300 rounded">
|
||||
</div>
|
||||
<div class="ml-3 text-sm">
|
||||
<label for="has_transplant_capability" class="font-medium text-gray-700">Our facility has transplant capabilities</label>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" class="w-full flex justify-center py-3 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
|
||||
Register Hospital
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="bg-white">
|
||||
<div class="max-w-7xl mx-auto py-4 px-4 sm:px-6 lg:px-8">
|
||||
<div class="flex justify-between items-center">
|
||||
<p class="text-center text-gray-500 text-sm">© <?php echo date("Y"); ?> OrganConnect. All rights reserved.</p>
|
||||
<a href="admin/" class="text-sm text-gray-500 hover:text-gray-700">Admin Login</a>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
26
includes/pexels.php
Normal file
26
includes/pexels.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
function pexels_key() {
|
||||
$k = getenv('PEXELS_KEY');
|
||||
return $k && strlen($k) > 0 ? $k : 'Vc99rnmOhHhJAbgGQoKLZtsaIVfkeownoQNbTj78VemUjKh08ZYRbf18';
|
||||
}
|
||||
function pexels_get($url) {
|
||||
$ch = curl_init();
|
||||
curl_setopt_array($ch, [
|
||||
CURLOPT_URL => $url,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_HTTPHEADER => [ 'Authorization: '. pexels_key() ],
|
||||
CURLOPT_TIMEOUT => 15,
|
||||
]);
|
||||
$resp = curl_exec($ch);
|
||||
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
if ($code >= 200 && $code < 300 && $resp) return json_decode($resp, true);
|
||||
return null;
|
||||
}
|
||||
function download_to($srcUrl, $destPath) {
|
||||
$data = file_get_contents($srcUrl);
|
||||
if ($data === false) return false;
|
||||
if (!is_dir(dirname($destPath))) mkdir(dirname($destPath), 0775, true);
|
||||
return file_put_contents($destPath, $data) !== false;
|
||||
}
|
||||
?>
|
||||
270
index.php
270
index.php
@ -1,150 +1,132 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
@ini_set('display_errors', '1');
|
||||
@error_reporting(E_ALL);
|
||||
@date_default_timezone_set('UTC');
|
||||
|
||||
$phpVersion = PHP_VERSION;
|
||||
$now = date('Y-m-d H:i:s');
|
||||
?>
|
||||
<!doctype html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>New Style</title>
|
||||
<?php
|
||||
// Read project preview data from environment
|
||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
||||
?>
|
||||
<?php if ($projectDescription): ?>
|
||||
<!-- Meta description -->
|
||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
||||
<!-- Open Graph meta tags -->
|
||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||
<!-- Twitter meta tags -->
|
||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||
<?php endif; ?>
|
||||
<?php if ($projectImageUrl): ?>
|
||||
<!-- Open Graph image -->
|
||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||
<!-- Twitter image -->
|
||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||
<?php endif; ?>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
:root {
|
||||
--bg-color-start: #6a11cb;
|
||||
--bg-color-end: #2575fc;
|
||||
--text-color: #ffffff;
|
||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: 'Inter', sans-serif;
|
||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
||||
color: var(--text-color);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
body::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
||||
animation: bg-pan 20s linear infinite;
|
||||
z-index: -1;
|
||||
}
|
||||
@keyframes bg-pan {
|
||||
0% { background-position: 0% 0%; }
|
||||
100% { background-position: 100% 100%; }
|
||||
}
|
||||
main {
|
||||
padding: 2rem;
|
||||
}
|
||||
.card {
|
||||
background: var(--card-bg-color);
|
||||
border: 1px solid var(--card-border-color);
|
||||
border-radius: 16px;
|
||||
padding: 2rem;
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.loader {
|
||||
margin: 1.25rem auto 1.25rem;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
||||
border-top-color: #fff;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
@keyframes spin {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
.hint {
|
||||
opacity: 0.9;
|
||||
}
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
width: 1px; height: 1px;
|
||||
padding: 0; margin: -1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
white-space: nowrap; border: 0;
|
||||
}
|
||||
h1 {
|
||||
font-size: 3rem;
|
||||
font-weight: 700;
|
||||
margin: 0 0 1rem;
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
p {
|
||||
margin: 0.5rem 0;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
code {
|
||||
background: rgba(0,0,0,0.2);
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
}
|
||||
footer {
|
||||
position: absolute;
|
||||
bottom: 1rem;
|
||||
font-size: 0.8rem;
|
||||
opacity: 0.7;
|
||||
}
|
||||
</style>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Organ Donation & Management System</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Roboto', sans-serif;
|
||||
background-color: #f0f2f5;
|
||||
}
|
||||
.navbar {
|
||||
background-color: #ffffff;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
}
|
||||
.navbar-brand {
|
||||
font-weight: 700;
|
||||
color: #0d6efd !important;
|
||||
}
|
||||
.hero-section {
|
||||
background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('https://images.pexels.com/photos/3992933/pexels-photo-3992933.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1') no-repeat center center;
|
||||
background-size: cover;
|
||||
color: white;
|
||||
padding: 120px 0;
|
||||
text-align: center;
|
||||
}
|
||||
.hero-section h1 {
|
||||
font-size: 3.8rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
.hero-section p {
|
||||
font-size: 1.4rem;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.btn-primary {
|
||||
background-color: #0d6efd;
|
||||
border-color: #0d6efd;
|
||||
padding: 12px 25px;
|
||||
font-size: 1.1rem;
|
||||
font-weight: 700;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
.btn-primary:hover {
|
||||
background-color: #0b5ed7;
|
||||
border-color: #0a58ca;
|
||||
}
|
||||
.info-section {
|
||||
padding: 80px 0;
|
||||
}
|
||||
.info-card {
|
||||
background-color: #ffffff;
|
||||
border-radius: 10px;
|
||||
padding: 30px;
|
||||
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
|
||||
text-align: center;
|
||||
height: 100%;
|
||||
}
|
||||
.info-card h2 {
|
||||
color: #0d6efd;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.footer {
|
||||
background-color: #343a40;
|
||||
color: white;
|
||||
padding: 20px 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div class="card">
|
||||
<h1>Analyzing your requirements and generating your website…</h1>
|
||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
||||
<span class="sr-only">Loading…</span>
|
||||
</div>
|
||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
||||
<nav class="navbar navbar-expand-lg">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="#">OrganDonation</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav ms-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="donor_registration.php">Become a Donor</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="hospital_registration.php">Hospital Registration</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="hospital_login.php">Hospital Login</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="admin/login.php">Admin Login</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="hero-section">
|
||||
<div class="container">
|
||||
<h1>A Gift of Life, A Legacy of Hope</h1>
|
||||
<p>Join our community to make a difference through organ donation.</p>
|
||||
<a href="donor_registration.php" class="btn btn-primary btn-lg">Register as a Donor</a>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<footer>
|
||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
||||
</footer>
|
||||
|
||||
<div class="container info-section">
|
||||
<div class="row g-4">
|
||||
<div class="col-md-6">
|
||||
<div class="info-card">
|
||||
<h2>For Donors</h2>
|
||||
<p>Register as an organ donor and give the gift of life. Your selfless act can save up to eight lives.</p>
|
||||
<a href="donor_registration.php" class="btn btn-primary">Register Now</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="info-card">
|
||||
<h2>For Hospitals</h2>
|
||||
<p>Register your hospital to connect with donors and manage organ requests seamlessly and efficiently.</p>
|
||||
<a href="hospital_registration.php" class="btn btn-primary">Register Now</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="footer text-center">
|
||||
<div class="container">
|
||||
<p>© 2025 OrganDonation.com. All Rights Reserved.</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
6
logout.php
Normal file
6
logout.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
session_start();
|
||||
session_unset();
|
||||
session_destroy();
|
||||
header("Location: hospital_login.php");
|
||||
exit;
|
||||
162
recipient_registration.php
Normal file
162
recipient_registration.php
Normal file
@ -0,0 +1,162 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
if (!isset($_SESSION['hospital_id'])) {
|
||||
header("Location: hospital_login.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once 'db/config.php';
|
||||
$pdo = db();
|
||||
|
||||
// Create recipients table if it doesn't exist
|
||||
try {
|
||||
$sql = "
|
||||
CREATE TABLE IF NOT EXISTS recipients (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
hospital_id INT NOT NULL,
|
||||
patient_name VARCHAR(255) NOT NULL,
|
||||
patient_dob DATE NOT NULL,
|
||||
blood_type VARCHAR(5) NOT NULL,
|
||||
organ_needed VARCHAR(100) NOT NULL,
|
||||
urgency_level VARCHAR(50) NOT NULL,
|
||||
contact_phone VARCHAR(20) NOT NULL,
|
||||
contact_email VARCHAR(255) NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (hospital_id) REFERENCES hospitals(id)
|
||||
)";
|
||||
$pdo->exec($sql);
|
||||
} catch (PDOException $e) {
|
||||
die("Could not create table: " . $e->getMessage());
|
||||
}
|
||||
|
||||
$message = '';
|
||||
$error = '';
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$patient_name = trim($_POST['patient_name']);
|
||||
$patient_dob = trim($_POST['patient_dob']);
|
||||
$blood_type = trim($_POST['blood_type']);
|
||||
$organ_needed = trim($_POST['organ_needed']);
|
||||
$urgency_level = trim($_POST['urgency_level']);
|
||||
$contact_phone = trim($_POST['contact_phone']);
|
||||
$contact_email = trim($_POST['contact_email']);
|
||||
$hospital_id = $_SESSION['hospital_id'];
|
||||
|
||||
if (empty($patient_name) || empty($patient_dob) || empty($blood_type) || empty($organ_needed) || empty($urgency_level) || empty($contact_phone) || empty($contact_email)) {
|
||||
$error = "All fields are required.";
|
||||
} else {
|
||||
$sql = "INSERT INTO recipients (hospital_id, patient_name, patient_dob, blood_type, organ_needed, urgency_level, contact_phone, contact_email) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
$stmt = $pdo->prepare($sql);
|
||||
try {
|
||||
$stmt->execute([$hospital_id, $patient_name, $patient_dob, $blood_type, $organ_needed, $urgency_level, $contact_phone, $contact_email]);
|
||||
$message = "Recipient registered successfully!";
|
||||
} catch (PDOException $e) {
|
||||
$error = "Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Recipient Registration - Organ Donation</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Poppins', sans-serif;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="bg-gray-100">
|
||||
|
||||
<nav class="bg-white shadow-md">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div class="flex justify-between h-16">
|
||||
<div class="flex">
|
||||
<a href="hospital_dashboard.php" class="flex-shrink-0 flex items-center">
|
||||
<span class="font-bold text-xl text-blue-600">OrganConnect - Hospital Portal</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<a href="hospital_dashboard.php" class="px-3 py-2 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-200">Dashboard</a>
|
||||
<a href="logout.php" class="px-3 py-2 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-200">Logout</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container mx-auto px-4 py-12">
|
||||
<div class="max-w-2xl mx-auto bg-white p-8 rounded-lg shadow-lg">
|
||||
<h1 class="text-3xl font-bold text-center text-gray-800 mb-6">Register New Recipient</h1>
|
||||
|
||||
<?php if ($message): ?>
|
||||
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded relative mb-4" role="alert">
|
||||
<span class="block sm:inline"><?php echo htmlspecialchars($message); ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($error): ?>
|
||||
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative mb-4" role="alert">
|
||||
<span class="block sm:inline"><?php echo htmlspecialchars($error); ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!$message): ?>
|
||||
<form action="recipient_registration.php" method="POST" class="space-y-6">
|
||||
<div>
|
||||
<label for="patient_name" class="block text-sm font-medium text-gray-700">Patient Full Name</label>
|
||||
<input type="text" name="patient_name" id="patient_name" required class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
|
||||
</div>
|
||||
<div>
|
||||
<label for="patient_dob" class="block text-sm font-medium text-gray-700">Date of Birth</label>
|
||||
<input type="date" name="patient_dob" id="patient_dob" required class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
|
||||
</div>
|
||||
<div>
|
||||
<label for="blood_type" class="block text-sm font-medium text-gray-700">Blood Type</label>
|
||||
<select name="blood_type" id="blood_type" required class="mt-1 block w-full px-3 py-2 border border-gray-300 bg-white rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
|
||||
<option>A+</option>
|
||||
<option>A-</option>
|
||||
<option>B+</option>
|
||||
<option>B-</option>
|
||||
<option>AB+</option>
|
||||
<option>AB-</option>
|
||||
<option>O+</option>
|
||||
<option>O-</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label for="organ_needed" class="block text-sm font-medium text-gray-700">Organ Needed</label>
|
||||
<input type="text" name="organ_needed" id="organ_needed" required placeholder="e.g., Kidney, Liver, Heart" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
|
||||
</div>
|
||||
<div>
|
||||
<label for="urgency_level" class="block text-sm font-medium text-gray-700">Urgency Level</label>
|
||||
<select name="urgency_level" id="urgency_level" required class="mt-1 block w-full px-3 py-2 border border-gray-300 bg-white rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
|
||||
<option>High</option>
|
||||
<option>Medium</option>
|
||||
<option>Low</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label for="contact_phone" class="block text-sm font-medium text-gray-700">Emergency Contact Phone</label>
|
||||
<input type="tel" name="contact_phone" id="contact_phone" required class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
|
||||
</div>
|
||||
<div>
|
||||
<label for="contact_email" class="block text-sm font-medium text-gray-700">Emergency Contact Email</label>
|
||||
<input type="email" name="contact_email" id="contact_email" required class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm">
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" class="w-full flex justify-center py-3 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
|
||||
Register Recipient
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user