PageRenderTime 64ms CodeModel.GetById 36ms RepoModel.GetById 0ms app.codeStats 0ms

/cercaxid.php

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