Guest User

Untitled

a guest
Oct 17th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. <?php
  2. $connection = mysql_connect("64.120.22.141", "1667_cj101" , "PASSWORD")
  3. or die("ERROR: Couldnt connect to the database!");
  4.  
  5. mysql_select_db("1667_cj101") or die ("Couldnt select the database!");
  6.  
  7. $username = $_POST["username"];
  8. $password = $_POST["password"];
  9. $password2 = $_POST["password2"];
  10.  
  11. if($password != $password2 OR $username == "" OR $password == "")
  12. {
  13. echo "ERROR: Please fill in all fields!</a>";
  14. exit;
  15. }
  16. $password = md5($password);
  17.  
  18. $result = mysql_query("SELECT Name FROM users WHERE Name LIKE '$username'");
  19. $amount = mysql_num_rows($result);
  20.  
  21. if($amount == 0)
  22. {
  23. $entry = "INSERT INTO users (Name, password) VALUES ('$username', '$password')";
  24. $record = mysql_query($entry);
  25.  
  26. if($record == true)
  27. {
  28. echo "Your Account has been created!</a>";
  29. }
  30. else
  31. {
  32. echo "ERROR: Couldnt create your account!</a>";
  33. }
  34.  
  35.  
  36. }
  37.  
  38. else
  39. {
  40. echo "Sorry, this Username is already taken.</a>";
  41. }
  42. ?>
Add Comment
Please, Sign In to add comment