<?php header('Content-Type: application/json');try{if(file_exists('status_data.json')){unlink('status_data.json');}$baseHtml=file_get_contents('status.html');$pattern='/(<div id="status-list" class="status-grid">)(.*?)(<\/div>\s*<div class="auto-refresh">)/s';$replacement='$1$3';$newHtml=preg_replace($pattern,$replacement,$baseHtml);$newHtml=preg_replace('/<span id="active-count">\d+<\/span>/','<span id="active-count">0</span>',$newHtml);$currentDate=date('d/m/Y H:i:s');$newHtml=preg_replace('/<span id="last-update">(.*?)<\/span>/','<span id="last-update">'.$currentDate.'</span>',$newHtml);file_put_contents('status.html',$newHtml);echo json_encode(['status'=>'success','message'=>'Système réinitialisé']);}catch(Exception $e){echo json_encode(['status'=>'error','message'=>'Erreur lors de la réinitialisation: '.$e->getMessage()]);}?>