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
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<title>Mini-chat</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" media="screen" type="text/css" title="fichier" href="fichier.css" />
</head>
<body>
<!-- L'en-tête -->
<div id="en_tete">
<p><h3>POSITIONS NSS</h3></p>
</div><hr />
<?php
if (isset($_POST['nom_mic']) AND isset($_POST['aflr']) AND isset($_POST['amet']) AND isset($_POST['Positions_DDF'])) // Si les variables existent
{
if ($_POST['nom_mic'] != NULL AND $_POST['amet'] != NULL AND $_POST['amet'] != NULL) // Si on a quelque chose à enregistrer
{
// D'abord, on se connecte à MySQL
mysql_connect("localhost", "root", "root");
mysql_select_db("correspondance");
// On utilise les fonctions PHP mysql_real_escape_string et htmlspecialchars pour la sécurité
$nom_mic = mysql_real_escape_string(htmlspecialchars($_POST['nom_mic']));
$Positions_Switch = mysql_real_escape_string(htmlspecialchars($_POST['aflr']));
mysql_close();
}
}
// On affiche le formulaire puis les mics du faisceaux
// Tout d'abord le formulaire :
?>
<!-- Le corps -->
<div id="corps">
<form method="post" action="nss.php">
Veuillez renseigner l'un de ces champs pour faire la correspondance:
<table >
<tr><td>Nom_Mic:</td><td><input type="text" name="nom_mic"/></td></tr>
<tr><td>AFLR:</td><td><input type="text" name="aflr" /></td></tr>
<tr><td>AMET:</td><td><input type="text" name="amet" /></td></tr>
<tr><td>DDF_HUAWEI:</td><td><input type="text" name="ddf_hwy" /></td></tr>
<tr><td><input type="submit" value="Envoyer" /></td></tr></table >
</form>
<?php
if(isset($_POST['nom_mic']) AND isset($_POST['amet']) AND isset($_POST['aflr']) AND isset($_POST['ddf_hwy']))
{
$nom_mic=$_POST['nom_mic'];
$aflr=$_POST['aflr'];
$amet=$_POST['amet'];
}
// Maintenant on affiche les mics du faisceaux
// On se connecte d'abord à MySQL :
mysql_connect("localhost", "root", "root");
mysql_select_db("application");
// On utilise la requête suivante pour récupérer les 10 derniers messages :
$reponse = mysql_query("SELECT Nom_mic, CONCAT_WS(' ', ADR_A, TRIB_A, PORT_A, DDF_TRANS_HWY) AS Positions_Trans_A, CONCAT_WS(' ', ADR_B, TRIB_B, PORT_B) AS Positions_Trans_B FROM mic WHERE (nom_mic='$nom_mic') OR (aflr='AFLR=$aflr') OR (amet='AMET=$amet') ORDER BY NOM_MIC") or die (mysql_error());
?>
<div id="voir">
<?php echo'<table border="1"><tr>';
for ($i = 0; $i < mysql_num_fields($reponse); $i++) {
echo '<th>';
echo mysql_field_name($reponse, $i);
echo '</th>';
}
echo '</tr>';
while ($row = mysql_fetch_row($reponse)) {
echo '<tr>';
for ($j = 0; $j < count($row); $j++) {
echo '<td>';
echo ($row[$j] == NULL) ? '<i>NULL</i>' : $row[$j];
echo '</td>';
}
echo '</tr>';
}
// On se déconnecte de MySQL
mysql_close();
?>
</div>
</div>
</body>
</html> |
Partager