$sel_query = "SELECT photos, Nom FROM jc_agence ORDER BY IDag ASC";
$result = mysqli_query($con, $sel_query);
while ($row = mysqli_fetch_assoc($result)) {
$logoAG = $row["photos"];
$nomAG = $row["Nom"];
}
$sel_query = "SELECT path_www FROM jc_localhost ORDER BY IDlocalhost ASC";
$result = mysqli_query($con, $sel_query);
while ($row = mysqli_fetch_assoc($result)) {
$siteAg1 = $row["path_www"];
$siteAg = $row["path_www"];
}
$reponse = "
Nous vous remercions pour votre demande. Nous vous répondrons dans les meilleurs délais.
Meilleures salutations.
" . $nomAG . "
";
$fiches = 'fiche-vente-';
$lien = $siteAg . '/' . $fiches;
/* Valeurs d'affichage par défaut : le principe de la page de vente reste inchangé. */
$msg = '';
$nom = $prenom = $adresse = $npa = $ville = $phone = $email = $message = '';
$humanConfirm = false;
$courtierPhotoUrl = '';
$propertyPhotoUrl = 'foto2/no_photo.jpg';
/*
* Recherche souple de la photo du courtier responsable.
* Le fichier peut être enregistré directement ou dans un dossier lié à IDcourt.
*/
if (!function_exists('sale_contact_find_courtier_photo')) {
function sale_contact_find_courtier_photo(array $courtierRow)
{
$courtierId = isset($courtierRow['IDcourt']) ? trim((string)$courtierRow['IDcourt']) : '';
$photoFile = '';
foreach (array(
'photo_courtier', 'photo_profil', 'photo_profile', 'photo_path',
'image_path', 'photos', 'Photos', 'photo', 'Photo', 'image',
'Image', 'avatar', 'fichier', 'nom_photo'
) as $photoField) {
if (!empty($courtierRow[$photoField])) {
$photoFile = trim((string)$courtierRow[$photoField]);
break;
}
}
if ($photoFile === '') {
foreach ($courtierRow as $fieldName => $fieldValue) {
if (preg_match('~(?:photo|foto|image|avatar|portrait)~i', (string)$fieldName)
&& trim((string)$fieldValue) !== '') {
$photoFile = trim((string)$fieldValue);
break;
}
}
}
if ($photoFile !== '') {
if (preg_match('~^(?:https?:)?//~i', $photoFile)) {
return $photoFile;
}
$photoFile = ltrim($photoFile, '/');
$candidates = array($photoFile);
if ($courtierId !== '') {
$candidates = array_merge($candidates, array(
'real_photos/courtier/' . $courtierId . '/' . basename($photoFile),
'real_photos/courtiers/' . $courtierId . '/' . basename($photoFile),
'courtier/' . $courtierId . '/' . basename($photoFile),
'courtiers/' . $courtierId . '/' . basename($photoFile),
'uploads/courtier/' . $courtierId . '/' . basename($photoFile),
'upload/courtier/' . $courtierId . '/' . basename($photoFile),
'photos/courtier/' . $courtierId . '/' . basename($photoFile),
'photos/courtiers/' . $courtierId . '/' . basename($photoFile),
'foto/courtier/' . $courtierId . '/' . basename($photoFile),
'foto_courtier/' . $courtierId . '/' . basename($photoFile)
));
}
$candidates = array_merge($candidates, array(
'real_photos/courtier/' . basename($photoFile),
'real_photos/courtiers/' . basename($photoFile),
'courtier/' . basename($photoFile),
'courtiers/' . basename($photoFile),
'uploads/courtier/' . basename($photoFile),
'upload/courtier/' . basename($photoFile),
'img/courtier/' . basename($photoFile),
'images/courtier/' . basename($photoFile),
'photos/courtier/' . basename($photoFile),
'photos/courtiers/' . basename($photoFile),
'foto/courtier/' . basename($photoFile),
'foto_courtier/' . basename($photoFile)
));
foreach (array_unique($candidates) as $candidate) {
if ($candidate !== '' && is_file(__DIR__ . '/' . $candidate)) {
return $candidate;
}
}
}
if ($courtierId !== '') {
$directories = array(
'real_photos/courtier/' . $courtierId,
'real_photos/courtiers/' . $courtierId,
'courtier/' . $courtierId,
'courtiers/' . $courtierId,
'uploads/courtier/' . $courtierId,
'upload/courtier/' . $courtierId,
'photos/courtier/' . $courtierId,
'photos/courtiers/' . $courtierId,
'foto/courtier/' . $courtierId,
'foto_courtier/' . $courtierId
);
foreach ($directories as $directory) {
$absoluteDirectory = __DIR__ . '/' . $directory;
if (!is_dir($absoluteDirectory)) {
continue;
}
$files = scandir($absoluteDirectory);
if (!is_array($files)) {
continue;
}
foreach ($files as $file) {
if (preg_match('~\.(?:jpe?g|png|webp|gif)$~i', $file)) {
return $directory . '/' . $file;
}
}
}
}
return '';
}
}
if (!function_exists('sale_contact_courtier_initials')) {
function sale_contact_courtier_initials($nom, $prenom)
{
if (function_exists('mb_substr') && function_exists('mb_strtoupper')) {
return mb_strtoupper(
mb_substr((string)$nom, 0, 1, 'UTF-8') . mb_substr((string)$prenom, 0, 1, 'UTF-8'),
'UTF-8'
);
}
return strtoupper(substr((string)$nom, 0, 1) . substr((string)$prenom, 0, 1));
}
}
$sel_query = "SELECT *, categories_immobilier.nom AS categorie, sous_categories_immobilier.nom AS sous_categorie, jc_courtier.nom AS nom_courtier, jc_courtier.prenom AS prenom_courtier
FROM jc_propriete
JOIN rea_ville_suisse ON jc_propriete.IDville = rea_ville_suisse.IDville
JOIN jc_type ON jc_propriete.IDtyp = jc_type.IDtyp
JOIN jc_photos ON jc_propriete.IDsale = jc_photos.IDsale
JOIN jc_courtier ON jc_propriete.IDcourt = jc_courtier.IDcourt
JOIN categories_immobilier ON jc_propriete.cat1 = categories_immobilier.id
JOIN sous_categories_immobilier ON jc_propriete.cat2 = sous_categories_immobilier.id
WHERE jc_propriete.online = '1'
AND jc_propriete.IDsale = ?
AND Choice = 'Vente'
AND jc_photos.position = (
SELECT MIN(position) FROM jc_photos
WHERE jc_photos.IDsale = jc_propriete.IDsale
)
ORDER BY categories_immobilier.nom ASC, sous_categories_immobilier.nom ASC";
$stmt = $con->prepare($sel_query);
$stmt->bind_param("s", $IDsale);
$stmt->execute();
$result = $stmt->get_result();
while ($row = mysqli_fetch_assoc($result)) {
$IDsalechoice = $row["IDsale"];
$titre = $row["Titre"];
$typesale = $row["Type"];
$addresses = $row["Adresse"];
$ZIP = $row["ZIP"];
$City = $row["City"];
$photosale = $row["Foto_garde_min"];
$ref = $row["Reference"];
$mailcourt = $row["Email"];
$courtnom = $row["nom_courtier"];
$courtprenom = $row["prenom_courtier"];
$mobilecourt = $row["mobile"];
$telcourt = $row["tel"];
/* Lecture séparée du courtier : évite les collisions de colonnes du SELECT *. */
$courtierId = isset($row["IDcourt"]) ? (string)$row["IDcourt"] : '';
$courtierPhotoRow = array();
if ($courtierId !== '') {
$courtierStmt = $con->prepare("SELECT * FROM jc_courtier WHERE IDcourt = ? LIMIT 1");
if ($courtierStmt) {
$courtierStmt->bind_param("s", $courtierId);
$courtierStmt->execute();
$courtierPhotoResult = $courtierStmt->get_result();
if ($courtierPhotoResult) {
$courtierPhotoRow = $courtierPhotoResult->fetch_assoc() ?: array();
}
$courtierStmt->close();
}
}
$courtierPhotoUrl = sale_contact_find_courtier_photo($courtierPhotoRow);
$propertyPhotoFile = '';
if (!empty($row["foto_min"])) {
$propertyPhotoFile = $row["foto_min"];
} elseif (!empty($row["Foto_garde_min"])) {
$propertyPhotoFile = $row["Foto_garde_min"];
}
$propertyPhotoUrl = 'foto2/' . ($propertyPhotoFile !== '' ? $propertyPhotoFile : 'no_photo.jpg');
}
define('CAPTCHA1', rand(1, 9));
define('CAPTCHA2', rand(1, 9));
define('CAPTCHA_ENABLED', true);
if ($_POST) {
$nom = $_POST["nom"];
$prenom = $_POST["prenom"];
$adresse = $_POST["adresse"];
$npa = $_POST["npa"];
$ville = $_POST["ville"];
$phone = $_POST["phone"];
$email = $_POST["email"];
$message = $_POST["message"];
$humanConfirm = isset($_POST['human_confirm']) && $_POST['human_confirm'] === '1';
$copie = 'j.broccard@agence-allegro.ch';
$captcha = $_POST['captcha'];
$captcha1 = $_POST['captcha1'];
$captcha2 = $_POST['captcha2'];
if (CAPTCHA_ENABLED == '0') { $captcha1 = '1'; $captcha2 = '1'; $captcha = '2'; }
if (empty($nom) || empty($prenom) || empty($adresse) || empty($npa) || empty($ville) || empty($phone) || empty($email) || empty($message)) {
$msg = 'Un ou plusieurs champs sont vides!';
} else if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$msg = 'Votre adresse e-mail n\'est pas formatée correctement!';
} else if (!$humanConfirm) {
$msg = 'Veuillez faire glisser le curseur anti-robot vers la droite.';
} else if (($captcha1 + $captcha2) != $captcha) {
$msg = 'Anti-spam incorrect! Veuillez réessayer.';
} else {
$update = "UPDATE jc_propriete SET demande = demande + 1 WHERE IDsale = ?";
$stmt = $con->prepare($update);
$stmt->bind_param("s", $IDsale);
$stmt->execute();
$destinataire = $mailcourt;
$sujet = "Demande sur une vente de la part de $nom $prenom ";
$contenu = "";
$contenu .= "$typesale - $addresses, $ZIP - $City Référence: $ref ";
$contenu .= "
";
$contenu .= "Nom et prénom: $nom $prenom
";
$contenu .= "Adresse: $adresse $npa $ville
";
$contenu .= "Téléphone: $phone
";
$contenu .= "Email: $email
";
$contenu .= " Visionner la fiche sur le site
";
$contenu .= "Message: " . nl2br($message) . "
";
$contenu .= "
";
$contenu .= "Nous vous remercions pour votre demande. Nous vous répondrons dans les meilleurs délais. Meilleures salutations. AGENCE ALLEGRO $courtnom $courtprenom $mailcourt $mobilecourt - $telcourt
";
$contenu .= "";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type:text/html;charset=UTF-8\r\n";
$headers .= "From: $email\r\n";
$headers .= "Cc: $email\r\n";
$headers .= "BCC: $copie\r\n";
if (mail($destinataire, $sujet, $contenu, $headers)) {
$msg = "Félicitations " . $nom . " " . $prenom . " Nous vous remercions pour votre demande. Vous avez une copie de votre demande dans votre boîte Email. Meilleures salutations.Quitter ";
} else {
$msg = "Erreur lors de l'envoi de la demande.";
}
}
}
?>
Demande d’informations | Agence Allégro
Vente
Demande d’informations
Warning : Undefined variable $titre in /home/clients/388c540d001c324cb8633e58444d4595/web/1960-1950.php on line 845
Deprecated : htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /home/clients/388c540d001c324cb8633e58444d4595/web/1960-1950.php on line 845
Réf.
Warning : Undefined variable $ref in /home/clients/388c540d001c324cb8633e58444d4595/web/1960-1950.php on line 846
Deprecated : htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /home/clients/388c540d001c324cb8633e58444d4595/web/1960-1950.php on line 846
Warning : Undefined variable $addresses in /home/clients/388c540d001c324cb8633e58444d4595/web/1960-1950.php on line 849
Deprecated : htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /home/clients/388c540d001c324cb8633e58444d4595/web/1960-1950.php on line 849
Warning : Undefined variable $ZIP in /home/clients/388c540d001c324cb8633e58444d4595/web/1960-1950.php on line 850
Deprecated : htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /home/clients/388c540d001c324cb8633e58444d4595/web/1960-1950.php on line 850
Warning : Undefined variable $City in /home/clients/388c540d001c324cb8633e58444d4595/web/1960-1950.php on line 850
Deprecated : htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /home/clients/388c540d001c324cb8633e58444d4595/web/1960-1950.php on line 850
Courtier responsable
Warning : Undefined variable $courtierPhotoUrl in
/home/clients/388c540d001c324cb8633e58444d4595/web/1960-1950.php on line
863
Warning : Undefined variable $courtnom in /home/clients/388c540d001c324cb8633e58444d4595/web/1960-1950.php on line 880
Warning : Undefined variable $courtprenom in /home/clients/388c540d001c324cb8633e58444d4595/web/1960-1950.php on line 880