Advertisement
Guest User

Untitled

a guest
May 13th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.21 KB | None | 0 0
  1. <html>
  2. <body>
  3. <?php
  4.  
  5. function AddMe()
  6. {
  7.  
  8. ?>
  9.  
  10. <form name = "new user" action = "" method = "POST" />
  11.  
  12.     Desired Username :
  13. <br />
  14.     <input type = "text" name = "username" />
  15. <br />
  16.     Password :
  17. <br />
  18.     <input type = "text" name = "password1" />
  19. <br />
  20.     retype password:
  21. <br />
  22.     <input type = "text" name = "password2" />
  23. <br />
  24.     <input type = "submit" value = "Add Me!" />
  25.  
  26. </form>
  27.  
  28. <?php
  29. }
  30.  
  31.     if(!isset($_POST['username']) && !isset($_POST['password1']) && !isset($_POST['password2']))
  32. {
  33.     AddMe();
  34. }
  35.  
  36.     elseif($_POST['password1'] != $_POST['password2'])
  37. {
  38.     $flag = 'false';
  39.    
  40.     AddMe();
  41.  
  42.     echo '<br />';
  43.  
  44.     echo 'The two passwords did not match!';
  45. }
  46.  
  47.     elseif(isset($_POST['username']) && isset($_POST['password1']) && isset($_POST['password2']))
  48. {
  49.     $U_Name = "\r\n" . $_POST['username'];
  50.     $Pass = "\r\n" . md5($_POST['password1']);
  51.     $users = fopen('C:/wamp/db/users.txt', 'a+');
  52.     $Pwords = fopen('C:/wamp/db/Pwords.txt', 'a+');
  53.  
  54.     fwrite($users, $U_Name);
  55.     fwrite($Pwords, $Pass);
  56.     fclose($users);
  57.     fclose($Pwords);
  58.  
  59.     $Clean_U_Name = htmlentities($_POST['username']);
  60.  
  61.     echo 'Thank You ' , $Clean_U_Name , ' you can now <a href = "login.php">sign in</a>';
  62.  
  63. }
  64.  
  65. ?>
  66.  
  67. </body>
  68. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement