Advertisement
Guest User

Untitled

a guest
May 13th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. <?php
  2.  
  3. $submit = strip_tags($_POST['submit']);
  4. $username = strip_tags($_POST['username']);
  5. $password = strip_tags($_POST['password']);
  6. $repeatpassword = strip_tags($_POST['repeatpassword']);
  7. $date = date("Y-m-d");
  8.  
  9. if($submit)
  10. {
  11. //open database
  12. $connect = mysql_connect("mhost","user","pass") or die("Could Not Connect To DataBase!");
  13. mysql_select_db("a6478173_website") or die("Could Not Find DataBase!");
  14. $namecheck = mysql_query("SELECT username FROM phplogin WHERE username ='$username'");
  15. $count = mysql_num_rows($namecheck);
  16.  
  17. if($count !=0)
  18. {
  19. echo("Username Already Taken!");
  20. }
  21.  
  22. //check for existance
  23. if($username&&$password&&$repeatpassword)
  24. {
  25. if($password==$repeatpassword)
  26. {
  27. if(strlen($password)>25||strlen($password)>6)
  28. {
  29. echo ("Your password needs to be bigger then 6 letters long and shorter then 25 letters!");
  30. }
  31. else
  32. //encrypt
  33. $password = md5($password);
  34. $repeatpassword = md5($repeatpassword);
  35.  
  36. $queryreg = mysql_query("INSERT INTO phplogin VALUES (' ','$username',$password,'$date'");
  37. echo("You have been registered!");
  38. }
  39. else
  40. echo ("The Passwords Do Not Match!");
  41. }
  42. else
  43. echo("Please Fill in All The Fields!");
  44. }
  45.  
  46. ?>
  47.  
  48. <html>
  49.  
  50. <form action='register.php' method='POST'>
  51. <p align="left">Username:
  52. <input name='username' type='text' id="username" maxlength="25">
  53. </p>
  54. <p>
  55. Password:
  56. <input name='password' type='password' id="password" maxlength="25">
  57. </p>
  58. Confirm Password:
  59. <input name='repeatpassword' type='password' id="repeatpassword" maxlength="25">
  60. </p>
  61. <p align="left">
  62. <input name="submit" type='submit' id="submit" value='Register!'>
  63. </p>
  64. </form>
  65.  
  66. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement