Compare commits
No commits in common. "ai-dev" and "master" have entirely different histories.
@ -1,204 +0,0 @@
|
|||||||
<?php
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
// Redirect to login if not logged in
|
|
||||||
if (!isset($_SESSION['admin_logged_in']) || $_SESSION['admin_logged_in'] !== true) {
|
|
||||||
header("Location: admin_login.php");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once 'db/config.php';
|
|
||||||
$pdo = db();
|
|
||||||
|
|
||||||
// Handle hospital status updates
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['hospital_id'])) {
|
|
||||||
$hospital_id = $_POST['hospital_id'];
|
|
||||||
$new_status = $_POST['status']; // 'approved' or 'rejected'
|
|
||||||
|
|
||||||
if (in_array($new_status, ['approved', 'rejected'])) {
|
|
||||||
$stmt = $pdo->prepare("UPDATE hospitals SET status = ? WHERE id = ?");
|
|
||||||
$stmt->execute([$new_status, $hospital_id]);
|
|
||||||
}
|
|
||||||
header("Location: admin_dashboard.php");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle donor status updates
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['donor_id'])) {
|
|
||||||
$donor_id = $_POST['donor_id'];
|
|
||||||
$new_status = $_POST['status']; // 'approved' or 'rejected'
|
|
||||||
|
|
||||||
if (in_array($new_status, ['approved', 'rejected'])) {
|
|
||||||
$stmt = $pdo->prepare("UPDATE donors SET status = ? WHERE id = ?");
|
|
||||||
$stmt->execute([$new_status, $donor_id]);
|
|
||||||
}
|
|
||||||
header("Location: admin_dashboard.php?tab=donors");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch pending hospitals
|
|
||||||
$stmt_hospitals = $pdo->prepare("SELECT * FROM hospitals WHERE status = 'pending_verification'");
|
|
||||||
$stmt_hospitals->execute();
|
|
||||||
$pending_hospitals = $stmt_hospitals->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
|
|
||||||
// Fetch all donors
|
|
||||||
$stmt_donors = $pdo->prepare("SELECT * FROM donors ORDER BY registration_date DESC");
|
|
||||||
$stmt_donors->execute();
|
|
||||||
$all_donors = $stmt_donors->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
|
|
||||||
// Fetch all recipients
|
|
||||||
$stmt_recipients = $pdo->prepare("SELECT r.*, h.hospital_name FROM recipients r JOIN hospitals h ON r.hospital_id = h.id ORDER BY r.registration_date DESC");
|
|
||||||
$stmt_recipients->execute();
|
|
||||||
$all_recipients = $stmt_recipients->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Admin Dashboard - Organ Donation</title>
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
||||||
<link rel="stylesheet" href="assets/css/custom.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
|
||||||
<div class="container">
|
|
||||||
<a class="navbar-brand" href="index.php">Organ Donation Admin</a>
|
|
||||||
<div class="collapse navbar-collapse">
|
|
||||||
<ul class="navbar-nav ms-auto">
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="admin_logout.php">Logout</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="container mt-5">
|
|
||||||
<h2 class="mb-4">Admin Dashboard</h2>
|
|
||||||
|
|
||||||
<ul class="nav nav-tabs" id="adminTab" role="tablist">
|
|
||||||
<li class="nav-item" role="presentation">
|
|
||||||
<button class="nav-link active" id="hospitals-tab" data-bs-toggle="tab" data-bs-target="#hospitals" type="button" role="tab">Pending Hospitals <span class="badge bg-danger"><?php echo count($pending_hospitals); ?></span></button>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item" role="presentation">
|
|
||||||
<button class="nav-link" id="donors-tab" data-bs-toggle="tab" data-bs-target="#donors" type="button" role="tab">Donors</button>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item" role="presentation">
|
|
||||||
<button class="nav-link" id="recipients-tab" data-bs-toggle="tab" data-bs-target="#recipients" type="button" role="tab">Recipients</button>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div class="tab-content" id="adminTabContent">
|
|
||||||
<!-- Hospitals Tab -->
|
|
||||||
<div class="tab-pane fade show active" id="hospitals" role="tabpanel">
|
|
||||||
<div class="card mt-3">
|
|
||||||
<div class="card-header"><h4>Pending Hospital Approvals</h4></div>
|
|
||||||
<div class="card-body">
|
|
||||||
<?php if (empty($pending_hospitals)): ?>
|
|
||||||
<p class="text-center">No pending hospital registrations.</p>
|
|
||||||
<?php else: ?>
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-striped table-hover">
|
|
||||||
<thead><tr><th>ID</th><th>Hospital Name</th><th>Email</th><th>Phone</th><th>Registered On</th><th>Action</th></tr></thead>
|
|
||||||
<tbody>
|
|
||||||
<?php foreach ($pending_hospitals as $hospital): ?>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo htmlspecialchars($hospital['id']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($hospital['hospital_name']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($hospital['email']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($hospital['phone']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($hospital['registration_date']); ?></td>
|
|
||||||
<td>
|
|
||||||
<form action="admin_dashboard.php" method="POST" class="d-inline-block"><input type="hidden" name="hospital_id" value="<?php echo $hospital['id']; ?>"><input type="hidden" name="status" value="approved"><button type="submit" class="btn btn-success btn-sm">Approve</button></form>
|
|
||||||
<form action="admin_dashboard.php" method="POST" class="d-inline-block"><input type="hidden" name="hospital_id" value="<?php echo $hospital['id']; ?>"><input type="hidden" name="status" value="rejected"><button type="submit" class="btn btn-danger btn-sm">Reject</button></form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Donors Tab -->
|
|
||||||
<div class="tab-pane fade" id="donors" role="tabpanel">
|
|
||||||
<div class="card mt-3">
|
|
||||||
<div class="card-header"><h4>Donor Management</h4></div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-striped table-hover">
|
|
||||||
<thead><tr><th>ID</th><th>Name</th><th>Email</th><th>Blood Type</th><th>Organs</th><th>Status</th><th>Action</th></tr></thead>
|
|
||||||
<tbody>
|
|
||||||
<?php foreach ($all_donors as $donor): ?>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo htmlspecialchars($donor['id']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($donor['full_name']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($donor['email']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($donor['blood_type']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($donor['organs_to_donate']); ?></td>
|
|
||||||
<td><span class="badge bg-<?php echo $donor['status'] == 'approved' ? 'success' : ($donor['status'] == 'pending_verification' ? 'warning' : 'danger'); ?>"><?php echo htmlspecialchars($donor['status']); ?></span></td>
|
|
||||||
<td>
|
|
||||||
<?php if ($donor['status'] == 'pending_verification'): ?>
|
|
||||||
<form action="admin_dashboard.php" method="POST" class="d-inline-block"><input type="hidden" name="donor_id" value="<?php echo $donor['id']; ?>"><input type="hidden" name="status" value="approved"><button type="submit" class="btn btn-success btn-sm">Approve</button></form>
|
|
||||||
<form action="admin_dashboard.php" method="POST" class="d-inline-block"><input type="hidden" name="donor_id" value="<?php echo $donor['id']; ?>"><input type="hidden" name="status" value="rejected"><button type="submit" class="btn btn-danger btn-sm">Reject</button></form>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Recipients Tab -->
|
|
||||||
<div class="tab-pane fade" id="recipients" role="tabpanel">
|
|
||||||
<div class="card mt-3">
|
|
||||||
<div class="card-header"><h4>Registered Recipients</h4></div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-striped table-hover">
|
|
||||||
<thead><tr><th>ID</th><th>Name</th><th>Blood Type</th><th>Organ Needed</th><th>Registered By</th><th>Date</th></tr></thead>
|
|
||||||
<tbody>
|
|
||||||
<?php foreach ($all_recipients as $recipient): ?>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo htmlspecialchars($recipient['id']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($recipient['full_name']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($recipient['blood_type']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($recipient['organ_needed']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($recipient['hospital_name']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($recipient['registration_date']); ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
|
||||||
<script>
|
|
||||||
// Preserve tab state across page reloads
|
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
|
||||||
var urlParams = new URLSearchParams(window.location.search);
|
|
||||||
var tab = urlParams.get('tab');
|
|
||||||
if (tab) {
|
|
||||||
var tabEl = document.querySelector('#' + tab + '-tab');
|
|
||||||
if(tabEl) {
|
|
||||||
var tabInstance = new bootstrap.Tab(tabEl);
|
|
||||||
tabInstance.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -1,91 +0,0 @@
|
|||||||
<?php
|
|
||||||
session_start();
|
|
||||||
require_once 'db/config.php';
|
|
||||||
|
|
||||||
$error = '';
|
|
||||||
|
|
||||||
// Hardcoded admin credentials for simplicity.
|
|
||||||
// In a real application, these should be stored securely and hashed.
|
|
||||||
define('ADMIN_USER', 'admin');
|
|
||||||
define('ADMIN_PASS', 'password');
|
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
||||||
$username = $_POST['username'];
|
|
||||||
$password = $_POST['password'];
|
|
||||||
|
|
||||||
if ($username === ADMIN_USER && $password === ADMIN_PASS) {
|
|
||||||
$_SESSION['admin_logged_in'] = true;
|
|
||||||
header("Location: admin_dashboard.php");
|
|
||||||
exit;
|
|
||||||
} else {
|
|
||||||
$error = "Invalid username or password.";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Admin Login - Organ Donation</title>
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
||||||
<link rel="stylesheet" href="assets/css/custom.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
|
||||||
<div class="container">
|
|
||||||
<a class="navbar-brand" href="index.php">Organ Donation</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="index.php">Home</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="donor_register.php">Donor Registration</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="hospital_login.php">Hospital Login</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="container mt-5">
|
|
||||||
<div class="row justify-content-center">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3>Admin Login</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<?php if ($error): ?>
|
|
||||||
<div class="alert alert-danger"><?php echo $error; ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<form action="admin_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>
|
|
||||||
<button type="submit" class="btn btn-primary w-100">Login</button>
|
|
||||||
</form>
|
|
||||||
<div class="mt-3 text-center">
|
|
||||||
<small class="text-muted">Default credentials: admin / password</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
// Unset all session variables
|
|
||||||
$_SESSION = [];
|
|
||||||
|
|
||||||
// Destroy the session
|
|
||||||
session_destroy();
|
|
||||||
|
|
||||||
// Redirect to the admin login page
|
|
||||||
header("Location: admin_login.php");
|
|
||||||
exit;
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
body {
|
|
||||||
font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hero {
|
|
||||||
background: linear-gradient(to bottom, #e3f2fd, #ffffff);
|
|
||||||
padding: 4rem 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer {
|
|
||||||
background-color: #f8f9fa;
|
|
||||||
padding: 2rem 0;
|
|
||||||
margin-top: 4rem;
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
// Custom javascript can be added here.
|
|
||||||
@ -1,175 +0,0 @@
|
|||||||
<?php
|
|
||||||
require_once 'db/config.php';
|
|
||||||
|
|
||||||
$success_message = '';
|
|
||||||
$error_message = '';
|
|
||||||
|
|
||||||
try {
|
|
||||||
$pdo = db();
|
|
||||||
// Idempotent table creation
|
|
||||||
$pdo->exec("CREATE TABLE IF NOT EXISTS donors (
|
|
||||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
full_name VARCHAR(255) NOT NULL,
|
|
||||||
email VARCHAR(255) NOT NULL UNIQUE,
|
|
||||||
phone VARCHAR(50),
|
|
||||||
blood_type VARCHAR(10),
|
|
||||||
organs_to_donate TEXT,
|
|
||||||
registration_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
status VARCHAR(50) DEFAULT 'pending_verification'
|
|
||||||
)");
|
|
||||||
} catch (PDOException $e) {
|
|
||||||
$error_message = "Database error: " . $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
||||||
$full_name = trim($_POST['full_name']);
|
|
||||||
$email = trim($_POST['email']);
|
|
||||||
$phone = trim($_POST['phone']);
|
|
||||||
$blood_type = $_POST['blood_type'];
|
|
||||||
$organs = isset($_POST['organs']) ? implode(', ', $_POST['organs']) : '';
|
|
||||||
|
|
||||||
if (empty($full_name) || empty($email) || empty($blood_type) || empty($organs)) {
|
|
||||||
$error_message = "Please fill all required fields.";
|
|
||||||
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
|
||||||
$error_message = "Invalid email format.";
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
$stmt = $pdo->prepare("INSERT INTO donors (full_name, email, phone, blood_type, organs_to_donate) VALUES (?, ?, ?, ?, ?)");
|
|
||||||
$stmt->execute([$full_name, $email, $phone, $blood_type, $organs]);
|
|
||||||
$success_message = "Thank you for registering as a donor! Your registration is pending verification.";
|
|
||||||
} catch (PDOException $e) {
|
|
||||||
if ($e->getCode() == 23000) { // Integrity constraint violation (e.g., duplicate email)
|
|
||||||
$error_message = "This email address is already registered.";
|
|
||||||
} else {
|
|
||||||
$error_message = "There was an error with your registration. Please try again.";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Donor Registration - Organ Donation Management</title>
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
||||||
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
|
||||||
<div class="container">
|
|
||||||
<a class="navbar-brand" href="index.php">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="index.php">Home</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link active" aria-current="page" href="donor_register.php">Become a Donor</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="hospital_register.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="container my-5">
|
|
||||||
<div class="row justify-content-center">
|
|
||||||
<div class="col-lg-8">
|
|
||||||
<h2 class="mb-4 text-center">Become a Life Saver: Register as a Donor</h2>
|
|
||||||
|
|
||||||
<?php if ($success_message): ?>
|
|
||||||
<div class="alert alert-success"><?php echo $success_message; ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if ($error_message): ?>
|
|
||||||
<div class="alert alert-danger"><?php echo $error_message; ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if (!$success_message): ?>
|
|
||||||
<form action="donor_register.php" method="POST">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="full_name" class="form-label">Full Name</label>
|
|
||||||
<input type="text" class="form-control" id="full_name" name="full_name" required>
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="email" class="form-label">Email Address</label>
|
|
||||||
<input type="email" class="form-control" id="email" name="email" required>
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="phone" class="form-label">Phone Number</label>
|
|
||||||
<input type="tel" class="form-control" id="phone" name="phone">
|
|
||||||
</div>
|
|
||||||
<div class="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="" selected disabled>Select your blood type</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="mb-3">
|
|
||||||
<label class="form-label">Which organs would you like to donate?</label>
|
|
||||||
<div class="form-check">
|
|
||||||
<input class="form-check-input" type="checkbox" value="Heart" id="organ_heart" name="organs[]">
|
|
||||||
<label class="form-check-label" for="organ_heart">Heart</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-check">
|
|
||||||
<input class="form-check-input" type="checkbox" value="Lungs" id="organ_lungs" name="organs[]">
|
|
||||||
<label class="form-check-label" for="organ_lungs">Lungs</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-check">
|
|
||||||
<input class="form-check-input" type="checkbox" value="Kidneys" id="organ_kidneys" name="organs[]">
|
|
||||||
<label class="form-check-label" for="organ_kidneys">Kidneys</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-check">
|
|
||||||
<input class="form-check-input" type="checkbox" value="Liver" id="organ_liver" name="organs[]">
|
|
||||||
<label class="form-check-label" for="organ_liver">Liver</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-check">
|
|
||||||
<input class="form-check-input" type="checkbox" value="Pancreas" id="organ_pancreas" name="organs[]">
|
|
||||||
<label class="form-check-label" for="organ_pancreas">Pancreas</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="d-grid">
|
|
||||||
<button type="submit" class="btn btn-primary btn-lg">Register Now</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<footer class="footer text-center">
|
|
||||||
<div class="container">
|
|
||||||
<p class="mb-0">© <?php echo date("Y"); ?> Organ Donation Management System. All Rights Reserved.</p>
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
||||||
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -1,221 +0,0 @@
|
|||||||
<?php
|
|
||||||
session_start();
|
|
||||||
require_once 'db/config.php';
|
|
||||||
|
|
||||||
// If not logged in, redirect to login page
|
|
||||||
if (!isset($_SESSION['hospital_id'])) {
|
|
||||||
header("Location: hospital_login.php");
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$hospital_id = $_SESSION['hospital_id'];
|
|
||||||
$pdo = db();
|
|
||||||
|
|
||||||
// Fetch hospital status
|
|
||||||
$stmt = $pdo->prepare("SELECT status FROM hospitals WHERE id = ?");
|
|
||||||
$stmt->execute([$hospital_id]);
|
|
||||||
$hospital = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
||||||
$hospital_status = $hospital['status'] ?? 'pending_verification';
|
|
||||||
|
|
||||||
$success_message = '';
|
|
||||||
$error_message = '';
|
|
||||||
|
|
||||||
// Table creation and form processing only if hospital is approved
|
|
||||||
if ($hospital_status === 'approved') {
|
|
||||||
try {
|
|
||||||
// Idempotent table creation for recipients
|
|
||||||
$pdo->exec("CREATE TABLE IF NOT EXISTS recipients (
|
|
||||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
hospital_id INT NOT NULL,
|
|
||||||
full_name VARCHAR(255) NOT NULL,
|
|
||||||
email VARCHAR(255) NOT NULL,
|
|
||||||
phone VARCHAR(50),
|
|
||||||
blood_type VARCHAR(10) NOT NULL,
|
|
||||||
organ_needed VARCHAR(100) NOT NULL,
|
|
||||||
urgency_level VARCHAR(50) NOT NULL,
|
|
||||||
registration_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
status VARCHAR(50) DEFAULT 'waiting', /* e.g., waiting, matched, transplanted */
|
|
||||||
FOREIGN KEY (hospital_id) REFERENCES hospitals(id)
|
|
||||||
)");
|
|
||||||
} catch (PDOException $e) {
|
|
||||||
$error_message = "Database error: " . $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle new recipient registration
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['register_recipient'])) {
|
|
||||||
$full_name = trim($_POST['full_name']);
|
|
||||||
$email = trim($_POST['email']);
|
|
||||||
$phone = trim($_POST['phone']);
|
|
||||||
$blood_type = $_POST['blood_type'];
|
|
||||||
$organ_needed = $_POST['organ_needed'];
|
|
||||||
$urgency_level = $_POST['urgency_level'];
|
|
||||||
|
|
||||||
if (empty($full_name) || empty($email) || empty($blood_type) || empty($organ_needed) || empty($urgency_level)) {
|
|
||||||
$error_message = "Please fill all required fields.";
|
|
||||||
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
|
||||||
$error_message = "Invalid email format.";
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
$stmt = $pdo->prepare("INSERT INTO recipients (hospital_id, full_name, email, phone, blood_type, organ_needed, urgency_level) VALUES (?, ?, ?, ?, ?, ?, ?)");
|
|
||||||
$stmt->execute([$hospital_id, $full_name, $email, $phone, $blood_type, $organ_needed, $urgency_level]);
|
|
||||||
$success_message = "Recipient registered successfully!";
|
|
||||||
} catch (PDOException $e) {
|
|
||||||
$error_message = "Error registering recipient. Please try again.";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch this hospital's registered recipients
|
|
||||||
$recipients = [];
|
|
||||||
if ($hospital_status === 'approved') {
|
|
||||||
$stmt = $pdo->prepare("SELECT * FROM recipients WHERE hospital_id = ? ORDER BY registration_date DESC");
|
|
||||||
$stmt->execute([$hospital_id]);
|
|
||||||
$recipients = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Logout logic
|
|
||||||
if (isset($_GET['logout'])) {
|
|
||||||
session_destroy();
|
|
||||||
header("Location: index.php");
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Hospital Dashboard</title>
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
||||||
<link rel="stylesheet" href="assets/css/custom.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<a class="navbar-brand" href="hospital_dashboard.php">Hospital Dashboard</a>
|
|
||||||
<ul class="navbar-nav ms-auto">
|
|
||||||
<li class="nav-item">
|
|
||||||
<span class="navbar-text me-3">Welcome, <?php echo htmlspecialchars($_SESSION['hospital_name']); ?></span>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link btn btn-light text-primary" href="?logout=true">Logout</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="container mt-5">
|
|
||||||
|
|
||||||
<?php if ($hospital_status === 'pending_verification'): ?>
|
|
||||||
<div class="alert alert-warning text-center">
|
|
||||||
<h4 class="alert-heading">Account Pending Approval</h4>
|
|
||||||
<p>Your hospital registration is currently under review by our administrators. You will be able to register recipients once your account is approved.</p>
|
|
||||||
</div>
|
|
||||||
<?php elseif ($hospital_status === 'rejected'): ?>
|
|
||||||
<div class="alert alert-danger text-center">
|
|
||||||
<h4 class="alert-heading">Account Registration Rejected</h4>
|
|
||||||
<p>Your hospital registration was not approved. Please contact an administrator for more information.</p>
|
|
||||||
</div>
|
|
||||||
<?php else: // Approved ?>
|
|
||||||
|
|
||||||
<?php if ($success_message): ?><div class="alert alert-success"><?php echo $success_message; ?></div><?php endif; ?>
|
|
||||||
<?php if ($error_message): ?><div class="alert alert-danger"><?php echo $error_message; ?></div><?php endif; ?>
|
|
||||||
|
|
||||||
<!-- Recipient Registration Form -->
|
|
||||||
<div class="card mb-5">
|
|
||||||
<div class="card-header">
|
|
||||||
<h4>Register a New Recipient</h4>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<form action="hospital_dashboard.php" method="POST">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6 mb-3">
|
|
||||||
<label for="full_name" class="form-label">Full Name</label>
|
|
||||||
<input type="text" class="form-control" id="full_name" name="full_name" required>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6 mb-3">
|
|
||||||
<label for="email" class="form-label">Email</label>
|
|
||||||
<input type="email" class="form-control" id="email" name="email" required>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6 mb-3">
|
|
||||||
<label for="phone" class="form-label">Phone</label>
|
|
||||||
<input type="tel" class="form-control" id="phone" name="phone">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6 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="" disabled selected>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-6 mb-3">
|
|
||||||
<label for="organ_needed" class="form-label">Organ Needed</label>
|
|
||||||
<select class="form-select" id="organ_needed" name="organ_needed" required>
|
|
||||||
<option value="" disabled selected>Select...</option>
|
|
||||||
<option value="Heart">Heart</option><option value="Lungs">Lungs</option><option value="Kidneys">Kidneys</option>
|
|
||||||
<option value="Liver">Liver</option><option value="Pancreas">Pancreas</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6 mb-3">
|
|
||||||
<label for="urgency_level" class="form-label">Urgency Level</label>
|
|
||||||
<select class="form-select" id="urgency_level" name="urgency_level" required>
|
|
||||||
<option value="" disabled selected>Select...</option>
|
|
||||||
<option value="Critical">Critical</option><option value="High">High</option>
|
|
||||||
<option value="Medium">Medium</option><option value="Low">Low</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<button type="submit" name="register_recipient" class="btn btn-primary">Register Recipient</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Registered Recipients List -->
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h4>Your Registered Recipients</h4>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<?php if (empty($recipients)): ?>
|
|
||||||
<p class="text-center">You have not registered any recipients yet.</p>
|
|
||||||
<?php else: ?>
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Name</th><th>Email</th><th>Blood Type</th><th>Organ Needed</th><th>Urgency</th><th>Status</th><th>Date</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php foreach ($recipients as $recipient): ?>
|
|
||||||
<tr>
|
|
||||||
<td><?php echo htmlspecialchars($recipient['full_name']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($recipient['email']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($recipient['blood_type']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($recipient['organ_needed']); ?></td>
|
|
||||||
<td><?php echo htmlspecialchars($recipient['urgency_level']); ?></td>
|
|
||||||
<td><span class="badge bg-secondary"><?php echo htmlspecialchars($recipient['status']); ?></span></td>
|
|
||||||
<td><?php echo date('Y-m-d', strtotime($recipient['registration_date'])); ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php endif; // End approved status check ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<footer class="bg-dark text-white text-center p-3 mt-5">
|
|
||||||
<p>© <?php echo date("Y"); ?> Organ Donation Management System. All Rights Reserved.</p>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -1,119 +0,0 @@
|
|||||||
<?php
|
|
||||||
session_start();
|
|
||||||
require_once 'db/config.php';
|
|
||||||
|
|
||||||
$message = '';
|
|
||||||
|
|
||||||
// If already logged in, redirect to dashboard
|
|
||||||
if (isset($_SESSION['hospital_id'])) {
|
|
||||||
header("Location: hospital_dashboard.php");
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
||||||
$email = trim($_POST['email']);
|
|
||||||
$password = $_POST['password'];
|
|
||||||
|
|
||||||
if (empty($email) || empty($password)) {
|
|
||||||
$message = '<div class="alert alert-danger">Please enter both email and password.</div>';
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
$pdo = db();
|
|
||||||
$stmt = $pdo->prepare("SELECT * FROM hospitals WHERE email = ?");
|
|
||||||
$stmt->execute([$email]);
|
|
||||||
$hospital = $stmt->fetch();
|
|
||||||
|
|
||||||
if ($hospital && password_verify($password, $hospital['password'])) {
|
|
||||||
if ($hospital['status'] == 'verified') {
|
|
||||||
$_SESSION['hospital_id'] = $hospital['id'];
|
|
||||||
$_SESSION['hospital_name'] = $hospital['hospital_name'];
|
|
||||||
header("Location: hospital_dashboard.php");
|
|
||||||
exit();
|
|
||||||
} else {
|
|
||||||
$message = '<div class="alert alert-warning">Your account is pending verification by the administrator.</div>';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$message = '<div class="alert alert-danger">Invalid email or password.</div>';
|
|
||||||
}
|
|
||||||
} catch (PDOException $e) {
|
|
||||||
$message = '<div class="alert alert-danger">Error: ' . $e->getMessage() . '</div>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<!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 Management System</title>
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
||||||
<link rel="stylesheet" href="assets/css/custom.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<a class="navbar-brand" href="index.php">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="index.php">Home</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="donor_register.php">Become a Donor</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="hospital_register.php">Hospital Registration</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link btn btn-primary text-white" 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="container mt-5">
|
|
||||||
<div class="row justify-content-center">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h2>Hospital Login</h2>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<?php if (!empty($message)) echo $message; ?>
|
|
||||||
<form action="hospital_login.php" method="post">
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="email" class="form-label">Email address</label>
|
|
||||||
<input type="email" class="form-control" id="email" name="email" 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>
|
|
||||||
<button type="submit" class="btn btn-primary w-100">Login</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<div class="card-footer text-center">
|
|
||||||
<p class="mb-0">Don't have an account? <a href="hospital_register.php">Register here</a></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<footer class="bg-dark text-white text-center p-3 mt-5">
|
|
||||||
<p>© 2025 Organ Donation Management System. All Rights Reserved.</p>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
||||||
<script src="assets/js/main.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -1,140 +0,0 @@
|
|||||||
<?php
|
|
||||||
session_start();
|
|
||||||
require_once 'db/config.php';
|
|
||||||
|
|
||||||
$message = '';
|
|
||||||
|
|
||||||
// Create hospitals table if it doesn't exist
|
|
||||||
try {
|
|
||||||
$pdo = db();
|
|
||||||
$sql = "CREATE TABLE IF NOT EXISTS hospitals (
|
|
||||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
hospital_name VARCHAR(255) NOT NULL,
|
|
||||||
email VARCHAR(255) NOT NULL UNIQUE,
|
|
||||||
password VARCHAR(255) NOT NULL,
|
|
||||||
phone VARCHAR(50),
|
|
||||||
address TEXT,
|
|
||||||
registration_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
status VARCHAR(50) DEFAULT 'pending_verification'
|
|
||||||
)";
|
|
||||||
$pdo->exec($sql);
|
|
||||||
} catch (PDOException $e) {
|
|
||||||
die("Could not create table: " . $e->getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
||||||
$hospital_name = trim($_POST['hospital_name']);
|
|
||||||
$email = trim($_POST['email']);
|
|
||||||
$password = $_POST['password'];
|
|
||||||
$phone = trim($_POST['phone']);
|
|
||||||
$address = trim($_POST['address']);
|
|
||||||
|
|
||||||
if (empty($hospital_name) || empty($email) || empty($password)) {
|
|
||||||
$message = '<div class="alert alert-danger">Please fill in all required fields.</div>';
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
$pdo = db();
|
|
||||||
// Check if email already exists
|
|
||||||
$stmt = $pdo->prepare("SELECT id FROM hospitals WHERE email = ?");
|
|
||||||
$stmt->execute([$email]);
|
|
||||||
if ($stmt->fetch()) {
|
|
||||||
$message = '<div class="alert alert-danger">This email address is already registered.</div>';
|
|
||||||
} else {
|
|
||||||
// Hash the password
|
|
||||||
$hashed_password = password_hash($password, PASSWORD_DEFAULT);
|
|
||||||
|
|
||||||
$sql = "INSERT INTO hospitals (hospital_name, email, password, phone, address) VALUES (?, ?, ?, ?, ?)";
|
|
||||||
$stmt = $pdo->prepare($sql);
|
|
||||||
$stmt->execute([$hospital_name, $email, $hashed_password, $phone, $address]);
|
|
||||||
$message = '<div class="alert alert-success">Hospital registered successfully! You will be able to log in once the admin verifies your account.</div>';
|
|
||||||
}
|
|
||||||
} catch (PDOException $e) {
|
|
||||||
$message = '<div class="alert alert-danger">Error: ' . $e->getMessage() . '</div>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<!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 Management System</title>
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
||||||
<link rel="stylesheet" href="assets/css/custom.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<a class="navbar-brand" href="index.php">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="index.php">Home</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="donor_register.php">Become a Donor</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link btn btn-primary text-white" href="hospital_register.php">Hospital Registration</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="hospital_login.php">Hospital Login</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div class="container mt-5">
|
|
||||||
<div class="row justify-content-center">
|
|
||||||
<div class="col-md-8">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h2>Hospital Registration</h2>
|
|
||||||
<p>Register your hospital to manage recipient information.</p>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<?php if (!empty($message)) echo $message; ?>
|
|
||||||
<form action="hospital_register.php" method="post">
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="hospital_name" class="form-label">Hospital Name</label>
|
|
||||||
<input type="text" class="form-control" id="hospital_name" name="hospital_name" required>
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="email" class="form-label">Email address</label>
|
|
||||||
<input type="email" class="form-control" id="email" name="email" 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="mb-3">
|
|
||||||
<label for="phone" class="form-label">Phone Number</label>
|
|
||||||
<input type="tel" class="form-control" id="phone" name="phone">
|
|
||||||
</div>
|
|
||||||
<div class="mb-3">
|
|
||||||
<label for="address" class="form-label">Address</label>
|
|
||||||
<textarea class="form-control" id="address" name="address" rows="3"></textarea>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button type="submit" class="btn btn-primary">Register</button>iv>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<footer class="bg-dark text-white text-center p-3 mt-5">
|
|
||||||
<p>© 2025 Organ Donation Management System. All Rights Reserved.</p>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
||||||
<script src="assets/js/main.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
217
index.php
217
index.php
@ -1,91 +1,150 @@
|
|||||||
<?php
|
<?php
|
||||||
// Read project preview data from environment
|
declare(strict_types=1);
|
||||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'An Organ Donation Management System to connect donors, hospitals, and recipients.';
|
@ini_set('display_errors', '1');
|
||||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
@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">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<title>Organ Donation Management System</title>
|
<title>New Style</title>
|
||||||
<meta name="description" content="<?= htmlspecialchars($projectDescription) ?>">
|
<?php
|
||||||
<?php if ($projectImageUrl): ?>
|
// 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) ?>" />
|
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||||
|
<!-- Twitter image -->
|
||||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
<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>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<main>
|
||||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
<div class="card">
|
||||||
<div class="container">
|
<h1>Analyzing your requirements and generating your website…</h1>
|
||||||
<a class="navbar-brand" href="index.php">OrganDonation</a>
|
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
||||||
<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="sr-only">Loading…</span>
|
||||||
<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 active" aria-current="page" href="index.php">Home</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="donor_register.php">Become a Donor</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="hospital_register.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>
|
||||||
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</main>
|
||||||
|
<footer>
|
||||||
<header class="hero text-center">
|
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
||||||
<div class="container">
|
</footer>
|
||||||
<h1 class="display-4">Give the Gift of Life</h1>
|
|
||||||
<p class="lead">Join our community of organ donors and help save lives. Your decision can make a world of difference.</p>
|
|
||||||
<a href="donor_register.php" class="btn btn-primary btn-lg">Register as a Donor Today</a>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<main class="container my-5">
|
|
||||||
<section class="text-center">
|
|
||||||
<h2 class="mb-5">How It Works</h2>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4">
|
|
||||||
<i class="bi bi-person-plus-fill fs-1 text-primary"></i>
|
|
||||||
<h3 class="mt-3">Register</h3>
|
|
||||||
<p>Quickly sign up as a donor through our simple registration form.</p>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<i class="bi bi-patch-check-fill fs-1 text-primary"></i>
|
|
||||||
<h3 class="mt-3">Verification</h3>
|
|
||||||
<p>Our team verifies your information to ensure validity and eligibility.</p>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<i class="bi bi-heart-pulse-fill fs-1 text-primary"></i>
|
|
||||||
<h3 class="mt-3">Save a Life</h3>
|
|
||||||
<p>Once matched, you will be contacted to begin the life-saving process.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<footer class="footer text-center">
|
|
||||||
<div class="container">
|
|
||||||
<p class="mb-0">© <?php echo date("Y"); ?> Organ Donation Management System. All Rights Reserved.</p>
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
||||||
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user