Advertisement
Guest User

Untitled

a guest
Jun 19th, 2018
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.22 KB | None | 0 0
  1. namespace Genesis;
  2.  
  3. use Genesis\Controllers\Router;
  4.  
  5. require_once('global.php');
  6.  
  7. use Genesis\Controllers\Database;
  8. use Genesis\Controllers\Auth;
  9. use Genesis\Controllers\User;
  10. use Genesis\Controllers\FlashMessages as Flash;
  11. use \MySQLi;
  12.  
  13. class Register
  14. {
  15. public function __construct()
  16. {
  17. $this->database = new Database;
  18. $this->auth = new Auth;
  19. $this->flash = new Flash;
  20. $this->mysqli = new MySQLi;
  21. }
  22.  
  23. public function createUser()
  24. {
  25. if (isset($_POST['submit_user'])) {
  26. if (!empty($_POST['email']) && !empty($_POST['username']) && !empty($_POST['password']) && !empty($_POST['password_confirm'])) {
  27. if (Auth::filter_validate_email($_POST['email'])) {
  28. if ($this->auth->validateUsername($_POST['username']) == false) {
  29. if (Auth::setHash($_POST['password']) === Auth::setHash($_POST['password_confirm'])) {
  30. $email = Auth::filter_safety_input($_POST['email']);
  31. $user = Auth::filter_safety_input($_POST['username']);
  32. $pass = Auth::filter_safety_input(Auth::setHash($_POST['password']));
  33. $look = $_POST['gender'] == 'male' ? 'lg-280-82.ch-255-63.hr-889-42.hd-209-2.ha-1003-1334.sh-290-92' : 'hr-802-42.lg-281-73.hd-180-1.ch-807-73.ca-1813-63';
  34. $account_created = time();
  35. $credits = 50000;
  36. $duckets = 500;
  37. $points = 0;
  38. $ip = $_SERVER["HTTP_CF_CONNECTING_IP"];
  39. $motto = 'Ik ben nieuw op Habboh Hotel!';
  40. $birthday = $_POST['day'] . $_POST['month'] . $_POST['year'];
  41. $last_login = time();
  42. $insert_value = $this->database->query("INSERT INTO users(username, motto, password, account_created, mail, look, credits, pixels, points, ip_register, birthday, last_login)
  43. VALUES('$user', '$motto', '$pass', '$account_created', '$email', '$look', '$credits', '$duckets', '$points', '$ip', '$birthday', '$last_login')") or die($this->database->error());
  44. if ($insert_value) {
  45. $getID = $this->database->query("SELECT * FROM users WHERE username = '$user'");
  46. $sID = mysqli_fetch_assoc($getID);
  47. $_SESSION['user'] = $sID['id'];
  48. header("LOCATION: ./me");
  49. }
  50. //$_SESSION['user'] = $insert_value['id'];
  51. //var_dump($_SESSION['user']);
  52. } else $this->flash->error('Wachtwoorden komen niet overeen!');
  53. } else $this->flash->error('Gebruikersnaam al in gebruik!');
  54. } else $this->flash->error('Geen correct email adres!');
  55. } else $this->flash->error('Vul alle velden in!');
  56. }
  57. }
  58. }
  59.  
  60. $router = new Router;
  61. $register = new Register;
  62.  
  63. $register->createUser();
  64.  
  65. $router->render("register");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement