peewai renversant | Bonjour,
Je rencontre un probleme avec le code suivant:
Code :
- <html>
- <head>
- <title>Document sans titre</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- </head>
- <body>
- <p>Intégration des jobs.</p>
- <p> </p>
- <form name="form1" method="post" action="">
- <p>Ref Client:
- <select name="inst" id="inst">
- <?php
- require "Fonctions.inc.php";
- $i = 0;
- $inst = strtoupper($inst);
- $IdInst = getIdInst();
- $LibInst = getLibInst();
- $sizeArrIdInst = count($IdInst);
- print "<option selected>$inst</option>";
- while($i != $sizeArrIdInst)
- {
- if(rtrim($LibInst[$i]) != $inst)
- {
- print '<option value="$IdInst[$i]">'.rtrim($LibInst[$i])."</option>\n";
- }
- $i++;
- }
- ?>
- </select>
- </p>
- <br>
- <p>
- <?php
- $date = date("j-M-Y" );
- $date = strtoupper($date);
- $arrGen = array();
- $arrNomJob = array();
- $arrHeure = array();
- $arrGen = SearchLine_i("./fichiers/exploit/$fichier","^Batch queue ([A-Z]+_(BATCH|EXPB))","(^)","(^ +Entry)","^ +[0-9]+ +([A-Z_-]+)","( +[A-Z]+ +Holding until $date)","^ +[A-Z]+ + Holding Until [0-9]{2}-[A-Z]{2}-[0-9]{4} ([0-9:.])"," +[A-Z]+ +Holding until $date ([0-9:.]+)" );
- // $fichier | $regs1 ||$regs2| | $regs3 | | $regs4 | | $regs5 | | $regs6 | | $regs7 |
- foreach($arrGen as $CléNomQueue => $NomQueue)
- {
- // impression du nom de queue
- print "<br><strong><u>$CléNomQueue:</u></strong>\n";
- print '<input name="hiddenField" type="hidden" value="NOMJEU">'."\n";
- // création du tableau
- print '<table width="60%" border="1">'."\n";
- print '<tr bgcolor="#CCCCCC">'."\n";
- print ' <td width="61%"><div align="center">Job </div></td>'."\n";
- print ' <td width="22%"><div align="center">Heure</div></td>'."\n";
- print ' <td width="17%"><div align="center">Au planning</div></td>'."\n";
- print "</tr>\n";
- foreach($NomQueue as $NomJob)
- {
- print "<tr>\n";
- print " <td>|$NomJob|</td>\n";
- /* foreach($NomJob as $Heure)
- {
- print " <td><div align=\"center\">****$Heure****</div></td>\n";
- }
- print ' <td><div align="center">'."\n";
- print " <input type=\"checkbox\" name=\"checkbox\" value=\"au_planning\">\n";
- print ' </div></td>'."\n";
- print '</tr>'."\n";
- */ }
- print '</table>'."\n";
- }
- ?>
- <p align="center">
- <input type="submit" name="Submit" value="Envoyer">
- </p>
- </form>
- </body>
- </html>
|
et
Code :
- <?php
- function SearchLine_i($fichier,$regs1,$regs2,$regs3,$regs4,$regs5,$regs6,$regs7)
- {
- $handle = fopen($fichier,"r" );
- $arrGen = array();
- $arrNomJob = array();
- $arrNomQueue = array();
- $arrHeure = array();
- $GotLine = fgets($handle);
- $arrHeure = array ();
- $arrGen[$arrNomQueue[$arrHeure[1]]] = array ();
- while(!feof($handle))
- {
- if(ereg($regs1,$GotLine,$arrNomQueue))
- { // Recherche de Batch queue
- $GotLine = fgets($handle);
- $arrGen[$arrNomQueue[1]] = array();
- if(ereg($regs2,$GotLine))
- { // Recherche d'un saut de ligne
- $GotLine = fgets($handle);
- if(ereg($regs3,$GotLine))
- { // Recherche de Entry
- $GotLine = fgets($handle);
- $GotLine = fgets($handle);
- while(ereg($regs4,$GotLine,$arrNomJob))
- { // Recherche et extraction du nom de job
- if(strlen($arrNomJob[1]) > 15)
- { // Pour les lignes trop longues
- $GotLine = fgets($handle);
- if(ereg($regs5,$GotLine))
- { // Verif date
- ereg($regs6,$GotLine,$arrHeure);
- array_push($arrGen[$arrNomQueue[1]],$arrNomJob[1]);
- array_push($arrGen[$arrNomQueue[$arrHeure[1]]],$arrHeure[1]);
- }
- }
- else
- {
- if(ereg($regs5,$GotLine))
- { // Verif date
- ereg($regs7,$GotLine,$arrHeure);
- array_push($arrGen[$arrNomQueue[1]],$arrNomJob[1]);
- array_push($arrGen[$arrNomQueue[$arrHeure[1]]],$arrHeure[1]);
- }
- }
- $GotLine = fgets($handle);
- }
- }
- else
- { //Si Entry pas trouvé, on recommence la boucle
- $arrHeure[1] = 'n/a';
- array_push($arrGen[$arrNomQueue[1]],"Pas de jobs positionnés en attente dans cette queue.<br>\n" );
- array_push($arrGen[$arrNomQueue[$arrHeure[1]]],$arrHeure[1]);
- }
- }
- }
- else
- { // Si Batch queue pas trouvé, on passe à la ligne d'après et on recommence la boucle
- $GotLine = fgets($handle);
- }
- }
- return $arrGen;
- }
- ?>
|
mon probleme est lié au tableau a 3 dimensions. je n'arrive pas a le remplir dans la fonction avec le array_push(). je ne suis aps sur non plus de mes boucles foreach()...
la partie analyse des logs avec les expressions regulieres marche tres bien, le pb est uniquement lié aux arrays.
Merci de l'aide que vous pourrez m'apporter Message édité par peewai le 28-07-2003 à 15:01:05
|