Advertisement
Guest User

Untitled

a guest
Sep 20th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. <?
  2.  
  3. // Config vars
  4. include("../config/config.php");
  5.  
  6. // Variables
  7. $register = $_POST["Submit"];
  8. $user = $_POST["Username"];
  9. $pass = $_POST["Password"];
  10. $repass = $_POST["RepeatPassword"];
  11. $email = $_POST["Email"];
  12. $key = rand(0, 99999999) . "oi";
  13. $unix = time();
  14. $inv = "'1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','413'";
  15.  
  16. # If the "CREATE PENGUIN" button was pressed
  17. if(isset($register)) {
  18.  
  19. mysql_connect($server, $username, $password);
  20.  
  21. if(!$conn) {
  22. die("Failed to connect to the server: " . mysql_error());
  23. }
  24.  
  25. # Queries for an existing name, to prevent over-write
  26. $res = mysql_db_query("wizguin", 'SELECT Username FROM users WHERE Username="' . $user . '"');
  27.  
  28. # If name exists in SQL
  29. if(mysql_num_rows($res) != 0) {
  30. die("That username already exists.");
  31. }
  32.  
  33. # If the password and repeated are the same
  34. if($pass == $repass) {
  35. # If the passwords are 4-30
  36. if(strlen($pass) >= 4 && strlen($pass) <= 30) {
  37. # If the username is 4-12
  38. if(strlen($user) >= 4 && strlen($user) <= 12) {
  39. mysql_db_query("wizguin", "INSERT INTO users (Username, Password, LoginKey, RegisteredTime, Buddies, Ignores, Inventory) VALUES ('{$user}', '{$pass}', '{$key}', '{$unix}', '[]', '[[]]', '[{$inv}]')");
  40. mysql_close();
  41. echo '<meta http-equiv="refresh" content="0; url=http://wizguin.byethost3.com/register.html?acc=1" />';
  42. }
  43. else echo "Username is too long/short";
  44. }
  45. else echo "Passwords are too long/short";
  46. }
  47.  
  48. # If the password and repeated aren't the same
  49. if($pass != $repass) {
  50. mysql_close();
  51. die("Both passwords to not match.");
  52. }
  53. }
  54.  
  55. mysql_close();
  56. else echo '<meta http-equiv="refresh" content="0; url=http://wizguin.byethost3.com/register.html" />';
  57.  
  58. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement