Guest User

Untitled

a guest
Jul 25th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.92 KB | None | 0 0
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
  2. Transitional//EN"
  3. "http://www.w3.org/TR/html4/loose.dtd">
  4. <html>
  5.  
  6. <head>
  7. <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
  8. <title>Prenotazione Videoconferenza</title>
  9.  
  10. <!-- INIZIO SCRIPT AGGIUNTA DINAMICA -->
  11. <script>
  12. $(document).ready(function() {
  13. $("#add1").click(function(e){
  14.  
  15. var val1 =$("#n1").val();
  16. for(var i=0;i<val1;i++){
  17. $("#start").append($("#first").clone());
  18. }
  19. });
  20. });
  21.  
  22. $(document).ready(function() {
  23. $("#add2").click(function(){
  24.  
  25. var val2 =$("#n2").val();
  26. for(var i=0;i<val2;i++){
  27. $("#start2").append($("#first2").clone());
  28. }
  29. });
  30. });
  31. </script>
  32. <!-- FINE SCRIPT AGGIUNTA DINAMICA -->
  33.  
  34. <!-- INIZIO SCRIPT CALENDARIO -->
  35. <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
  36. <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  37. <link rel="stylesheet" href="/resources/demos/style.css">
  38. <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  39. <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  40. <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.css">
  41. <script src="//cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.js"></script>
  42. <script>
  43.  
  44. $(function() {
  45. $("#datepicker").datepicker();
  46.  
  47. $('.timepicker').timepicker({
  48. timeFormat: 'h:mm p',
  49. interval: 60,
  50. minTime: '8',
  51. maxTime: '08:00pm',
  52. defaultTime: '11',
  53. startTime: '08:00',
  54. dynamic: false,
  55. dropdown: true,
  56. scrollbar: true
  57. });
  58.  
  59.  
  60. });
  61.  
  62. </script>
  63. <!-- FINE SCRIPT CALENDARIO -->
  64.  
  65.  
  66. <link rel="stylesheet" type="text/css" href="style.css">
  67. </head>
  68.  
  69. <body>
  70. <!-- NAV -->
  71. <div class="nav">
  72. <h1>Inserire i dati richiesti:</h1><br><br>
  73. </div>
  74. <!-- FORM GENERALE SINISTRA-->
  75.  
  76. <div class="form">
  77. <div class="left">
  78. <form method="post" action="input.php">
  79. <!-- FORM RICHIEDENTE -->
  80. <div class="form_1">
  81. <b> Richiedente Conferenza:</b>
  82. <br>
  83. <br>
  84. Nome:<input type="text" name="name" size="20"><br>
  85. Cognome:<input type="text" name="surname" size="20"><br>
  86. Email: <input type="email" name="email" size="20"><br>
  87. Oggetto Conferenza:<br><textarea name="testo" rows="5" cols="40" placeholder="Specificare oggetto Videoconferenza"></textarea><br>
  88. </div>
  89. <!-- FINE FORM RICHIEDENTE -->
  90. <br>
  91.  
  92. <!-- FORM INTERNO -->
  93. <div class="form_2">
  94. <b>Partecipanti Interni</b>
  95. <br>
  96. <br>
  97.  
  98. <b> Numero partecipanti interni:</b>
  99. <input type="text" id="n1" value="1"><br>
  100. <button><a href="#" id="add1">Aggiungi partecipante</a></button><br>
  101. <br>
  102. <div id="start">
  103. <div id="first">
  104. Nome:<input type="text" name="iname[]" size="20"><br>
  105. Cognome: <input type="text" name="isurname[]" size="20"><br>
  106. Email: <input type="email" name="iemail[]" size="20"><br>
  107. <br>
  108. </div>
  109. </div>
  110. <br>
  111.  
  112. </div>
  113. <!-- FINE FORM INTERNO -->
  114.  
  115. <br>
  116. <!-- FORM ESTERNO -->
  117. <b>Partecipanti Esterni</b>
  118. <br>
  119. <br>
  120. Numero partecipanti Esterni:
  121. <input type="text" id="n2" value="1"><br>
  122. <button><a href="#" id="add2">Aggiungi partecipante</a></button><br>
  123. <div id="start2">
  124. <div id="first2">
  125. Nome:<input type="text" name="ename[]" size="20"><br>
  126. Cognome: <input type="text" name="esurname[]" size="20"><br>
  127. Email: <input type="email" name="eemail[]" size="20"><br>
  128. <br>
  129. </div>
  130. </div>
  131.  
  132. <!-- FINE FORM ESTERNO -->
  133. <input type="submit" value="Invia" >
  134. </div>
  135. </div>
  136. <!-- INIZIO FORM DI DESTRA -->
  137. <div id="right">
  138.  
  139.  
  140. Date:<br>
  141. <input name="datepicker" id="datepicker" type="text"><br> Orario:
  142. <br>
  143. <input name="hour" type="text" class="timepicker"><br>
  144. </div>
  145. <!-- FINE FORM DI DESTRA -->
  146. </form>
  147. <!-- FINE FORM GENERALE SINISTRA -->
  148. </body>
  149. </html>
  150.  
  151. <?php
  152.  
  153. $conn = @pg_connect("dbname=postgres user=postgres password=123456789");
  154.  
  155. if(!$conn) {
  156. die('Connessione fallita !<br />');
  157. } else {
  158. echo 'Richiesta Effettuata !<br />';
  159. }
  160.  
  161. // Richiedente
  162. $name = $_POST['name'];
  163. $surname = $_POST['surname'];
  164. $email = $_POST['email'];
  165. $testo = $_POST['testo'];
  166. $str_data = $_POST['datepicker'];
  167. $str_hour = $_POST['hour'];
  168.  
  169. //inserting data order
  170. $query1 = "INSERT INTO prenotazione (id,nome_rich, cogn_rich, email_rich,oggetto_rich,data_richiesta,orario_richiesta) VALUES (1,'$name','$surname', '$email','$testo','$str_data', '$str_hour')";
  171. //execute the query here
  172. $result = pg_query($conn, $query1 ); //if you are using pg_query and $conn is the connection resource
  173. // Interni
  174. $query = "";
  175. if( !empty( $_POST['iname'] ) ) {
  176.  
  177. foreach( $_POST['iname'] as $key => $iname ) {
  178.  
  179. $isurname = empty( $_POST[$key]['isurname'] ) ? NULL : $_POST[$key]['isurname'];
  180. $iemail = empty( $_POST[$key]['iemail'] ) ? NULL : $_POST[$key]['iemail'];
  181. if ($query != "" ) {
  182. $query .= ",";
  183. }
  184. $query .= " ( '$iname', '$isurname', '$iemail' ) ";
  185. }
  186. }
  187. if( !empty( $query ) ) {
  188.  
  189. $query2 = "INSERT INTO interni (nome_int, cogn_int, email_int) VALUES ".$query;
  190. $result = pg_query($conn, $query2 ); //if you are using pg_query and $conn is the connection resource
  191. }
  192. // Esterni
  193. $query = "";
  194. if( !empty( $_POST['ename'] ) ) {
  195. foreach( $_POST['ename'] as $key => $ename ) {
  196. $esurname = empty( $_POST[$key]['esurname'] ) ? NULL : $_POST[$key]['esurname'];
  197. $eemail = empty( $_POST[$key]['eemail'] ) ? NULL : $_POST[$key]['eemail'];
  198. if ($query != "" ) {
  199. $query .= ",";
  200. }
  201. $query .= " ( '$ename', '$esurname', '$eemail' ) ";
  202. }
  203. }
  204.  
  205. if( !empty( $query ) ) {
  206.  
  207. $query3 = "INSERT INTO esterni (nome_est, cogn_est, email_est) VALUES " . $query;
  208. $result = pg_query($conn, $query3 ); //if you are using pg_query and $conn is the connection resource
  209. }
  210.  
  211. // Calendario
  212.  
  213. /*
  214. $str_data = addslashes($_POST['datepicker']);
  215. $str_hour = addslashes($_POST['hour']);
  216.  
  217. $sql = "INSERT INTO appuntamenti (str_data,hour ) VALUES ('$str_data', '$str_hour')";
  218. */
  219.  
  220. ?>
Add Comment
Please, Sign In to add comment