1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
| <?php
require("my_connect.inc");
include("my_liste.cls");
include("parametre.php");
include("function.js");
// INITIALISATION
$clt_login = "guest";
$clt_pwd = "guest";
$id_client = 0;
$POST_Loyer=(isset($_POST["loyer"])) ? $_POST["loyer"] : "0";
echo "<body bgcolor='#ffffff' ";
echo "onload='return false' ";
echo "oncontextmenu='return false' ";
echo "ondragstart='return false' ";
echo "onselectstart='return false' ";
echo ">";
// DEFINITION DE LA PAGE
if (!$Result) {
$id_client = ControleAcces($host, $bdd, $login, $pwd, $clt_login, $clt_pwd);
}
if ($id_client>-1) {
echo "<p><font face='Times New Roman,Georgia,Times' color='#00a550' size='5'><b><em>Nos offres...</em></b></font></p>";
echo "<table border='0' cellpadding='0' cellspacing='0' width='600'>";
echo "<tr>";
echo "<form name='recherche' action='$PHP_SELF' method='post'>";
echo "<td>";
echo "Loyer maximum : <input type='text' name='loyer' size='5'";
LoyerMaxi($host, $bdd, $login, $pwd, $POST_Loyer);
echo " ";
echo "</td>";
echo "<td>";
echo "<INPUT TYPE='submit' name='Chercher' VALUE='Ok'>";
echo "</td>";
echo "</form>";
echo "</tr>";
echo "</table>";
AfficheOffres($host, $bdd, $login, $pwd, $POST_Loyer);
}
echo "</body>";
// Fonctions PHP
function AfficheOffres($host, $bdd, $login, $pwd, $POST_Loyer) {
$sgbd = new Tsession;
$sgbd->open_session($host, $login, $pwd);
$sgbd->connect_db($bdd);
if ($sgbd->id_bdd != FALSE)
{
$sql="SELECT OFR_CONVENTION AS Convention, ";
$sql.="CONCAT(OFR_LOYER,' ') AS Loyer ";
$sql.="FROM ofr ";
if ($POST_Loyer <> 0) {
echo $POST_Loyer;
$sql.="WHERE OFR_LOYER<=$POST_Loyer"; }
$sql.="ORDER BY OFR_LOYER ASC ";
$arrColWidth=array(0,90,50,50,250,150,50);
$arrColAlign=array('left','left','left','right','center','left','center');
$query = new TListe;
$query->colonne_width($arrColWidth);
$query->colonne_align($arrColAlign);
$query->execute($sql);
if ($query->number>0)
$query->affiche("fiche"); //nom de la fenêtre
// else
// {
// echo "<strong>";
// echo "Nous ne disposons pas actuellement de biens correspondant à vos critères de recherche, ";
// echo "</strong>";
// }
}
$sgbd->close_session();
}
// recherche le loyer maxi d'un abonné
function LoyerMaxi($host, $bdd, $login, $pwd, $Selected)
{
if ($Selected!=0)
{
echo " value='$Selected'>";
}
else
{
$id_session = mysql_connect($host, $login, $pwd);
$id_bdd = mysql_select_db($bdd, $id_session);
if (id_bdd!=FALSE) {
$sql = "SELECT * FROM ofr WHERE ofr.OFR_LOYER<=$Selected";
$resultat = mysql_query($sql, $id_session);
if ($resultat) {
$ligne = mysql_fetch_object($resultat);
echo " value='$ligne->OFR_LOYER'>";
}
else
echo " value=''>";
}
mysql_close($id_session);
}
}
?> |
Partager