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
| <html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Document sans titre</title>
</head>
<body>
<?php
$liendb = mysql_connect("nomserveur","user","pass");
mysql_select_db ("nombase");
function protection(&$value) {
$value = (get_magic_quotes_gpc())? mysql_real_escape_string(stripslashes(trim($value))) : mysql_real_escape_string(trim($value));
return $value;
}
$quoi = !empty($_POST['quoi'])? protection($_POST['quoi']) : '';
$endroit = !empty($_POST['endroit'])? protection($_POST['endroit']) : '';
$sql= "SELECT texte,titre,id FROM annonce WHERE categorie = '" . $quoi . "' AND departement = '" . $endroit . "'";
if (empty($_POST['mot']) === FALSE) {
$tab = explode(' ', $_POST['mot']);
array_walk($tab, 'protection');
$IN = implode("','", $tab);
$sql .= " AND motcle1 IN ('$IN')";
}
$resultat_sql = mysql_query($sql) or die (mysql_error());
$nombreDeMessagesParPage = 2;
$n =mysql_num_rows($resultat_sql);
$nombresDePages =ceil($n/$nombreDeMessagesParPage );
echo 'Page : ';
for ($i = 1 ; $i <= $nombresDePages ; $i++)
{
echo '<a href="integrationmotcleetlienpage.php?page=' . $i . '">' . $i . '</a> ';
}
if (isset($_GET['page']))
{
$page = $_GET['page']; }
else
{
$page = 1; }
$premierMessageAafficher = ($page - 1) * $nombreDeMessagesParPage;
$sqll= "SELECT texte,titre,id FROM annonce WHERE categorie = '" . $quoi . "' AND departement = '" . $endroit . "' ORDER BY id DESC LIMIT " . $premierMessageAafficher . ", " . $nombreDeMessagesParPage;
if (empty($_POST['mot']) === FALSE) {
$tab = explode(' ', $_POST['mot']);
array_walk($tab, 'protection');
$IN = implode("','", $tab);
$sqll .= " AND motcle1 IN ('$IN')";
}
$resultatt_sql = mysql_query($sqll) or die (mysql_error());
?>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Document sans nom</title>
</head>
<body>
<table style="border:1px solid black; width:100%">
<?php while ($resultat = mysql_fetch_assoc($resultatt_sql))
{ ?>
<tr>
<td><a href="description50page.php?<?php echo 'id='.intval($resultat['id']) ?>"><?php echo htmlentities($resultat['titre'])?></a></td>
</tr>
<?php } mysql_free_result($resultatt_sql);
mysql_close($liendb);
?>
</table>
</body>
</html> |
Partager