PageRenderTime 46ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/cercaxpc.php

https://bitbucket.org/amorello/changeover
PHP | 322 lines | 276 code | 33 blank | 13 comment | 28 complexity | 62e884094543e48788acdd552404efef MD5 | raw file
  1. <?php
  2. session_start();
  3. include 'CSS/templateTop.html';
  4. require_once 'login.php';
  5. if(!isset($_SESSION['changeover_IDutente'])){
  6. header("location: index.php");
  7. }
  8. else
  9. {
  10. /*
  11. /* per far accedere alla pagina solo un amministratore
  12. if($_SESSION['nonconf_DBA']=='Y')
  13. {
  14. */
  15. include 'barramenu.php';
  16. echo <<<_END
  17. CERCA:<br>
  18. <form action="cercaxpc.php" method="post"><pre><br>
  19. Per ID_bene:<input type="text" name="ID_bene"/><br>
  20. <input type="submit" name="cerca" value="CERCA" />
  21. </pre></form>
  22. _END;
  23. if(isset($_POST['cerca'])){
  24. if(isset($_POST['ID_bene'])){
  25. $temp= $_POST['ID_bene'];
  26. $condizione="ID_bene=\"$temp\"";
  27. }
  28. //cerca e restituisce la linea corrispondente
  29. $query = "SELECT * FROM pc WHERE $condizione";
  30. $result2 = mysql_query($query);
  31. if (!$result2) die ("Database access failed: " . mysql_error().$query);
  32. $row2 = mysql_fetch_row($result2);
  33. $bene= $row2[0];
  34. $ID_bene = $row2[1];
  35. $marcamodello= $row2[2];
  36. $ID_monitor = $row2[3];
  37. $pollici= $row2[4];
  38. echo <<<_END
  39. <table border="5" bordercolor= "#6FD1D2" rules="all" cellspacing="5" width="900" >
  40. <tr bgcolor="#6FD1D2" bordercolor= "#6FD1D2" >
  41. <td width="70%">
  42. <table align="left">
  43. <tr>
  44. <td align="left">
  45. <table>
  46. <tr>
  47. <td>PC</td>
  48. </tr>
  49. <tr>
  50. <td>Utente di riferimento &nbsp &nbsp</td>
  51. </tr>
  52. <tr>
  53. <td>Collocazione</td>
  54. </tr>
  55. </table>
  56. </td>
  57. <td></td>
  58. <td></td>
  59. </tr>
  60. </table>
  61. </td>
  62. <td bgcolor="#FF0000" bordercolor= "#FF0000" >
  63. STATO
  64. </td>
  65. <td bgcolor="#FFCC33" bordercolor= "#FFCC33" >
  66. SOPRALLUOGO
  67. </td>
  68. </tr>
  69. _END;
  70. if($bene!=0){
  71. $query = "SELECT * FROM interventi WHERE bene=\"$bene\"";
  72. $result = mysql_query($query);
  73. if (!$result) die ("Database access failed: " . mysql_error().$query);
  74. $righe = mysql_num_rows($result);
  75. for ($j = 0 ; $j < $righe ; ++$j)
  76. {
  77. $row = mysql_fetch_row($result);
  78. $ID = $row[0];
  79. $tipo = $row[1];
  80. $collocazione= $row[3];
  81. $query = "SELECT * FROM collocazione WHERE ID=$collocazione";
  82. $result2 = mysql_query($query);
  83. if (!$result2) die ("Database access failed: " . mysql_error());
  84. $row2 = mysql_fetch_row($result2);
  85. $ubicazione = $row2[1];
  86. $sc= $row2[2];
  87. $ufficio = $row2[3];
  88. $query = "SELECT * FROM sc WHERE ID=$sc";
  89. $result2 = mysql_query($query);
  90. if (!$result2) die ("Database access failed: " . mysql_error());
  91. $row2 = mysql_fetch_row($result2);
  92. $sc = $row2[1];
  93. $cognome_nome_utente = $row[4];
  94. $telefono = $row[5];
  95. $n1 = $row[8];
  96. $n2 = $row[9];
  97. $n3 = $row[10];
  98. $presadirete=$row[6];
  99. $attiva=$row[7];
  100. $sopralluogo = $row[11];
  101. $stato= $row[12];
  102. $esito= $row[13];
  103. $statol= '';
  104. switch ($stato) {
  105. case "R" :
  106. $statol= 'RICHIESTO';
  107. break;
  108. case "A" :
  109. $statol= 'APPROVATO';
  110. break;
  111. case "S" :
  112. $statol= 'SOSPESO';
  113. break;
  114. case "E" :
  115. $statol= 'EFFETTUATO';
  116. break;
  117. default :
  118. $statol= '';
  119. break;}
  120. $datarichiesta = $row[15];
  121. list($data_a,$data_m,$data_g) = explode("-",$datarichiesta);
  122. $time = mktime(0,0,0, $data_m, $data_g, $data_a);
  123. $datarichiesta= date ('d-m-Y',$time);
  124. echo <<<_END
  125. <tr>
  126. <td>
  127. <table align="left">
  128. <tr>
  129. <td align="left">
  130. <font class="rosso">$ID &nbsp &nbsp &nbsp</font>
  131. _END;
  132. if($tipo=='sost')
  133. echo "<font class=\"blue\">SOSTITUZIONE</font>&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp $datarichiesta";
  134. if($tipo=='nuovo')
  135. echo"<font class=\"blue\">NUOVO</font>&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp $datarichiesta";
  136. if($tipo=='sost'){
  137. echo <<<_END
  138. <table>
  139. <tr>
  140. <td>$ID_bene</td>
  141. <td>$marcamodello</td>
  142. <td>&nbsp &nbsp</td>
  143. <td>$ID_monitor</td>
  144. <td>$pollici</td>
  145. </tr>
  146. </table>
  147. _END;
  148. }
  149. echo <<<_END
  150. <table>
  151. <tr>
  152. <td>$cognome_nome_utente &nbsp &nbsp </td>
  153. <td>$telefono</td>
  154. </tr>
  155. </table>
  156. <table>
  157. <tr>
  158. <td>$ubicazione</td>
  159. <td>$sc</td>
  160. <td>$ufficio</td>
  161. </tr>
  162. </table>
  163. _END;
  164. if($n1!=0 || $n2!=0 ||$n3!=0)
  165. {
  166. echo <<<_END
  167. Note:
  168. <table>
  169. _END;
  170. if($n1!=0)
  171. {
  172. $query = "SELECT * FROM note WHERE ID=$n1";
  173. $result2 = mysql_query($query);
  174. if (!$result2) die ("Database access failed: " . mysql_error());
  175. $row2 = mysql_fetch_row($result2);
  176. $nota1 = $row2[1];
  177. echo <<<_END
  178. <tr>
  179. <td>Programmi:</td>
  180. <td>$nota1</td>
  181. </tr>
  182. _END;
  183. }
  184. if($n2!=0)
  185. {
  186. $query = "SELECT * FROM note WHERE ID=$n2";
  187. $result2 = mysql_query($query);
  188. if (!$result2) die ("Database access failed: " . mysql_error());
  189. $row2 = mysql_fetch_row($result2);
  190. $nota2 = $row2[1];
  191. echo <<<_END
  192. <tr>
  193. <td>Orario:</td>
  194. <td>$nota2</td>
  195. </tr>
  196. _END;
  197. }
  198. if($n3!=0)
  199. {
  200. $query = "SELECT * FROM note WHERE ID=$n3";
  201. $result2 = mysql_query($query);
  202. if (!$result2) die ("Database access failed: " . mysql_error());
  203. $row2 = mysql_fetch_row($result2);
  204. $nota3 = $row2[1];
  205. echo <<<_END
  206. <tr>
  207. <td>Varie:</td>
  208. <td>$nota3</td>
  209. </tr>
  210. _END;
  211. }
  212. echo <<<_END
  213. </table>
  214. _END;
  215. }
  216. echo <<<_END
  217. <form action="modifica.php" method="post"><pre><input type="hidden" name="ID" value="$ID" ><input type="submit" name="modifica" value="MODIFICA" /></td>
  218. </pre></form>
  219. </tr>
  220. </table>
  221. </td>
  222. <td bordercolor= "#FF0000" >
  223. <u><a title="$statol"> $stato</a></u>
  224. </td>
  225. <td bordercolor= "#FFCC33" >
  226. _END;
  227. if ($sopralluogo==0){
  228. echo <<<_END
  229. <form action="sopralluogo.php" method="post"><pre>
  230. <input type="hidden" name="ID" value="$ID">
  231. <input type="submit" name="sopralluogo" value="INSERISCI SOPRALLUOGO" />
  232. </pre></form>
  233. _END;
  234. }else{
  235. $query = "SELECT * FROM sopralluogo WHERE ID=\"$sopralluogo\"";
  236. $result2 = mysql_query($query);
  237. if (!$result2) die ("Database access failed: " . mysql_error());
  238. $row2 = mysql_fetch_row($result2);
  239. $presarete = $row2[1];
  240. $corrente = $row2[2];
  241. $nsop = $row2[3];
  242. if($nsop!=0)
  243. {
  244. $query = "SELECT nota FROM note WHERE ID=\"$nsop\"";
  245. $result2 = mysql_query($query);
  246. if (!$result2) die ("Database access failed: " . mysql_error());
  247. $row2 = mysql_fetch_row($result2);
  248. $notasop = $row2[0];
  249. }
  250. else{
  251. $notasop=' ';
  252. }
  253. echo <<<_END
  254. corrente: $corrente
  255. <br>
  256. presarete: $presarete $presadirete $attiva
  257. <br>
  258. $notasop
  259. <br>esito:
  260. _END;
  261. if($esito=='S')
  262. echo"POSITIVO";
  263. if($esito=='N')
  264. echo"NEGATIVO";
  265. echo <<<_END
  266. <form action="modsopralluogo.php" method="post"><pre>
  267. <input type="hidden" name="ID" value="$ID">
  268. <input type="submit" name="modifica" value="MODIFICA" />
  269. </pre></form>
  270. _END;
  271. }
  272. echo <<<_END
  273. </td>
  274. </tr>
  275. _END;
  276. }
  277. }
  278. echo" </table>";
  279. }
  280. /*
  281. } else
  282. {
  283. echo "protezione pagina - no diritti di amministrazine";
  284. }
  285. */
  286. }
  287. include 'CSS/templateEnd.html';
  288. ?>