| Current Path : /home/happyrenas/myreco.online/administration/panel/ |
Linux webd005.cluster105.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 |
| Current File : /home/happyrenas/myreco.online/administration/panel/ajax_filtre_hebergement.php |
<?
set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__ . '/../');
include("../../configuration.php");
include("../../includes/fonctions.php");
setlocale(LC_TIME, 'fr_FR.UTF-8');
// Construire la requête en fonction des filtres sélectionnés
$conditions = [];
if (!empty($_GET['country_code'])) {
$country_code = $_GET['country_code'];
$conditions[] = "country_code = '".$country_code."'";
}
if (!empty($_GET['postal_code'])) {
$postal_code = $_GET['postal_code'];
$conditions[] = "LEFT(postal_code,2)='".$postal_code."' ";
}
$where = (!empty($conditions)) ? "WHERE " . implode(" AND ", $conditions) : "";
$myquery = "SELECT id, rating, reviews, token, statut, name, phone, email_1, email_2, email_3, postal_code, street, city, category, compteur_telechargement, compteur_affichage,
proche_json, median_json, lointain_json,
qrcode_existe
FROM heb $where
ORDER BY name
";
$hebergements = $db->get_results($myquery);
$output = '';
if (!empty($hebergements)) {
$total_affiche = count($hebergements);
foreach ($hebergements as $heb) {
$url_qrcode = ($heb->qrcode_existe==1) ? "https://www.myreco.online/qrcode_" . $heb->token : "-";
// Remplacement des virgules par des points pour rating et reviews
$heb->rating = str_replace(",", ".", $heb->rating);
$heb->reviews = str_replace(",", ".", $heb->reviews);
// Analyse des 3 zones
$proche_info = analyserJsonCategorie($heb->proche_json);
$median_info = analyserJsonCategorie($heb->median_json);
$lointain_info = analyserJsonCategorie($heb->lointain_json);
// Gestion des emails
$emails = $heb->email_1;
$emails .= (!empty($heb->email_2)) ? '<br>' . $heb->email_2 : '';
$emails .= (!empty($heb->email_3)) ? '<br>' . $heb->email_3 : '';
$url_qrcode = "qrcode_base64.php?token={$heb->token}";
// Construction de la ligne de tableau
$output .= "<tr>";
$output .= "<td class='voir' style='cursor:pointer;' id='{$heb->id}'>{$heb->id}</td>";
$output .= "<td style='cursor:pointer;' id='{$heb->id}'>
<a href='$url_qrcode' target='_blank' style='text-decoration:none;'>
<i class='fas fa-qrcode'></i>
</a>
</td>";
$output .= "<td class='voir' style='cursor:pointer;' id='{$heb->id}'>{$heb->name}</td>";
$output .= "<td class='voir' style='cursor:pointer;' id='{$heb->id}'>{$heb->postal_code}</td>";
$output .= "<td class='voir' style='cursor:pointer;' id='{$heb->id}'>{$heb->city}</td>";
$output .= "<td class='voir' style='cursor:pointer;' id='{$heb->id}'>{$heb->category}</td>";
$output .= "<td class='voir' style='text-align:center;cursor:pointer;' id='{$heb->id}'>{$heb->rating}</td>";
$output .= "<td class='voir' style='text-align:center;cursor:pointer;' id='{$heb->id}'>{$heb->reviews}</td>";
$output .= "<td class='voir' style='text-align:center;cursor:pointer;' id='{$heb->id}'>".$proche_info['total']."</td>";
$output .= "<td class='voir' style='text-align:center;cursor:pointer;' id='{$heb->id}'>".$median_info['total']."</td>";
$output .= "<td class='voir' style='text-align:center;cursor:pointer;' id='{$heb->id}'>".$lointain_info['total']."</td>";
$output .= "<td class='voir' style='text-align:center;cursor:pointer;' id='{$heb->id}'>{$heb->compteur_telechargement}</td>";
$output .= "<td class='voir' style='text-align:center;cursor:pointer;' id='{$heb->id}'>{$heb->compteur_affichage}</td>";
$output .= "<td class='voir' style='cursor:pointer;' id='{$heb->id}'>" .
"<span class='label {$statuts[$heb->statut]['classe']} label-inline'>" .
"{$statuts[$heb->statut]['label']}" .
"</span>" .
"</td>";
$output .= "<td class='delete text-center' style='cursor:pointer;' id='{$heb->id}'>
<i class='fas fa-trash-alt fa-sm text-danger' title='Supprimer'></i>
</td>";
$output .= "</tr>";
}
}
// Retourner le contenu HTML + la requête pour debug si besoin
echo json_encode([
'output' => $output,
'query' => $myquery,
'total_affiche' => $total_affiche
]);
?>