Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $db = mysql_connect('localhost', 'root', 'TURLUTUTUSAMERLAPUUUUUUUUUTE');
- if (!$db)
- {
- die('Could not connect: ' . mysql_error());
- }
- mysql_select_db('PCA_PRA',$db);
- ?>
- <html>
- <link rel="stylesheet" media="screen" type="text/css" title="Design" href="./design.css" />
- <?php
- if(!isset($_GET['recherche']) && !isset($_GET['Ressources']) && !isset($_GET['Serveur']) && !isset($_GET['Application']))
- {
- $req = mysql_query('SELECT numRes,nomRes FROM Ressources');
- if(mysql_num_rows($req) != 0)
- {
- ?>
- <table>
- <tr>
- <td>Ressources</td>
- <td>Serveur</td>
- <td>Application</td>
- </tr>
- <tr>
- <td>
- <form method="GET" action="#">
- <select name="Ressources">
- <option value"blank"></option>
- <?php
- while($ligne = mysql_fetch_array($req))
- {
- echo '<option value="'. $ligne['numRes'] . '">' .$ligne['nomRes'] . '</option>';
- }
- }
- else
- {
- echo 'Problème lors de la création de la liste de serveurs';
- }
- ?>
- </select>
- <input type="submit" value="Afficher"></form>
- </td>
- <?php
- }
- else
- {
- if(is_numeric(mysql_real_escape_string($_GET['Ressources']))==true)
- {
- $numRes = mysql_real_escape_string($_GET['Ressources']);
- if($numRes != "blank" && $numRes != NULL)
- {
- $req = mysql_query('SELECT * FROM Ressources where numRes ='.$numRes );
- if(mysql_num_rows($req) != 0)
- {
- $ligne = mysql_fetch_assoc($req);
- afficherRessource($ligne,"0",false);
- $serv = getServByID($ligne['kSrv']);
- if($serv !=false)
- {
- afficherServeur(getServByID($ligne['kSrv']),"0",true);
- }
- }
- else
- {
- echo 'Ressource non trouvée';
- }
- }
- }
- }
- if(!isset($_GET['recherche']) && !isset($_GET['Serveur']) && !isset($_GET['Ressources']) && !isset($_GET['Application']))
- {
- ?>
- <td>
- <form method="GET" action="#">
- <select name="Serveur">
- <option value"blank"></option>
- <?php
- $req = mysql_query('SELECT numSrv,nomSrv FROM Serveurs');
- if(mysql_num_rows($req) != 0)
- {
- while($ligne = mysql_fetch_array($req))
- {
- echo '<option value="'. $ligne['numSrv'] . '">' .$ligne['nomSrv'] . '</option>';
- }
- }
- else
- {
- echo 'Serveur non trouvé';
- }
- ?>
- </select>
- <input type="submit" value="Afficher"></form>
- </td>
- <?php
- }
- else
- {
- if(is_numeric(mysql_real_escape_string($_GET['Serveur']))==true)
- {
- $numSrv = mysql_real_escape_string($_GET['Serveur']);
- if($numSrv != "blank" && $numSrv != NULL)
- {
- $req2 = mysql_query('SELECT * FROM Serveurs where numSrv ='.$numSrv );
- if(mysql_num_rows($req2) != 0)
- {
- $ligne2 = mysql_fetch_assoc($req2);
- if($ligne2 != false)
- {
- afficherServeur($ligne2,"0",false);
- $mat = getMatByID($ligne2['numMat']);
- if($mat != false)
- {
- afficherMateriel($mat,"0",true);
- $req3 = mysql_query('SELECT * FROM Ressources where kSrv ='.$numSrv);
- while($ligne = mysql_fetch_array($req3))
- {
- afficherRessource($ligne,"100",true);
- }
- }
- }
- }
- else
- {
- echo 'Serveur non trouvé';
- }
- }
- }
- }
- if(!isset($_GET['recherche']) && !isset($_GET['Ressources']) && !isset($_GET['Serveur']) && !isset($_GET['Application']))
- {
- ?>
- <form name="input" action="resrecherche.php" method="GET">
- <input type="text" name="recherche" />
- <input type="submit" value="Rechercher" />
- </form>
- <?php
- }
- if(!isset($_GET['recherche']) && !isset($_GET['Serveur']) && !isset($_GET['Ressources']) && !isset($_GET['Application']))
- {
- ?>
- <td>
- <form method="GET" action="#">
- <select name="Application">
- <option value"blank"></option>
- <?php
- $req = mysql_query('SELECT numApp,nomApp FROM Applications');
- if(mysql_num_rows($req) != 0)
- {
- while($ligne = mysql_fetch_array($req))
- {
- echo '<option value="'. $ligne['numApp'] . '">' .$ligne['nomApp'] . '</option>';
- }
- }
- ?>
- </select>
- <input type="submit" value="Afficher"></form>
- </td>
- <?php
- }
- else
- {
- if(is_numeric(mysql_real_escape_string($_GET['Application']))==true)
- {
- $numApp = mysql_real_escape_string($_GET['Application']);
- if($numApp != "blank" && $numApp != NULL)
- {
- $req2 = mysql_query('SELECT * FROM Applications where numApp ='.$numApp );
- if(mysql_num_rows($req2) != 0)
- {
- $ligne2 = mysql_fetch_assoc($req2);
- afficherApplication($ligne2,"0",false);
- $res = GetRessourceByApp($ligne2['numApp']);
- if($res != false)
- {
- afficherRessource($res, "0", true);
- $serv=getServByID($res['kSrv']);
- if($serv!=false)
- {
- afficherServeur($serv,"100", true);
- $mat = getMatByID($serv['numMat']);
- if ($mat !=false)
- {
- afficherMateriel($mat,"200",true);
- }
- }
- }
- }
- else
- {
- echo 'Application non trouvée';
- }
- }
- }
- }
- mysql_close($db); // 6
- ?>
- </tr>
- </table>
- </html>
- <?php
- function getNomTypeSrvByID($kTypeSrv)
- {
- $req=mysql_query('SELECT nomTypeSrv FROM Types_Serveurs where num ='. $kTypeSrv );
- if(mysql_num_rows($req) != 0)
- {
- $ligne = mysql_fetch_assoc($req);
- return $ligne['nomTypeSrv'];
- }
- else
- {
- echo 'Type de serveur non trouvé';
- return false;
- }
- }
- function getNomCatSrvByID($kCategorieSrv)
- {
- $req=mysql_query('SELECT nomCategorieSrv FROM Categories_Serveurs where num ='. $kCategorieSrv );
- if(mysql_num_rows($req) != 0)
- {
- $ligne = mysql_fetch_assoc($req);
- return $ligne['nomCategorieSrv'];
- }
- else
- {
- echo 'Catégorie Serveur non trouvée';
- return false;
- }
- }
- function getMatByID($numMat)
- {
- $req=mysql_query('SELECT * FROM Materiels where num ='. $numMat );
- if(mysql_num_rows($req) != 0)
- {
- $ligne = mysql_fetch_assoc($req);
- return $ligne;
- }
- else
- {
- echo 'Materiel non trouvé';
- return false;
- }
- }
- function getServByID($numSrv)
- {
- $req=mysql_query('SELECT * FROM Serveurs where numSrv ='. $numSrv );
- if(mysql_num_rows($req) != 0)
- {
- $ligne = mysql_fetch_assoc($req);
- return $ligne;
- }
- else
- {
- echo 'Serveur non trouvé';
- return false;
- }
- }
- function GetRessourceByApp ($kApp)
- {
- $req=mysql_query('SELECT kSvc FROM App_Svc where kApp ='. $kApp );
- if(mysql_num_rows($req) != 0)
- {
- $kSvc = mysql_fetch_assoc($req);
- //echo $kSvc['kSvc'];
- $req2=mysql_query('SELECT kRes FROM Svc_Res where kSvc ='. $kSvc['kSvc'] );
- if(mysql_num_rows($req2) != 0)
- {
- $kRes = mysql_fetch_assoc($req2);
- $ligne = GetRessouceById($kRes['kRes']);
- return $ligne;
- }
- else
- {
- echo 'Shit just Happened';
- return false;
- }
- }
- else
- {
- echo 'Ressource non trouvée';
- return false;
- }
- }
- function GetRessouceById ($numRes)
- {
- $req=mysql_query('SELECT * FROM Ressources where numRes ='. $numRes );
- if(mysql_num_rows($req) != 0)
- {
- $ligne = mysql_fetch_assoc($req);
- return $ligne;
- }
- else
- {
- echo 'Ressource non trouvée, 2';
- return false;
- }
- }
- function getTypeAppByID($kTypeApp)
- {
- $req=mysql_query('SELECT nomTypeApp FROM Types_Applications where num ='. $kTypeApp );
- if(mysql_num_rows($req) != 0)
- {
- $ligne = mysql_fetch_assoc($req);
- return $ligne['nomTypeApp'];
- }
- else
- {
- echo 'Type d\'application non trouvé';
- return false;
- }
- }
- function getTypeResByID($kTypeRes)
- {
- $req=mysql_query('SELECT nomTypeRes FROM Types_Ressources where num ='. $kTypeRes );
- if(mysql_num_rows($req) != 0)
- {
- $ligne = mysql_fetch_assoc($req);
- return $ligne['nomTypeRes'];
- }
- else
- {
- echo 'Type de ressource non trouvé';
- return false;
- }
- }
- function afficherServeur($ligne, $margin,$link)
- {
- echo '<table id="serveur" style="margin-left:'. $margin .'px;">';
- echo '<tr>';
- if($link == true)
- {
- echo '<td>';
- echo '<img src="./link.png" />';
- echo '</td>';
- }
- echo '<td>';
- echo '<a href="./index.php?Serveur='.$ligne[numSrv].'"><img src="./serveur.png"/></a>';
- echo '</td>';
- echo '<td style="vertical-align:middle">';
- echo '<p>';
- echo 'Nom du Serveur : '.$ligne['nomSrv'];
- echo '</br>';
- echo 'Fonction du Serveur : '.$ligne['fonctionSrv'];
- echo '</br>';
- echo 'Responsable du Serveur : '.$ligne['responsable'];
- echo '</br>';
- echo 'Type du Serveur : '.getNomTypeSrvByID($ligne['kTypeSrv']);
- echo '</br>';
- echo 'Categorie du Serveur : '.getNomCatSrvByID($ligne['kCategorieSrv']);
- echo '</br>';
- echo '</p>';
- echo '</td>';
- echo '</tr>';
- echo '</table>';
- }
- function afficherMateriel($ligne,$margin, $link)
- {
- echo '<table style="margin-left:'.$margin.'px;">';
- echo '<tr>';
- if($link == true)
- {
- echo '<td>';
- echo '<img src="./link.png" />';
- echo '</td>';
- }
- echo '<td>';
- echo '<img src="./materiel.png"/>';
- echo '</td>';
- echo '<td style="vertical-align:middle">';
- echo '<p>';
- echo 'Fabriquant matériel : '.$ligne['marqueMat'];
- echo '</br>';
- echo 'Modèle du matériel : '.$ligne['nomMat'];
- echo '</br>';
- echo 'Numéro de série matériel : '.$ligne['serialMat'];
- echo '</br>';
- echo 'Processeur : '.$ligne['processeurMat'];
- echo '</br>';
- echo 'Memoire : '.$ligne['memoireMat'];
- echo '</br>';
- echo '</p>';
- echo '</td>';
- echo '</tr>';
- echo '</table>';
- }
- function afficherRessource($ligne,$margin,$link)
- {
- echo '<table style="margin-left:'.$margin.'px;">';
- echo '<tr>';
- if($link == true)
- {
- echo '<td>';
- echo '<img src="./link.png" />';
- echo '</td>';
- }
- echo '<td>';
- echo '<a href="./index.php?Ressources='.$ligne[numRes].'"><img src="./database.png"/></a>';
- echo '</td>';
- echo '<td style="vertical-align:middle;">';
- echo '<p>';
- echo 'Nom Ressource: '.$ligne['nomRes'];
- echo '</br>';
- echo 'Description Ressource : '.$ligne['descriptionRes'];
- echo '</br>';
- echo 'Type de Ressource : '.getTypeResByID($ligne['kTypeRes']);
- echo '</br>';
- echo 'Responsable : '.$ligne['responsable'];
- echo '</br>';
- echo '</p>';
- echo '</td>';
- echo '</tr>';
- echo '</table>';
- }
- function afficherApplication($ligne,$margin,$link)
- {
- echo '<table style="margin-left:'.$margin.'px;">';
- echo '<tr>';
- if($link == true)
- {
- echo '<td>';
- echo '<img src="./link.png" />';
- echo '</td>';
- }
- echo '<td>';
- echo '<a href="./index.php?Application='.$ligne[numApp].'"><img src="./appli.png"/></a>';
- echo '</td>';
- echo '<td style="vertical-align:middle;">';
- echo '<p>';
- echo 'Nom Application: '.$ligne['nomApp'];
- echo '</br>';
- echo 'Description Application : '.$ligne['descriptionApp'];
- echo '</br>';
- echo 'Type de Application : '.getTypeAppByID($ligne['kTypeApp']);
- echo '</br>';
- echo 'Responsable : '.$ligne['responsable'];
- echo '</br>';
- echo '</p>';
- echo '</td>';
- echo '</tr>';
- echo '</table>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement