Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- VERIFICATION DE CONNEXION -->
- <?php
- session_start();
- if (!isset($_SESSION['login']))
- {
- header ('Location: index.php');
- exit();
- }
- ?>
- <!-- MANAGEMENT TABLE DISPLAY -->
- <?php
- ini_set ("display_errors",0);error_reporting(0);
- /* VARIABLE DECLARATION */
- $oui = 'OUI';
- $non = 'NON';
- $line = 4;
- $column = 0;
- $string_table = array();
- $column8 = 7;
- $column9 = 8;
- $line2 = 4;
- $size_table = 0;
- $index_percent = 0;
- $row = 1;
- $f = 0;
- $class1 = '';
- $class2 = '';
- $class3 = '';
- $class4 = '';
- $class5 = '';
- $class6 = '';
- $class7 = '';
- $class8 = '';
- $class9 = '';
- $class10 = '';
- $class11 = '';
- $check1 = '';
- $check2 = '';
- $Start_data = '';
- $Close_data = '';
- $Button = '';
- $name_radio = 1;
- /* STOCK IN TABLE 'table_str' THE STRING OF CSV FILE */
- if (($handle = fopen("tes.csv", "r")) !== FALSE) {
- while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
- $num = count($data);
- $row++;
- for ($c=0; $c < $num; $c++)
- {
- $f++;
- $table_str[$f] = explode(";", $data[$c]);
- }
- }
- /* COUNT LINE OF TABLE 'table_str' */
- While (isset($table_str[$line2])==TRUE)
- {
- $size_table++;
- $line2++;
- }
- /* DELETE CHAR '"' OF TABLE 'table_str' AND STOCK IN AN NEW OPTIMIZE TABLE2 'string_table' */
- for ($h = 0; $h < $size_table; $h++)
- {
- for ($i = 0; $i <12; $i++)
- {
- $test = $table_str[$line][$column];
- $test = strtok($test, '"');
- $string_table[$h][$column] = $test;
- $column++;
- //$string_table = str_replace('"', '', $string_table);
- }
- $percentage[$index_percent] = strtok($string_table[$h][$column8], '%');
- $index_percent++;
- $percentage[$index_percent] = strtok($string_table[$h][$column9], '%');
- $index_percent++;
- $column = 0;
- $line++;
- }
- //var_dump ($string_table);
- fclose($handle);
- }
- ?>
- <!-- GUI -->
- <html>
- <head>
- <meta charset="iso-8859-1">
- <link href='https://fonts.googleapis.com/css?family=Orbitron:400,500,700,900' rel='stylesheet' type='text/css'>
- <link rel="stylesheet" href="style.css" />
- <title>Phase Test</title>
- </head>
- <body>
- <p class=var_sess><?php echo 'Bonjour '.$_SESSION['login'].''; ?></b><input type="submit" value="Déconnexion" onclick="self.location.href='deconnexion.php'"></input></p>
- <p><img src='IMAGE/LOGO2.png' alt= "erreur logo"></img></p>
- <p class="titre">Accès informations</p>
- <br><br>
- <table> <!-- TABLE WATERING -->
- <caption>Tableau de contrôle des arroseurs</caption>
- <thead> <!-- HEAD TABLE -->
- <tr>
- <th colspan="1" class=title1 ></th>
- <th colspan="4" class=title >ANOMALIES ARROSAGE</th>
- <th colspan="2" class=title >DETECTION ARROSAGE</th>
- <th colspan="2" class=title >NIVEAUX</th>
- <th colspan="6" class=title >ETAT ARROSAGE</th>
- </tr>
- <tr>
- <th class=subtitle >ARROSEURS</th>
- <th class=subtitle >BATTERIE</th>
- <th class=subtitle >PRESSION EAU</th>
- <th class=subtitle >ROTATION ENROULEUR</th>
- <th class=subtitle >FUITE</th>
- <th class=subtitle >PREMIER ANNEAU</th>
- <th class=subtitle >DEUXIEME ANNEAU</th>
- <th class=subtitle >EAU</th>
- <th class=subtitle >BATTERIE</th>
- <th class=subtitle >EN MARCHE</th>
- <th class=subtitle >EN ARRET</th>
- <th class=subtitle >EN PANNE</th>
- <th class=subtitle >DEMARRER/CONTINUER</th>
- <th class=subtitle >ARRÊTER</th>
- <th class=subtitle >VALIDER</th>
- </tr>
- </thead>
- <tbody> <!-- BODY TABLE -->
- <?php
- $index_percent = 0;
- $Start_data = "<form action='script_validate.php' method='post'>";
- $Close_data = "</form>";
- $Button = "<input type='submit' name='Valider' value='Envoyer' Onclick='window.location='script_validate.php''></td>";
- for($z = 0; $z < $size_table; $z++)
- {
- if($string_table[$z][1] == 'OUI'){$class1 = 'class=red';}else{$class1 = 'class=green';}
- if($string_table[$z][2] == 'OUI'){$class2 = 'class=red';}else{$class2 = 'class=green';}
- if($string_table[$z][3] == 'OUI'){$class3 = 'class=red';}else{$class3 = 'class=green';}
- if($string_table[$z][4] == 'OUI'){$class4 = 'class=red';}else{$class4 = 'class=green';}
- if($string_table[$z][5] == 'OUI'){$class5 = 'class=green';}else{$class5 = 'class=orange';}
- if($string_table[$z][6] == 'OUI'){$class6 = 'class=green';}else{$class6 = 'class=orange';}
- if($percentage[$index_percent] <= 20){$class7 = 'class=red';} if(($percentage[$index_percent] >= 21)&&($percentage[$index_percent] <= 49)){$class7 = 'class=orange';}if($percentage[$index_percent] >= 50){$class7 = 'class=green';}
- $index_percent++;
- if($percentage[$index_percent] <= 20){$class8 = 'class=red';} if(($percentage[$index_percent] >= 21)&&($percentage[$index_percent] <= 49)){$class8 = 'class=orange';}if($percentage[$index_percent] >= 50){$class8 = 'class=green';}
- $index_percent++;
- if($string_table[$z][9] == 'NON'){$class9 = 'class=orange';}else{$class9 = 'class=green';}
- if($string_table[$z][10] == 'NON'){$class10 = 'class=green';}else{$class10 = 'class=orange';}
- if($string_table[$z][11] == 'NON'){$class11 = 'class=green';}else{$class11 = 'class=red';}
- if($string_table[$z][9] == 'OUI'){$check1 = 'checked="checked"';}else{$check1 = '';}
- if($string_table[$z][9] == 'NON'){$check2 = 'checked="checked"';}else{$check2 = '';}
- echo "<tr>";
- echo "<td>",$string_table[$z][0],"</td>";
- echo "<td ",$class1," >",$string_table[$z][1],"</td>";
- echo "<td ",$class2," >",$string_table[$z][2],"</td>";
- echo "<td ",$class3," >",$string_table[$z][3],"</td>";
- echo "<td ",$class4," >",$string_table[$z][4],"</td>";
- echo "<td ",$class5." >",$string_table[$z][5],"</td>";
- echo "<td ",$class6." >",$string_table[$z][6],"</td>";
- echo "<td ",$class7," >",$string_table[$z][7],"</td>";
- echo "<td ",$class8," >",$string_table[$z][8],"</td>";
- echo "<td ",$class9," >",$string_table[$z][9],"</td>";
- echo "<td ",$class10," >",$string_table[$z][10],"</td>";
- echo "<td ",$class11," >",$string_table[$z][11],"</td>";
- if($z == 0){echo $Start_data;}
- echo "<td><input type='radio' name='radio_",$name_radio,"' value='OUI' ",$check1," ></td>";
- echo "<td><input type='radio' name='radio_",$name_radio,"' value='NON' ",$check2," ></td>";
- $name_radio++;
- if($z == 0){echo "<td rowspan=",$size_table," >",$Button;}
- if(($z+1) == $size_table){echo $Close_data;}
- if($z == 0){echo "<input type='hidden' name='size' value='",$size_table,"'></td>";}
- echo "</tr>";
- }
- ?>
- </tbody>
- <tfoot> <!-- FEET TABLE -->
- </tfoot>
- </table>
- <h3>Légende : <span class=green > Vert : Aucune Anomalie</span> <span class=orange>Orange : Traitement en cours/ Anomalie mineure</span> <span class=red>Rouge : Anomalie majeure</span>
- </body>
- </html>
Add Comment
Please, Sign In to add comment