Advertisement
Guest User

Untitled

a guest
Oct 10th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.01 KB | None | 0 0
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2.  
  3. <html>
  4.  
  5. <head>
  6.  
  7. <title>Register!</title>
  8.  
  9. </head>
  10.  
  11. <body>
  12.  
  13. <form action='<?=$_SERVER['PHP_SELF']?>' method='POST'>
  14.  
  15. Username: <input type='text' name='username'><br>
  16.  
  17. Password: <input type='password' name='password'><br>
  18.  
  19. <input name="register" type="submit" value="Submit">
  20.  
  21. </form>
  22.  
  23. <?php
  24.  
  25. include('config.php');
  26.  
  27. ///variables...
  28.  
  29. $submit=$_POST['register'];
  30.  
  31. $username =
  32. mysql_real_escape_string(strip_tags(htmlspecialchars($_POST['username'])&
  33. #41;);
  34.  
  35. $password = md5($_POST['password']);
  36.  
  37. //if button is pressed
  38.  
  39. if($submit){
  40.  
  41. //if username is not blank..same for pass
  42.  
  43. if(($username) and ($password) and ($username!==NULL) and
  44. ($password!==NULL)){
  45.  
  46. $sql="INSERT INTO `users` (`id`,`username`,`password`)
  47. VALUES
  48. ('NULL','".$username."','".$password."')";
  49.  
  50. mysql_query($sql) or die(mysql_error());
  51.  
  52. echo "Congratulations! You are registered!<br><a href='index.php'>Log
  53. in</a>";
  54.  
  55. }
  56.  
  57. }
  58.  
  59. ?>
  60.  
  61. </body>
  62.  
  63. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement