<?php
session_start(); include '../db_config.php'; include '../functions.php'; check_login(); check_role('dme');
if(isset($_GET['id']) && isset($_GET['act'])) {
    $s = ($_GET['act']=='approve')?'Approved':'Rejected';
    // Use employee_nic for employees
    $stmt = $conn->prepare("UPDATE employee_details SET status=? WHERE employee_nic=?");
    $stmt->bind_param("ss", $s, $_GET['id']);
    $stmt->execute();
}
if(isset($_GET['emp_id']) && isset($_GET['act'])) {
    $s = ($_GET['act']=='approve')?'Approved':'Rejected';
    $stmt = $conn->prepare("UPDATE employer_details SET status=? WHERE user_id=?");
    $stmt->bind_param("si", $s, $_GET['emp_id']);
    $stmt->execute();
}
header("Location: dashboard.php");
?>
