Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question<?php if (!isset($_SESSION)) { session_start(); } require_once('../Connections/arimmobilier.php'); $MM_authorizedUsers = ""; $MM_donotCheckaccess = "true"; // *** Restrict Access To Page: Grant or deny access to this page function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { // For security, start by assuming the visitor is NOT authorized. $isValid = False; // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. // Therefore, we know that a user is NOT logged in if that Session variable is blank. if (!empty($UserName)) { // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. // Parse the strings into arrays. $arrUsers = Explode(",", $strUsers); $arrGroups = Explode(",", $strGroups); if (in_array($UserName, $arrUsers)) { $isValid = true; } // Or, you may restrict access to only certain users based on their username. if (in_array($UserGroup, $arrGroups)) { $isValid = true; } if (($strUsers == "") && true) { $isValid = true; } } return $isValid; } $MM_restrictGoTo = "erreur-auth.php"; if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) { $MM_qsChar = "?"; $MM_referrer = $_SERVER['PHP_SELF']; if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&"; if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) $MM_referrer .= "?" . $QUERY_STRING; $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer); header("Location: ". $MM_restrictGoTo); exit("Redirection..."); } ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue "", $theNotDefinedValue "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $currentPage = $_SERVER["PHP_SELF"]; $maxRows_R_fiches = 15; $pageNum_R_fiches = 0; if (isset($_GET['pageNum_R_fiches'])) { $pageNum_R_fiches = $_GET['pageNum_R_fiches']; } $startRow_R_fiches = $pageNum_R_fiches * $maxRows_R_fiches; // Requete SQL mysql_select_db($database_arimmobilier, $arimmobilier); $query_R_fiches = "SELECT * FROM biens ORDER BY prix ASC"; $query_limit_R_fiches = sprintf("%s LIMIT %d, %d", $query_R_fiches, $startRow_R_fiches, $maxRows_R_fiches); $R_fiches = mysql_query($query_limit_R_fiches, $arimmobilier) or die(mysql_error()); $row_R_fiches = mysql_fetch_assoc($R_fiches); if (isset($_GET['totalRows_R_fiches'])) { $totalRows_R_fiches = $_GET['totalRows_R_fiches']; } else { $all_R_fiches = mysql_query($query_R_fiches); $totalRows_R_fiches = mysql_num_rows($all_R_fiches); } $totalPages_R_fiches = ceil($totalRows_R_fiches/$maxRows_R_fiches)-1; $varbien_R_resultats_recherche = "-1"; if (isset($_GET['bien'])) { $varbien_R_resultats_recherche = $_GET['bien']; } $varmin_R_resultats_recherche = "-1"; if (isset($_GET['prixmin'])) { if ($_GET['prixmin'] == "") { $varmin_R_resultats_recherche = "0" ; } else { $varmin_R_resultats_recherche = $_GET['prixmin']; } } $varmax_R_resultats_recherche = "-1"; if (isset($_GET['prixmax'])) { if ($_GET['prixmax'] == "") { $varmax_R_resultats_recherche = "9999999999999" ; } else { $varmax_R_resultats_recherche = $_GET['prixmax']; } } $varpiece_R_resultats_recherche = "%"; if (isset($_GET['pieces'])) { if ($_GET['pieces'] == "") { $varpiece_R_resultats_recherche = "" ; } else { $varpiece_R_resultats_recherche = $_GET['pieces']; } } $varpays_R_resultats_recherche = "-1"; if (isset($_GET['pays'])) { $varpays_R_resultats_recherche = $_GET['pays']; } $vartype_R_resultats_recherche = "-1"; if (isset($_GET['type_fr'])) { $vartype_R_resultats_recherche = $_GET['type_fr']; } /********************* debut modif *********************/ mysql_select_db($database_arimmobilier, $arimmobilier); $query_R_resultats_recherche sprintf("select * from biens where bien %s and type_fr = %s and pays = %s and pieces = %s and prix >= %s and prix <= %s", getsqlvaluestring($varbien_R_resultats_recherche, "text"), getsqlvaluestring($vartype_R_resultats_recherche, "text"), getsqlvaluestring($varpays_R_resultats_recherche, "text"), getsqlvaluestring($varpiece_R_resultats_recherche, "text"), getsqlvaluestring($varmin_R_resultats_recherche, "int"), getsqlvaluestring($varmax_R_resultats_recherche, "int") ); // on parcours le tableau de villes recherchées si au moins une ville à été séléctionnée if(isset($_GET['ville'])) { if(!is_array($_GET['ville'])) { $villearr = array(); $villearr[] = $_GET['ville']; } else { $villearr = $_GET['ville']; } if(count($villearr) > 0) { $query_R_resultats_recherche .= " and ("; foreach($villearr as $value) { $query_R_resultats_recherche .= 'ville like '.getsqlvaluestring($value, "text").' or '; } // on supprime le dernier or en trop $query_R_resultats_recherche = substr($query_R_resultats_recherche, 0, -4); $query_R_resultats_recherche .= ")"; } } echo $query_R_resultats_recherche; /********************* fin modif *********************/ $R_resultats_recherche = mysql_query($query_R_resultats_recherche, $arimmobilier) or die(mysql_error()); $row_R_resultats_recherche = mysql_fetch_assoc($R_resultats_recherche); $totalRows_R_resultats_recherche = mysql_num_rows($R_resultats_recherche); $maxRows_R_resultats_recherche = 15; $pageNum_R_resultats_recherche = 0; if (isset($_GET['pageNum_R_resultats_recherche'])) { $pageNum_R_resultats_recherche = $_GET['pageNum_R_resultats_recherche']; } $startRow_R_resultats_recherche = $pageNum_R_resultats_recherche * $maxRows_R_resultats_recherche; $varbien_R_resultats_recherche = "-1"; if (isset($_GET['bien'])) { $varbien_R_resultats_recherche = $_GET['bien']; } $queryString_R_resultats_recherche = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_R_resultats_recherche") false && stristr($param, "totalRows_R_resultats_recherche") false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_R_resultats_recherche = "&" . htmlentities(implode("&", $newParams)); } } $queryString_R_resultats_recherche = sprintf("&totalRows_R_resultats_recherche=%d%s", $totalRows_R_resultats_recherche, $queryString_R_resultats_recherche); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Document sans titre</title> <link href="style.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- .Style6 {color: #FFFFFF; font-weight: bold; } --> </style> </head> ADMINISTRATION <?php include('inc/moteur.php') ;?>, <table width ="100%" border="0" cellspacing="0" cellpadding="0"> ----, <table width=\"98%\" border=\"1\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#333333\"> ---- <?php include('inc/menu.php'); ?> </td> </tr> </table> , Ajouter une fiche Résultats de votre recherche: <?php echo $totalRows_R_resultats_recherche ?> réponse(s) <?php if ($totalRows_R_resultats_recherche > 0) { // Show if recordset not empty ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> ----, </td> , , ---- , REF, BIENS, TYPES, VILLES, PRIX, , ---- , , , <?php do { ?> ---- "> ">, <?php echo htmlspecialchars($row_R_resultats_recherche['ref']); ?>, <?php echo htmlspecialchars($row_R_resultats_recherche['bien']); ?>, <?php echo htmlspecialchars($row_R_resultats_recherche['type_fr']); ?>, <?php echo htmlspecialchars(substr($row_R_resultats_recherche['ville'],0,7)); ?>, <?php echo htmlspecialchars($row_R_resultats_recherche['prix']); ?> €, , ---- , <?php } while ($row_R_resultats_recherche = mysql_fetch_assoc($R_resultats_recherche)); ?> <?php if ($totalRows_R_resultats_recherche > 0) { // Show if recordset not empty ?> <?php echo ($startRow_R_resultats_recherche + 1) ?> à <?php echo min($startRow_R_resultats_recherche + $maxRows_R_resultats_recherche, $totalRows_R_resultats_recherche) ?> sur <?php echo $totalRows_R_resultats_recherche ?> ">Début ">Précédent ">Suivant ">Fin <?php } // Show if recordset not empty ?> </td> </tr> </table> <?php } // Show if recordset not empty ?></td> </tr> <tr> <td bgcolor="#FFFFFF"> </td> <td bgcolor="#FFFFFF"> </td> </tr> </table> </html> <?php mysql_free_result($R_fiches); mysql_free_result($R_resultats_recherche); ?>
$listeVilles = "ville IN ("; foreach( $varville_R_resultats_recherche as $selectValue) { $listeVilles .= "'".$selectValue."',"; } $listeVilles .= "'xxx')"; mysql_select_db($database_arimmobilier, $arimmobilier); $query_R_resultats_recherche sprintf("SELECT * FROM biens WHERE bien %s AND pays = %s AND type_fr = %s AND pieces = %s AND prix >= %s AND prix <= %s AND $listeVilles", GetSQLValueString($varbien_R_resultats_recherche, "text"), GetSQLValueString($varpays_R_resultats_recherche, "text"), GetSQLValueString($vartype_R_resultats_recherche, "text"), GetSQLValueString($varpieces_R_resultats_recherche, "int"), GetSQLValueString($varmin_R_resultats_recherche, "int"), GetSQLValueString($varmax_R_resultats_recherche, "int"));