|
Server IP : 10.128.40.6 / Your IP : 216.73.216.233 Web Server : Apache System : Linux webd006.cluster128.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : logmcpe ( 111175) PHP Version : 7.3.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/logmcpe/www/TMCPRO/pages/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
// -------------------------------------------------------
// check_sms.php
// Appelé en AJAX depuis index2.php toutes les 5 minutes
// Vérifie les nouveaux SMS OVH et retourne le compteur
// -------------------------------------------------------
include 'includes/config_tmcpro.php' ;
include 'includes/stable_functions_tmcpro.php' ;
require __DIR__ . '/vendor_sms_recu/autoload.php';
include 'includes_sms_recu/ovh.php';
// Traitement des SMS reçus (repris de index.php original)
foreach ($messagesDetails as $messagesDetail) {
list($id_sms_recu) = dbi_fetch_row(dbi_query("
SELECT id_sms_recu FROM sms_recu WHERE id = '" . $messagesDetail['id'] . "'
")) ;
if ($id_sms_recu == "") {
$date_only = date2int_DSI(substr($messagesDetail['creationDatetime'], 0, 10)) ;
$heure_only = substr($messagesDetail['creationDatetime'], 11, 5) ;
$heure_forma = heure2int($heure_only) ;
dbi_query("INSERT INTO sms_recu (
id_sms_recu, id, message, sender, date_recu, date_only, heure_only, heure_forma
) VALUES (
NULL,
'" . $messagesDetail['id'] . "',
'" . addslashes($messagesDetail['message']) . "',
'" . $messagesDetail['sender'] . "',
'" . $messagesDetail['creationDatetime'] . "',
'$date_only', '$heure_only', '$heure_forma'
)") ;
dbi_query("INSERT INTO boit_send_receives (
id_sms, message, number, date_full, date_only, heure_only, heure_forma, type
) VALUES (
'" . $messagesDetail['id'] . "',
'" . addslashes($messagesDetail['message']) . "',
'" . $messagesDetail['sender'] . "',
'" . $messagesDetail['creationDatetime'] . "',
'$date_only', '$heure_only', '$heure_forma', 1
)") ;
}
}
// Calcul du compteur de notifications
list($nbr_sms) = dbi_fetch_row(dbi_query("SELECT count(*) FROM sms_recu")) ;
list($value_sms) = dbi_fetch_row(dbi_query("SELECT value_sms FROM config_sms WHERE id = 1")) ;
$notif = max(0, intval($nbr_sms) - intval($value_sms)) ;
// Retourner le résultat en JSON
header('Content-Type: application/json') ;
echo json_encode(['notif' => $notif]) ;
