-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess_application.php
More file actions
34 lines (28 loc) · 950 Bytes
/
Copy pathprocess_application.php
File metadata and controls
34 lines (28 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
session_start();
require 'db_connect.php';
if (!isset($_SESSION['user_id']) || $_SESSION['user_role'] !== 'employer') {
header("Location: login.html");
exit();
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$application_id = $conn->real_escape_string($_POST['application_id']);
$action = $conn->real_escape_string($_POST['action']);
// Validate action
if (!in_array($action, ['accept', 'reject'])) {
die("Invalid action.");
}
// Update application status
$status = $action === 'accept' ? 'accepted' : 'rejected';
$sql = "UPDATE applications SET status = '$status' WHERE id = $application_id";
if ($conn->query($sql) === TRUE) {
header("Location: dashboard-employer.php");
exit();
} else {
die("Error processing application: " . $conn->error);
}
}
$conn->close();
header("Location: dashboard-employer.php");
exit();
?>