1.db.php
<?php
$conn = new mysqli("localhost","root","","campus_hub");
if($conn->connect_error){
die("Connection failed");
}
?>
2.protect.php
<?php
session_start();
if(!isset($_SESSION['user_id'])){
header("Location: login.php");
exit();
}
?>
3.header.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Campus Service Hub</title>
<style>
body {
margin: 0;
font-family: Arial, sans-serif;
background-color: #f8f9fa;
}
/* NAVBAR */
.navbar {
background-color: #222;
color: white;
padding: 15px 20px;
display: flex;
justify-content: space-between;
align-items: center;
}
.navbar a {
color: white;
text-decoration: none;
margin-left: 15px;
}
.navbar a:hover {
text-decoration: underline;
}
.navbar-brand {
font-weight: bold;
font-size: 18px;
}
.nav-left, .nav-right {
display: flex;
align-items: center;
}
.badge {
padding: 3px 8px;
border-radius: 10px;
font-size: 12px;
margin-left: 5px;
}
.admin {
background-color: red;
}
.user {
background-color: blue;
}
.logout {
color: red;
font-weight: bold;
}
/* CONTAINER */
.container {
padding: 20px;
}
</style>
</head>
<body>
<div class="navbar">
<div class="nav-left">
<span class="navbar-brand">Service Hub</span>
<?php if(isset($_SESSION['role'])): ?>
<span style="margin-left:20px;">
ID: <?php echo $_SESSION['user_id']; ?>
<span class="badge <?php echo ($_SESSION['role'] == 'admin') ? 'admin' : 'user'; ?>">
<?php echo strtoupper($_SESSION['role']); ?>
</span>
</span>
<?php endif; ?>
</div>
<div class="nav-right">
<a href="dashboard.php">Dashboard</a>
<a href="add_services.php">Add Service</a>
<a href="search.php">Search</a>
<a href="logout.php" class="logout">Logout</a>
</div>
</div>
<div class="container">
4.footer
</div>
<footer class="footer">
<small>© 2026 Campus Service Hub - Politeknik Balik Pulau</small>
</footer>
<style>
.footer {
text-align: center;
color: #777;
padding: 20px;
margin-top: 40px;
font-size: 14px;
}
</style>
</body>
</html>
6.login.php
<?php
session_start();
include 'db.php';
include 'header.php';
if(isset($_POST['login'])){
$email = $_POST['email'];
$password = $_POST['password'];
$stmt = $conn->prepare("SELECT * FROM users WHERE email=?");
$stmt->bind_param("s",$email);
$stmt->execute();
$result = $stmt->get_result();
if($row = $result->fetch_assoc()){
if(password_verify($password, $row['password'])){
$_SESSION['user_id'] = $row['id'];
$_SESSION['name'] = $row['name'];
$_SESSION['role'] = $row['role'];
header("Location: dashboard.php");
exit();
} else {
echo "<div class='alert'>Wrong password!</div>";
}
} else {
echo "<div class='alert'>User not found!</div>";
}
}
?>
<style>
/* CENTER FORM */
.login-container {
display: flex;
justify-content: center;
margin-top: 60px;
}
/* CARD STYLE */
.login-box {
width: 350px;
background: white;
padding: 30px;
border-radius: 12px;
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
/* TITLE */
.login-box h3 {
text-align: center;
margin-bottom: 25px;
}
/* INPUT */
.login-box input {
width: 100%;
padding: 10px;
margin-top: 5px;
margin-bottom: 15px;
border-radius: 8px;
border: 1px solid #ccc;
}
/* BUTTON */
.login-box button {
width: 100%;
padding: 10px;
background: #007bff;
color: white;
border: none;
border-radius: 8px;
font-weight: bold;
cursor: pointer;
}
.login-box button:hover {
background: #0056b3;
}
/* TEXT */
.login-box p {
text-align: center;
font-size: 14px;
}
/* ALERT */
.alert {
background: #ffdddd;
color: red;
padding: 10px;
margin: 10px auto;
width: 350px;
border-radius: 8px;
text-align: center;
}
</style>
<div class="login-container">
<div class="login-box">
<h3>Welcome Back</h3>
<form method="POST">
<label>Email Address</label>
<input type="email" name="email" placeholder="[email protected]" required>
<label>Password</label>
<input type="password" name="password" required>
<button name="login">Login</button>
</form>
<p>Don't have an account? <a href="register.php">Register</a></p>
</div>
</div>
<?php include 'footer.php'; ?>
7.register.php
<?php
include 'db.php';
include 'header.php';
if(isset($_POST['register'])){
$name = htmlspecialchars($_POST['name']);
$email = htmlspecialchars($_POST['email']);
$pass = password_hash($_POST['password'], PASSWORD_DEFAULT);
$stmt = $conn->prepare("INSERT INTO users(name,email,password) VALUES (?,?,?)");
$stmt->bind_param("sss", $name, $email, $pass);
if($stmt->execute()){
echo "<div class='alert success'>Registration successful! <a href='login.php'>Login here</a></div>";
} else {
echo "<div class='alert error'>Error: Something went wrong.</div>";
}
}
?>
<style>
.register-container {
display: flex;
justify-content: center;
margin-top: 60px;
}
/* BOX */
.register-box {
width: 400px;
background: white;
padding: 30px;
border-radius: 12px;
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
/* TITLE */
.register-box h2 {
text-align: center;
margin-bottom: 10px;
}
.register-box p {
text-align: center;
color: #777;
margin-bottom: 25px;
}
/* INPUT */
.register-box input {
width: 100%;
padding: 10px;
margin-top: 5px;
margin-bottom: 15px;
border-radius: 8px;
border: 1px solid #ccc;
}
/* LABEL */
.register-box label {
font-weight: bold;
}
/* BUTTON */
.register-box button {
width: 100%;
padding: 12px;
background: #28a745;
color: white;
border: none;
border-radius: 8px;
font-weight: bold;
cursor: pointer;
}
.register-box button:hover {
background: #218838;
}
/* ALERT */
.alert {
width: 400px;
margin: 10px auto;
padding: 12px;
border-radius: 8px;
text-align: center;
}
.success {
background: #d4edda;
color: #155724;
}
.error {
background: #f8d7da;
color: #721c24;
}
/* LINK */
.link {
text-align: center;
margin-top: 20px;
}
</style>
<div class="register-container">
<div class="register-box">
<h2>Create Account</h2>
<p>Join the Campus Service community</p>
<form method="POST">
<label>Full Name</label>
<input name="name" required>
<label>Email Address</label>
<input type="email" name="email" placeholder="[email protected]" required>
<label>Password</label>
<input type="password" name="password" placeholder="Min. 8 characters" required>
<button name="register">Register Now</button>
</form>
<div class="link">
<p>Already have an account?</p>
<a href="login.php"><b>Login to your account</b></a>
</div>
</div>
</div>
<?php include 'footer.php'; ?>
8.dashboard.php
<?php
include 'protect.php';
include 'db.php';
include 'header.php';
$result = $conn->query("SELECT services.*, users.name FROM services JOIN users ON services.user_id = users.id");
?>
<style>
/* HEADER */
.top-bar {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.top-bar h2 {
margin: 0;
}
/* GRID */
.services-container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 20px;
}
/* CARD */
.service-card {
background: #fff;
border-radius: 12px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
overflow: hidden;
display: flex;
flex-direction: column;
}
/* IMAGE */
.service-card img {
width: 100%;
height: 200px;
object-fit: cover;
}
/* BODY */
.service-body {
padding: 15px;
}
.service-title {
font-weight: bold;
margin-bottom: 10px;
}
.price {
display: inline-block;
background: #28a745;
color: white;
padding: 5px 10px;
border-radius: 8px;
margin-bottom: 10px;
font-size: 14px;
}
.desc {
color: #666;
font-size: 14px;
}
/* FOOTER */
.service-footer {
margin-top: 10px;
font-size: 13px;
}
/* BUTTON */
.btn {
display: inline-block;
padding: 6px 12px;
border-radius: 6px;
text-decoration: none;
font-size: 13px;
margin-right: 5px;
}
.btn-warning {
background: orange;
color: white;
}
.btn-danger {
border: 1px solid red;
color: red;
}
/* BUTTON HOVER */
.btn-warning:hover {
background: darkorange;
}
.btn-danger:hover {
background: red;
color: white;
}
</style>
<div class="top-bar">
<h2>Available Services</h2>
</div>
<div class="services-container">
<?php while($row = $result->fetch_assoc()){ ?>
<div class="service-card">
<img src="uploads/<?php echo $row['image']; ?>">
<div class="service-body">
<div class="service-title"><?php echo htmlspecialchars($row['title']); ?></div>
<div class="price">RM <?php echo number_format($row['price'], 2); ?></div>
<div class="desc"><?php echo htmlspecialchars($row['description']); ?></div>
<div class="service-footer">
By: <?php echo htmlspecialchars($row['name']); ?>
</div>
<div style="margin-top:10px;">
<?php if($_SESSION['role'] == 'admin'){ ?>
<a href="edit_service.php?id=<?php echo $row['id']; ?>" class="btn btn-warning">Edit</a>
<a href="delete_service.php?id=<?php echo $row['id']; ?>" class="btn btn-danger" onclick="return confirm('Pasti padam?')">Delete</a>
<?php } ?>
</div>
</div>
</div>
<?php } ?>
</div>
<?php include 'footer.php'; ?>
8.dashboard new
<?php
include 'protect.php';
include 'db.php';
include 'header.php';
$result = $conn->query("SELECT services.*, users.name FROM services JOIN users ON services.user_id = users.id");
?>
<style>
/* HEADER */
.top-bar {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
/* CONTAINER (HORIZONTAL LIST) */
.services-container {
display: flex;
flex-direction: column;
gap: 20px;
}
/* CARD STYLE */
.service-card {
display: flex;
background: #fff;
border-radius: 12px;
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
overflow: hidden;
transition: 0.3s;
}
/* hover effect sikit */
.service-card:hover {
transform: translateY(-3px);
}
/* IMAGE LEFT */
.service-card img {
width: 250px;
height: 180px;
object-fit: cover;
}
/* RIGHT CONTENT */
.service-body {
padding: 15px;
flex: 1;
display: flex;
flex-direction: column;
}
/* TITLE */
.service-title {
font-size: 18px;
font-weight: bold;
margin-bottom: 8px;
}
/* PRICE */
.price {
color: #28a745;
font-weight: bold;
margin-bottom: 10px;
}
/* DESCRIPTION */
.desc {
font-size: 14px;
color: #555;
margin-bottom: 10px;
}
/* FOOTER */
.service-footer {
font-size: 13px;
color: #888;
margin-top: auto;
}
/* BUTTONS */
.btn {
display: inline-block;
padding: 6px 12px;
border-radius: 6px;
text-decoration: none;
font-size: 13px;
margin-right: 5px;
}
.btn-warning {
background: orange;
color: white;
}
.btn-danger {
border: 1px solid red;
color: red;
}
.btn-warning:hover {
background: darkorange;
}
.btn-danger:hover {
background: red;
color: white;
}
</style>
<div class="top-bar">
<h2>Available Services</h2>
</div>
<div class="services-container">
<?php while($row = $result->fetch_assoc()){ ?>
<div class="service-card">
<img src="uploads/<?php echo $row['image']; ?>">
<div class="service-body">
<div class="service-title">
<?php echo htmlspecialchars($row['title']); ?>
</div>
<div class="price">
RM <?php echo number_format($row['price'], 2); ?>
</div>
<div class="desc">
<?php echo htmlspecialchars($row['description']); ?>
</div>
<div class="service-footer">
By: <?php echo htmlspecialchars($row['name']); ?>
</div>
<div style="margin-top:10px;">
<?php if($_SESSION['role'] == 'admin'){ ?>
<a href="edit_service.php?id=<?php echo $row['id']; ?>" class="btn btn-warning">Edit</a>
<a href="delete_service.php?id=<?php echo $row['id']; ?>" class="btn btn-danger" onclick="return confirm('are you sure to delete?')">Delete</a>
<?php } ?>
</div>
</div>
</div>
<?php } ?>
</div>
<?php include 'footer.php'; ?>
9.add services
<?php
include 'protect.php';
include 'db.php';
if ($_SESSION['role'] !== 'admin') {
header("Location: dashboard.php");
exit();
}
include 'header.php';
$message = "";
if (isset($_POST['add'])) {
$title = htmlspecialchars(mysqli_real_escape_string($conn, $_POST['title']));
$desc = htmlspecialchars(mysqli_real_escape_string($conn, $_POST['desc']));
$price = $_POST['price'];
$img = $_FILES['image']['name'];
$tmp = $_FILES['image']['tmp_name'];
$size = $_FILES['image']['size'];
$ext = strtolower(pathinfo($img, PATHINFO_EXTENSION));
$allowed = array("jpg", "jpeg", "png");
if (!in_array($ext, $allowed)) {
$message = "<div class='alert error'>Invalid format! Only JPG, JPEG & PNG are allowed.</div>";
} elseif ($size > 2000000) {
$message = "<div class='alert error'>File too large! Maximum size is 2MB.</div>";
} else {
$new_img_name = time() . "_" . $img;
if (move_uploaded_file($tmp, "uploads/" . $new_img_name)) {
$stmt = $conn->prepare("INSERT INTO services(user_id, title, description, price, image) VALUES (?,?,?,?,?)");
$stmt->bind_param("issds", $_SESSION['user_id'], $title, $desc, $price, $new_img_name);
if ($stmt->execute()) {
$message = "<div class='alert success'>Service published successfully!</div>";
} else {
$message = "<div class='alert error'>Database error.</div>";
}
} else {
$message = "<div class='alert error'>Failed to upload image.</div>";
}
}
}
?>
<style>
/* CONTAINER */
.form-container {
display: flex;
justify-content: center;
margin-top: 40px;
}
/* BOX */
.form-box {
width: 500px;
background: white;
padding: 30px;
border-radius: 12px;
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
/* TITLE */
.form-box h3 {
margin-bottom: 20px;
}
.badge {
background: #666;
color: white;
padding: 3px 8px;
border-radius: 6px;
font-size: 12px;
}
/* INPUT */
.form-box input,
.form-box textarea {
width: 100%;
padding: 10px;
margin-top: 5px;
margin-bottom: 15px;
border-radius: 8px;
border: 1px solid #ccc;
}
/* ROW */
.row {
display: flex;
gap: 10px;
}
.col {
flex: 1;
}
/* BUTTON */
.btn {
padding: 10px 20px;
border-radius: 8px;
text-decoration: none;
border: none;
cursor: pointer;
font-weight: bold;
}
.btn-primary {
background: #007bff;
color: white;
}
.btn-light {
background: #ddd;
color: black;
}
.btn-primary:hover {
background: #0056b3;
}
.btn-light:hover {
background: #bbb;
}
/* ALERT */
.alert {
width: 500px;
margin: 10px auto;
padding: 12px;
border-radius: 8px;
text-align: center;
}
.success {
background: #d4edda;
color: #155724;
}
.error {
background: #f8d7da;
color: #721c24;
}
</style>
<div class="form-container">
<div>
<?php echo $message; ?>
<div class="form-box">
<h3>Post a New Service <span class="badge">Admin Only</span></h3>
<form method="POST" enctype="multipart/form-data" id="serviceForm">
<label>Service Title</label>
<input name="title" id="title" placeholder="e.g. Laptop Repair" required>
<label>Description</label>
<textarea name="desc" rows="4" placeholder="Tell us about your service..."></textarea>
<div class="row">
<div class="col">
<label>Price (RM)</label>
<input type="number" name="price" step="0.01" placeholder="0.00" required>
</div>
<div class="col">
<label>Service Image (JPG/PNG)</label>
<input type="file" name="image" id="image" required>
<small>Max size: 2MB</small>
</div>
</div>
<div style="margin-top:15px;">
<button name="add" class="btn btn-primary">Publish Service</button>
<a href="dashboard.php" class="btn btn-light">Cancel</a>
</div>
</form>
</div>
</div>
</div>
<script>
document.getElementById('serviceForm').onsubmit = function(e) {
let imgInput = document.getElementById('image');
let filePath = imgInput.value;
let allowedExtensions = /(\.jpg|\.jpeg|\.png)$/i;
if (!allowedExtensions.exec(filePath)) {
alert('Please select a file in .jpg, .jpeg, or .png format only.');
imgInput.value = '';
e.preventDefault();
return false;
}
}
</script>
<?php include 'footer.php'; ?>
8.add service new
<?php
include 'protect.php';
include 'db.php';
if ($_SESSION['role'] !== 'admin') {
header("Location: dashboard.php");
exit();
}
include 'header.php';
$message = "";
if (isset($_POST['add'])) {
$title = htmlspecialchars(mysqli_real_escape_string($conn, $_POST['title']));
$desc = htmlspecialchars(mysqli_real_escape_string($conn, $_POST['desc']));
$price = $_POST['price'];
$img = $_FILES['image']['name'];
$tmp = $_FILES['image']['tmp_name'];
$size = $_FILES['image']['size'];
$ext = strtolower(pathinfo($img, PATHINFO_EXTENSION));
$allowed = array("jpg", "jpeg", "png");
if (!in_array($ext, $allowed)) {
$message = "<div class='alert error'>Invalid format! Only JPG, JPEG & PNG are allowed.</div>";
} elseif ($size > 2000000) {
$message = "<div class='alert error'>File too large! Maximum size is 2MB.</div>";
} else {
$new_img_name = time() . "_" . $img;
if (move_uploaded_file($tmp, "uploads/" . $new_img_name)) {
$stmt = $conn->prepare("INSERT INTO services(user_id, title, description, price, image) VALUES (?,?,?,?,?)");
$stmt->bind_param("issds", $_SESSION['user_id'], $title, $desc, $price, $new_img_name);
if ($stmt->execute()) {
$message = "<div class='alert success'>Service published successfully!</div>";
} else {
$message = "<div class='alert error'>Database error.</div>";
}
} else {
$message = "<div class='alert error'>Failed to upload image.</div>";
}
}
}
?>
<style>
body {
background: #f5f6fa;
font-family: Arial, sans-serif;
}
/* CENTER CONTAINER */
.container {
max-width: 600px;
margin: 50px auto;
}
/* ALERT */
.alert {
padding: 12px;
border-radius: 8px;
margin-bottom: 15px;
text-align: center;
}
.success {
background: #d4edda;
color: #155724;
}
.error {
background: #f8d7da;
color: #721c24;
}
/* FORM CARD */
.form-card {
background: white;
padding: 25px;
border-radius: 12px;
box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}
/* TITLE */
.form-card h2 {
text-align: center;
margin-bottom: 20px;
}
/* LABEL + INPUT */
label {
display: block;
margin-top: 12px;
font-weight: bold;
}
input, textarea {
width: 100%;
padding: 10px;
margin-top: 6px;
border-radius: 8px;
border: 1px solid #ddd;
outline: none;
}
input:focus, textarea:focus {
border-color: #007bff;
}
/* FILE INFO */
small {
color: #666;
}
/* BUTTON */
.btn {
width: 100%;
padding: 12px;
border: none;
border-radius: 8px;
margin-top: 15px;
font-weight: bold;
cursor: pointer;
}
.btn-primary {
background: #007bff;
color: white;
}
.btn-primary:hover {
background: #0056b3;
}
.btn-light {
background: #e4e4e4;
color: #333;
text-align: center;
display: block;
text-decoration: none;
margin-top: 10px;
}
</style>
<div class="container">
<?php echo $message; ?>
<div class="form-card">
<h2>Post New Service</h2>
<form method="POST" enctype="multipart/form-data" id="serviceForm">
<label>Service Title</label>
<input name="title" placeholder="e.g. Laptop Repair" required>
<label>Description</label>
<textarea name="desc" rows="4" placeholder="Tell us about your service..."></textarea>
<label>Price (RM)</label>
<input type="number" name="price" step="0.01" placeholder="0.00" required>
<label>Service Image</label>
<input type="file" name="image" id="image" required>
<small>Only JPG / PNG (Max 2MB)</small>
<button name="add" class="btn btn-primary">Publish Service</button>
<a href="dashboard.php" class="btn btn-light">Cancel</a>
</form>
</div>
</div>
<script>
document.getElementById('serviceForm').onsubmit = function(e) {
let imgInput = document.getElementById('image');
let filePath = imgInput.value;
let allowedExtensions = /(\.jpg|\.jpeg|\.png)$/i;
if (!allowedExtensions.exec(filePath)) {
alert('Please upload JPG, JPEG or PNG only.');
imgInput.value = '';
e.preventDefault();
return false;
}
}
</script>
<?php include 'footer.php'; ?>
9.edit_service
<?php
include 'protect.php';
include 'db.php';
include 'header.php';
$id = $_GET['id'];
if($_SESSION['role']=='admin'){
$stmt = $conn->prepare("SELECT * FROM services WHERE id=?");
$stmt->bind_param("i",$id);
}else{
$stmt = $conn->prepare("SELECT * FROM services WHERE id=? AND user_id=?");
$stmt->bind_param("ii",$id,$_SESSION['user_id']);
}
$stmt->execute();
$data = $stmt->get_result()->fetch_assoc();
if(!$data){
echo "<div class='alert error'>Access denied!</div>";
exit();
}
$message = "";
if(isset($_POST['update'])){
$title=$_POST['title'];
$desc=$_POST['desc'];
$price=$_POST['price'];
if($_SESSION['role']=='admin'){
$stmt=$conn->prepare("UPDATE services SET title=?,description=?,price=? WHERE id=?");
$stmt->bind_param("ssdi",$title,$desc,$price,$id);
}else{
$stmt=$conn->prepare("UPDATE services SET title=?,description=?,price=? WHERE id=? AND user_id=?");
$stmt->bind_param("ssdii",$title,$desc,$price,$id,$_SESSION['user_id']);
}
if($stmt->execute()){
$message = "<div class='alert success'>Updated successfully!</div>";
} else {
$message = "<div class='alert error'>Update failed!</div>";
}
}
?>
<style>
.edit-container {
display: flex;
justify-content: center;
margin-top: 50px;
}
.edit-box {
width: 400px;
background: white;
padding: 25px;
border-radius: 12px;
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.edit-box h4 {
margin-bottom: 20px;
text-align: center;
}
/* INPUT */
.edit-box input,
.edit-box textarea {
width: 100%;
padding: 10px;
margin-bottom: 15px;
border-radius: 8px;
border: 1px solid #ccc;
}
/* BUTTON */
.btn {
width: 100%;
padding: 10px;
background: orange;
color: white;
border: none;
border-radius: 8px;
font-weight: bold;
cursor: pointer;
}
.btn:hover {
background: darkorange;
}
/* ALERT */
.alert {
width: 400px;
margin: 10px auto;
padding: 12px;
border-radius: 8px;
text-align: center;
}
.success {
background: #d4edda;
color: #155724;
}
.error {
background: #f8d7da;
color: #721c24;
}
</style>
<div class="edit-container">
<div>
<?php echo $message; ?>
<div class="edit-box">
<h4>Edit Service</h4>
<form method="POST">
<input name="title" value="<?php echo htmlspecialchars($data['title']); ?>">
<textarea name="desc"><?php echo htmlspecialchars($data['description']); ?></textarea>
<input name="price" value="<?php echo htmlspecialchars($data['price']); ?>">
<button name="update" class="btn">Update</button>
</form>
</div>
</div>
</div>
<?php include 'footer.php'; ?>
10.DELETE_SERVICE.PHP
<?php
include 'protect.php';
include 'db.php';
if ($_SESSION['role'] !== 'admin') {
header("Location: dashboard.php");
exit();
}
$id = $_GET['id'];
if ($id) {
$stmt = $conn->prepare("DELETE FROM services WHERE id = ?");
$stmt->bind_param("i", $id);
$stmt->execute();
}
include 'header.php';
?>
<style>
.container-center {
display: flex;
justify-content: center;
margin-top: 50px;
}
/* BOX */
.box {
width: 450px;
background: white;
padding: 30px;
border-radius: 12px;
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
text-align: center;
}
/* ICON */
.icon {
font-size: 40px;
color: red;
margin-bottom: 10px;
}
/* TEXT */
.box h3 {
margin-bottom: 10px;
}
.box p {
color: #666;
font-size: 14px;
}
/* SEARCH BOX */
.search-box {
background: #f2f2f2;
padding: 15px;
border-radius: 10px;
margin-top: 20px;
text-align: left;
}
.search-box h5 {
margin-bottom: 10px;
}
/* INPUT */
.search-box input {
width: 100%;
padding: 10px;
border-radius: 8px;
border: 1px solid #ccc;
}
/* RESULT */
#result {
margin-top: 10px;
}
/* BUTTON */
.btn {
display: block;
width: 100%;
padding: 12px;
margin-top: 20px;
background: #007bff;
color: white;
text-decoration: none;
border-radius: 8px;
font-weight: bold;
}
.btn:hover {
background: #0056b3;
}
</style>
<div class="container-center">
<div class="box">
<div class="icon"></div>
<h3>Service Deleted</h3>
<p>Service ID <?php echo htmlspecialchars($id); ?> has been successfully removed from the system.</p>
<div class="search-box">
<h5>Quick Search</h5>
<input type="text" id="search" placeholder="Search other services...">
<div id="result"></div>
</div>
<a href="dashboard.php" class="btn">Return to Dashboard</a>
</div>
</div>
<script>
document.getElementById("search").addEventListener("keyup", function(){
let query = this.value;
if(query.length > 0) {
fetch("search_ajax.php?q=" + query)
.then(res => res.text())
.then(data => {
document.getElementById("result").innerHTML = data;
});
} else {
document.getElementById("result").innerHTML = "";
}
});
</script>
<?php include 'footer.php'; ?>
11.LOGOUT.PHP
<?php
session_start();
session_unset();
session_destroy();
header("Location: login.php");
exit();
?>1 views