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
|
<!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=iso-8859-1" />
<title>LOGI'EIPC</title>
<meta name="robots" content="index, follow" />
<meta name="revisit-after" content="21 days" />
<meta name="author" content="" />
<meta name="copyright" content="" />
<meta name="rating" content="Global" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="Description" content="" />
<meta name="Keywords" content="" />
<meta name="abstract" content="" />
<link type="text/css" rel="stylesheet" href="layout.css" title="default" media="all" />
</head>
<body id="home">
<div id="main-wrapper">
<div id="logo">
<a href="index.html" title="Find a Property home">LOGI'<span>EIPC</span></a></div>
<div id="nav-wrapper">
<div id="navigation">
<ul>
<li><a href="../index.php" title="Accueil" id="home-link">Accueil</a></li>
<li><a href="../services2.php" title="Information" id="info-link">Informations</a></li>
<li><a href="../news.php" title="Les news" id="news-link">News</a></li>
<li><a href="../offre2.php" title="Les offres" id="offres-link">Les offres</a></li>
<li><a href="admin.php" title="services" id="admin-link">Administration</a></li>
<li><a href="../contact.html" title="Une question ?" id="contact-link" class="last">Nous Contacter</a></li>
</ul>
</div>
<div id="nav-right">
</div>
</div>
<div class="clear"></div>
<div id="content-area">
<br />
<div id="content-top"></div>
<div id="content-main">
<h2><a href="rediger_offre.php">Ajouter une annonce</a>     <a href="admin.php">Retour à l'Administration</a> </h2>
<?php
mysql_connect("localhost", "root", "");
mysql_select_db("base_logement");
//-----------------------------------------------------
// Vérification 1 : est-ce qu'on veut poster une nouvelle offre ?
//-----------------------------------------------------
//isset($_POST['meuble']) AND isset($_POST['loyer']) AND isset($_POST['superficie']) AND isset($_POST['description'])
//AND isset($_POST['prenom_proprio']) AND isset($_POST['nom_proprio']) AND isset($_POST['rue']) AND isset($_POST['code_postal']) AND isset($_POST['ville']) AND isset($_POST['num_fixe'])
//AND isset($_POST['num_portable'])
if (isset($_POST['meuble']) AND isset($_POST['loyer']) AND isset($_POST['superficie']) AND isset($_POST['description'])
AND isset($_POST['prenom_proprio']) AND isset($_POST['nom_proprio']) AND isset($_POST['rue']) AND isset($_POST['code_postal']) AND isset($_POST['ville']) AND isset($_POST['num_fixe'])
AND isset($_POST['num_portable']))
{
echo 'test ok' ;
/*
$meuble = addslashes($_POST['meuble']);
$loyer = addslashes($_POST['loyer']);
$distance = addslashes($_POST['distance']);
$superficie = addslashes($_POST['superficie']);
$description = addslashes($_POST['description']);
$prenom_proprio = addslashes($_POST['prenom_proprio']);
$nom_proprio = addslashes($_POST['nom_proprio']);
$rue = addslashes($_POST['rue']);
$code_postal = addslashes($_POST['code_postal']);
$ville = addslashes($_POST['ville']);
$num_fixe = addslashes($_POST['num_fixe']);
*/
$meuble = mysql_real_escape_string($_POST['meuble']);
$loyer = mysql_real_escape_string($_POST['loyer']);
$distance = mysql_real_escape_string($_POST['distance']);
$superficie = mysql_real_escape_string($_POST['superficie']);
$description = mysql_real_escape_string($_POST['description']);
$prenom_proprio = mysql_real_escape_string($_POST['prenom_proprio']);
$nom_proprio = mysql_real_escape_string($_POST['nom_proprio']);
$rue = mysql_real_escape_string($_POST['rue']);
$code_postal = mysql_real_escape_string($_POST['code_postal']);
$ville = mysql_real_escape_string($_POST['ville']);
$num_fixe = mysql_real_escape_string($_POST['num_fixe']);
$num_portable = mysql_real_escape_string($_POST['num_portable']);
// On vérifie si c'est une modification des offres ou pas
if ($_POST['id_offre'] == 0)
{
echo "nouvelle offre >> id_news ==0 ";
// Ce n'est pas une modification, on crée une nouvelle entrée dans la table
mysql_query("INSERT INTO base_logement VALUES('', '" . $meuble . "', '" . $loyer . "', '" . $distance . "', '" . $superficie . "', '" . $description . "', '" . $prenom_proprio . "','" . $nom_proprio . "','" . $rue . "','" .$code_postal . "', '" . $ville . "', '" . $num_fixe . "', '" . $num_portable . "')");
}
else
{
// On protège la variable "id_offre" pour éviter une faille SQL
$_POST['id_offre'] = addslashes($_POST['id_offre']);
// C'est une modification, on met juste à jour le différents champs
mysql_query("UPDATE base_logement SET meuble='" . $meuble . "', loyer='" . $loyer . "', distance='" . $distance . "', superficie='" . $superficie . "', description='" . $description . "', prenom_proprio='" . $prenom_proprio . "', nom_proprio='" . $nom_proprio . "', rue='" . $rue . "', code_postal='" . $code_postal . "', ville='" . $ville . "', num_fixe='" . $num_fixe . "', num_portable='" . $num_portable . "' WHERE id='" . $_POST['id_offre'] . "'");
}
}
//--------------------------------------------------------
// Vérification 2 : est-ce qu'on veut supprimer l'offre ?
//--------------------------------------------------------
if (isset($_GET['supprimer_offre'])) // Si on demande de supprimer une offre
{
// Alors on supprime l'offre correspondante
// On protège la variable "id_offre" pour éviter une faille SQL
$_GET['supprimer_offre'] = addslashes($_GET['supprimer_offre']);
mysql_query('DELETE FROM base_logement WHERE id=\'' . $_GET['supprimer_offre'] . '\'');
}
?>
<center>
<table border=1>
<tr>
<th>Modifier</th>
<th>Supprimer</th>
<th>Type</th>
<th>Meuble</th>
<th>Loyer</th>
<th>Distance</th>
<th>Superficie</th>
<th>Prenom_proprio</th>
<th>Nom_proprio</th>
<th>Rue</th>
<th>Code Postale</th>
<th>Ville</th>
</tr>
</center>
<?php
$retour = mysql_query('SELECT * FROM base_logement ORDER BY id DESC');
while ($donnees = mysql_fetch_array($retour)) // On fait une boucle pour lister les news
{
?>
<tr align="center">
<td><?php echo '<a href="rediger_offre.php?modifier_offre=' . $donnees['id'] . '">'; ?>Modifier</a></td>
<td><?php echo '<a href="liste_offre.php?supprimer_offre=' . $donnees['id'] . '">'; ?>Supprimer</a></td>
<td><?php echo stripslashes($donnees['type']); ?></td>
<td><?php echo stripslashes($donnees['meuble']);?></td>
<td><?php echo stripslashes($donnees['loyer']);?></td>
<td><?php echo stripslashes($donnees['distance']);?></td>
<td><?php echo stripslashes($donnees['superficie']);?></td>
<td><?php echo stripslashes($donnees['prenom_proprio']);?></td>
<td><?php echo stripslashes($donnees['nom_proprio']);?></td>
<td><?php echo stripslashes($donnees['rue']);?></td>
<td><?php echo stripslashes($donnees['code_postal']);?></td>
<td><?php echo stripslashes($donnees['ville']);?></td>
</tr>
<?php
} // Fin de la boucle qui liste les offres
?>
</table>
</div>
</div>
</body>
</html> |