Inhiber une partie d'un script
Bonjour,
J'aimerais savoir si il était possible d’inhiber une partie de mon script, si la valeur n'existe pas dans ma BDD.
Je m'explique :
Mon script sert a pinguer des écrans de ma société, il est divisé en fonction du type d'écran (TFT, LED ....).
Code:
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
| <?php
set_time_limit(500);
$system = ini_get('system');
$win = is_bool($system);
$counted = 1;
// -------------------------
// Type in the name of the servers inside the quotation marks.
// Add or remove as many as you want but make sure they have an added "services" entry.
// -------------------------
echo '<a><u><b>LED</b></u></a>';
echo "<table border=\"0\" align=\"center\">";
// Connexion à la base de données MySQL
$conn = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
$resultat3 = $conn -> query('SELECT * FROM Secteur1 WHERE type = "LED"');
while($row = $resultat3->fetch_array())
{
$rows[] = $row;
}
foreach($rows as $row)
{
echo "<tr><td width=130>".$row['AdresseIP']."</td>";
echo '<body bgcolor="#FFFFFF" text="#000000"></body>';
//check target IP or domain
$ping = exec("ping -n 1 ".$row['AdresseIP']."");
if (substr($ping, -2) == 'ms')
{
#echo "<td width=60><strong><font color='#006600'>UP</font></strong></td>";
echo "<td width=60><img src='up.png'></td>";
echo "<td width=130>".$row['nom']."</td>";
echo "<td>";
echo '<a href="http://'.$row['AdresseIP'].'" target="_blank">Acces Ecran</a>';
}
else
{
#echo "<td width=60><strong><font color='#990000'>DOWN</font></strong></td>";
echo "<td width=60><img src='down.jpg'></td>";
echo "<td width=130>".$row['nom']."</td>";
echo "<td>";
echo "HS";
}
}
echo "</td></tr></table>";
?> |
(PS:Mon script est une ébauche, mais il fonctionne)
et en dessous le même script mais pour les TFT par exemple.
J'aimerais savoir si il etais possible qu'il ne m'affiche pas le script TFT si il n'y a pas le type correspondant dans ma BDD.
Merci beaucoup.