Advertisement
Guest User

Untitled

a guest
Jun 10th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. <html>
  2. <?php
  3.  
  4. if($_SERVER['QUERY_STRING']!=""){
  5.  
  6. $pass=$_GET['password'];
  7. $passripetuta=$_GET['ripetipassword'];
  8. $utente=$_GET['utente'];
  9.  
  10. if($pass==$passripetuta){
  11.  
  12. $link = mysqli_connect("IP", "xxx", "yyy", "zzz");
  13.  
  14. if(!$link){
  15. die("error to connect");
  16. }
  17.  
  18. $queryString = "INSERT INTO Utenti VALUES ('$utente', '$pass')";
  19. //$queryString = "SELECT * FROM Utenti WHERE User='$utente' AND Password='$pass'";
  20.  
  21. $inserito = mysqli_query($link, $queryString);
  22.  
  23. echo "<head>";
  24. if($inserito == 1){
  25. echo "<meta http-equiv='refresh' content ='3, url=AccediDatabase.php'>";
  26. }
  27. echo"</head><body>";
  28.  
  29. if($inserito == 1){
  30. echo "Utente inserito.";
  31. }else{
  32. echo "Nome utente già presente";
  33. visualizzaForm();
  34. }
  35.  
  36.  
  37. mysqli_close($link);
  38. echo "</body>";
  39.  
  40. }else{
  41. echo "<head></head><body>";
  42. echo "password non coincidenti<br>";
  43. visualizzaForm();
  44. echo "</body>";
  45. }
  46.  
  47. }else{
  48. echo "<head></head><body>";
  49. visualizzaForm();
  50. echo "</body>";
  51. }
  52. ?>
  53.  
  54. </html>
  55. <?php
  56.  
  57. function visualizzaForm(){
  58. echo "<form action='Registazione.php' method='get'>";
  59. echo "User: <input type = 'text' name= 'utente'><br>";
  60. echo "Password: <input type='password' name='password'><br>";
  61. echo "Ripeti Passsword: <input type ='password' name='ripetipassword'><br>";
  62. echo "<input type= 'submit' value='Registrati'><br>";
  63. echo "</form>";
  64. }
  65. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement