Advertisement
Guest User

Untitled

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