



<?php
session_start();
session_regenerate_id(true);  //create a new session id to prevent hijacking

// define('BASEPATH', true); //access connection script if you omit this line file will be blank
// require '../../db/config.php';
require_once '../config.php';
require_once '../functions/enDecpt.php';


// echo "<script>alert('Hello 01')</script>";  
$dbHandler = DbHandler();
$id = $_GET['id'];
// echo "<script>console.log($id)</script>";  

if (isset($_SESSION['admin'])) {

    // proceed to delete
    $sql = 'DELETE FROM tbl_consultation WHERE id = ?';
    $remove_post = $dbHandler->prepare($sql);
    $remove_post->execute([base64_url_decode($id)]);
    // exit();
    header("Location: ../consultation/consultation-manager.php");
    // echo "<script>window.location='./withdraw.php'</script>";
} else {
    header("Location: ./logout.php");
    echo "<script>window.location='./logout.php'</script>";
}

?>
