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 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
|
function AdvancedSearchAds($id_catg,$id_subcatg,$page)
{
global $user,$cookie,$id_catg,$prefix, $db,$currentlang,$module_name,$bgcolor1,$bgcolor2, $admin,$perpage,$adsbgcolor1,$adsbgcolor2;
include ("header.php");
menu($mainads=1);
echo "<BR>";
OpenTable();
echo "<tr align=\"center\"><td colspan=\"2\"><font class=\"title\">Recherche Avancée</font><br><BR><BR><br></td></tr>";
echo "<tr align=\"center\">
<td>
<form name=\"formulaire\" align=\"center\" action=\"modules.php?name=$module_name&op=AdvancedSearchAds\" method=\"post\" enctype=\"multipart/form-data\">";
echo "<table>";
echo "<tr><td width=\"130\" align=\"center\"><font color=\"0080c0\">CATEGORIES</font></td>"
."<td width=\"120\" colspan=\"6\"><select name=\"catgforprocess\">";
$result = $db->sql_query("select id_catg,catg from ".$prefix."_ads_category order by catg");
while (list($xid_catg,$xcatg) = $db->sql_fetchrow($result)){
$result2 = $db->sql_query("select id_subcatg,subcatg from ".$prefix."_ads_subcatg where id_catg='$xid_catg' order by subcatg");
while (list($xid_subcatg,$xsubcatg) = $db->sql_fetchrow($result2)) {
echo "<option value=\"$xid_catg"."_"."$xid_subcatg\">$xcatg-$xsubcatg</option>\n";
}
$db->sql_freeresult($result2);
}
$db->sql_freeresult($result);
echo "</select>"
."</td></tr>";
echo "<TR align=\"center\" width=\"100%\">";
echo "<TD width=\"120\" align=\"center\">";
echo "<font color=\"0080c0\"<b>DEPARTEMENTS</b></font></td>";
echo "<td width=\"40\">";
echo "<select name=\"id_localisation1\">";
$result3 = $db->sql_query("select * from ".$prefix."_ads_localisation order by id_localisation");
while (list($id_localisation,$localisation) = $db->sql_fetchrow($result3)) {
echo "<option value=\"$id_localisation\">$id_localisation</option>\n";
}
$db->sql_freeresult($result3);
echo "</select></td>";
echo "<td width=\"40\">";
echo "<select name=\"id_localisation2\">";
$result4 = $db->sql_query("select * from ".$prefix."_ads_localisation order by id_localisation");
while (list($id_localisation,$localisation) = $db->sql_fetchrow($result4)) {
echo "<option value=\"$id_localisation\">$id_localisation</option>\n";
}
$db->sql_freeresult($result4);
echo "</select></td>";
echo "<td width=\"40\">";
echo "<select name=\"id_localisation3\">";
$result5 = $db->sql_query("select * from ".$prefix."_ads_localisation order by id_localisation");
while (list($id_localisation,$localisation) = $db->sql_fetchrow($result5)) {
echo "<option value=\"$id_localisation\">$id_localisation</option>\n";
}
$db->sql_freeresult($result5);
echo "</select></td>
</tr>";
echo "<TR align=\"center\">";
echo "<TD width=\"120\" align=\"center\">";
echo "<font color=\"0080c0\">DATE DE PARUTION</font></td>";
echo "<td>entre</td><td width=\"60\"><input type=\"text\" size=\"10\" name=\"dateposted1\" value=\"$dateposted\"></td>";
echo "<td>et</td><td width=\"60\"><input type=\"text\" size=\"10\" name=\"dateposted2\" value=\"$dateposted\"></td>";
echo "<td> ex : 2006-01-27</td></tr>";
echo "<tr align=\"center\"><td width=\"120\" align=\"center\"></td>";
echo "<td width=\"60\"><input type=\"hidden\" name=\"op\" value=\"AdvancedSearchAds\"></td>";
echo "<td width=\"60\"><input type=\"submit\" value=\"Recherche\"></td>";
echo "</tr></table></form></td></tr>";
CloseTable();
$catgforprocess=$_POST['catgforprocess'];
$id_localisation1=$_POST['id_localisation1'];
$id_localisation2=$_POST['id_localisation2'];
$id_localisation3=$_POST['id_localisation3'];
$dateposted1=$_POST['dateposted1'];
$dateposted2=$_POST['dateposted2'];
echo $catgforprocess;
echo $id_localisation1;
echo $id_localisation2;
echo $id_localisation3;
echo $dateposted1;
echo $dateposted2;
OpenTable();
$catg_arr = explode("_",$catgforprocess);
$id_catg = $catg_arr[0];
$id_subcatg = $catg_arr[1];
$requete = "SELECT id_ads, id_catg, id_subcatg, id_localisation, title, cdesc, prize, submitter, email, website, dateposted ";
$requete .= " FROM ".$prefix."_ads_ads WHERE ";
$requete .= " catgforprocess = ".$_POST['catgforprocess']."";
$requete .= " AND (id_localisation = ".$_POST['id_localisation1']." OR id_localisation = ".$_POST['id_localisation2']." OR id_localisation = ".$_POST['id_localisation3'].")";
if (empty($dateposted1) OR empty($dateposted2))
{$requete .= " ORDER BY id_ads DESC ";
}
else {
$requete .= " AND (dateposted BETWEEN ".$_POST['dateposted1']." AND ".$_POST['dateposted2'].")";
$requete .= " ORDER BY id_ads DESC ";
}
echo $requete;
$resultads = $db->sql_query($requete);
$totalads = $db->sql_numrows($resultads);
$totalpages = ceil($totalads/$perpage);
if (!$page) {
$page = 1;
}
$start = ($page - 1) * $perpage;
$requete .= " limit $start,$perpage";
if ($totalads == 0) {
echo "<BR><center><b>"._NOADSAVAIL."</b><BR><BR><a href=\"javascript:history.go(-1);\">Retour</a></center>";
} else {
menupage($page,$id_catg,$id_subcatg,$totalpages);
$j = 0;
while (list($id_ads,$title,$cdesc,$prize,$submitter,$ema il,$website,$dateposted) = $db->sql_fetchrow($resultads))
{
//Recherche d'image
$img_txt = "";
$resultimg = $db->sql_query("select img, height, width from ".$prefix."_ads_pictures where id_ads ='".$id_ads."'");
if( list($img_img, $img_height, $img_width)= $db->sql_fetchrow( $resultimg)) {
$img_txt = "<a href=\"modules/Ads/photo/".$img_img."\" target=\"_blank\"><img src=\"modules/Ads/photo/".$img_img."\" alt=\"\"";
if( $img_height != 0 ) {
$img_txt .= "height=\"".$img_height."\"";
}
if( $img_width != 0 ) {
$img_txt .= "width=\"".$img_width."\"";
}
$img_txt .= "border=\"0\"></a>";
}
//Fin Recherche d'image
$j++;
if ($j % 2 == 0) {
$backcolor = "$adsbgcolor1";
} else {
$backcolor = "$adsbgcolor2";
}
echo ""._WEBSITE." : <b>".$website."</b></a>"
." postée le ".FormatDate($dateposted);
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#333333\">"
."<tr bgcolor=\"$bgcolor2\"><td><font class=\"content\"><b>".ucfirst($title)."</b></font></td></tr>"
."<tr bgcolor=\"$backcolor\"><td>"
."<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"1\"><tr><td>".stripslashes($cdesc)."</td></tr>"
."<tr><td><b>"._PRICE." :</b> $prize</td></tr>";
//Affichage de l'image
echo "<td align=\"right\">";
echo "".$img_txt;
echo "</td>";
//Fin Affichage de l'image
echo "</tr>";
echo "<tr><td colspan=\"3\"><div align=\"center\">[ <a href=\"modules.php?name=Private_Messages&send=1&uname=$submitter\">"
.""._SENDPM." ".ucfirst($submitter)."</a> | <a href=\"modules.php?name=$module_name&op=ViewDetailAds&id_ads=$id_ads\">"._ADSDETAIL."</a> ";
echo "]</div>"
."</td></tr></table>";
echo "<tr bgcolor=\"$bgcolor2\"><td align=\"center\">";
echo AdsAdminBlock($id_ads);
echo "</td></tr>";
echo "</td></tr></table>";
echo "<BR>";
}
$db->sql_freeresult($resultads);
menupage($page,$id_catg,$id_subcatg,$totalpages);
}
CloseTable();
include ("footer.php");
} |
Partager