Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Invio dati </title>
  4. </head>
  5. <body>
  6. <?php
  7.  
  8. $host = 'localhost';
  9. $user = '';
  10. $password = '';
  11. $database = 'my_itetsturzo';
  12. $nometabella = "GestioneCorsoSicurezzaEasyTGBot";
  13. $nomedb = "GestioneCorsoSicurezza";
  14. $dbname = "my_itetsturzo";
  15. $DATA = "$dbname.$nomedb$TGBot->table_name";
  16.  
  17.  
  18. $conn = new PDO("mysql:host=$host;dbname=$database", $user, $password);
  19.  
  20.  
  21. try {
  22. // stringa di connessione al DBMS
  23. $conn = new PDO("mysql:host=$host;dbname=$database", $user, $password);
  24. /*
  25. Avremmo potuto anche omettere dbname in questo modo:
  26. $connessione = new PDO("mysql:host=$host", $user, $password);
  27. */
  28. // notifica in caso di connessione effettuata
  29. echo "Connessione a MySQL tramite PDO effettuata.";
  30. // chiusura della connessione
  31.  
  32.  
  33. }
  34. catch(PDOException $e)
  35. {
  36. // notifica in caso di errore nel tentativo di connessione
  37. echo $e->getMessage();
  38. }
  39.  
  40.  
  41.  
  42. $nominativo= $_POST['Codice'];
  43. $nome= $_POST['CodiceNome'];
  44. $cognome = $_POST['CodiceCognome'];
  45.  
  46.  
  47. $dbname = "my_itetsturzo";
  48.  
  49. $stmt = $conn->prepare("INSERT INTO $DATA(`Userid`,`Nome`,`Cognome`) VALUES ('?','?','?')");
  50. $stmt->execute([$nominativo,$nome,$cognome]);
  51.  
  52.  
  53.  
  54.  
  55. ?>
  56.  
  57. <p>I dati sono stati inseriti correttamente</p>
  58.  
  59. <p> Per vedere l'intera blacklist clicca sul pulsante "Mostra i Risultati"</p>
  60.  
  61. <input type="button" onclick="location.href='result.php'" value="Mostra i Risultati"/>
  62.  
  63. </body>
  64. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement