Guest User

Untitled

a guest
Aug 18th, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.71 KB | None | 0 0
  1. <?php
  2. session_start();
  3. require("funzioni.php");
  4.  
  5. error_reporting(E_ALL);
  6. ini_set('display_errors', '1');
  7.  
  8. $new_user = $_POST['new_user']; // new user
  9. $new_pass = $_POST['new_pass']; // new pass
  10. $confirm = $_POST['conferma_pass']; // pass confirm
  11. $new_email = $_POST['email']; // user email
  12.  
  13. ?>
  14.  
  15. <html>
  16. <head>
  17. <title>Fridle-Register</title>
  18. </head>
  19.  
  20. <body>
  21. <?php
  22. pageTop();
  23. ?>
  24.  
  25. <!-- Header -->
  26. <h1 align="center">Registrazione utente</h1>
  27.  
  28. <!-- Register form -->
  29. <form method="post" action="register.php">
  30. <table align="center">
  31. <tr>
  32. <th align="left">Password</th>
  33. <th><input type="password" name="new_pass" maxlength="20"></th>
  34. </tr>
  35. <tr>
  36. <th align="left">Conferma password</th>
  37. <th><input type="password" name="conferma_pass" maxlength="20"></th>
  38. </tr>
  39. <tr>
  40. <th align="left">Email</th>
  41. <th><input type="text" name="email" maxlength="30"></th>
  42. </tr>
  43. </table>
  44.  
  45. </br>
  46.  
  47. <div align="center">
  48. <input type="submit" value="confirm">
  49. </div>
  50.  
  51. <?php
  52.  
  53.  
  54. //controllo se sono inseriti i campi
  55. if(!empty($new_email) && !empty($new_pass) && !empty($confirm)){
  56.  
  57. if ( $new_pass == $confirm ){
  58. $cryptedPass = sha1($new_pass);
  59.  
  60. $query = " select MAX(login) from utenti ";
  61. $conn = connect();
  62. $result = mysql_query($query, $conn) or die ( "query fallita! Register.php");
  63.  
  64. echo "$result ";
  65. while ( $row = mysql_fetch_array($result)){
  66. $out1 = $row[0];
  67. $new_user= $out1 + 00001;
  68. if ( registerNewUser( $new_user, $cryptedPass, $new_email)) {
  69. $a = "$new_email";
  70. $oggetto = " Registrazione fridle ";
  71. $messaggio = " Grazie \"$user\"";
  72. mail($new_mail,$oggetto,$messaggio);
  73. echo "\"$a\"";
  74. header ('Location: register_redirect.php');
  75. }
  76. else {
  77. echo "<p align=center><h2>Riscontrato un errore durante la registrazione. Contattare un amministratore</h2></p>";
  78. }
  79.  
  80. }
  81. }
  82. else {
  83. echo "<p align=center> Le password inserite non combaciano!</p>";
  84. }
  85. }
  86. else {
  87. echo "<p align=center> I campi <b>\"Password\"</b>, <b>\"Conferma Password\"</b> e <b>\"Email\"</b>, non possono essere vuoti</p>";
  88. }
  89.  
  90.  
  91.  
  92. ?>
  93. </form>
  94. </body>
  95. </html>
Add Comment
Please, Sign In to add comment