Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Genesis;
- use Genesis\Controllers\Router;
- require_once('global.php');
- use Genesis\Controllers\Database;
- use Genesis\Controllers\Auth;
- use Genesis\Controllers\User;
- use Genesis\Controllers\FlashMessages as Flash;
- use \MySQLi;
- class Register
- {
- public function __construct()
- {
- $this->database = new Database;
- $this->auth = new Auth;
- $this->flash = new Flash;
- $this->mysqli = new MySQLi;
- }
- public function createUser()
- {
- if (isset($_POST['submit_user'])) {
- if (!empty($_POST['email']) && !empty($_POST['username']) && !empty($_POST['password']) && !empty($_POST['password_confirm'])) {
- if (Auth::filter_validate_email($_POST['email'])) {
- if ($this->auth->validateUsername($_POST['username']) == false) {
- if (Auth::setHash($_POST['password']) === Auth::setHash($_POST['password_confirm'])) {
- $email = Auth::filter_safety_input($_POST['email']);
- $user = Auth::filter_safety_input($_POST['username']);
- $pass = Auth::filter_safety_input(Auth::setHash($_POST['password']));
- $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';
- $account_created = time();
- $credits = 50000;
- $duckets = 500;
- $points = 0;
- $ip = $_SERVER["HTTP_CF_CONNECTING_IP"];
- $motto = 'Ik ben nieuw op Habboh Hotel!';
- $birthday = $_POST['day'] . $_POST['month'] . $_POST['year'];
- $last_login = time();
- $insert_value = $this->database->query("INSERT INTO users(username, motto, password, account_created, mail, look, credits, pixels, points, ip_register, birthday, last_login)
- VALUES('$user', '$motto', '$pass', '$account_created', '$email', '$look', '$credits', '$duckets', '$points', '$ip', '$birthday', '$last_login')") or die($this->database->error());
- if ($insert_value) {
- $getID = $this->database->query("SELECT * FROM users WHERE username = '$user'");
- $sID = mysqli_fetch_assoc($getID);
- $_SESSION['user'] = $sID['id'];
- header("LOCATION: ./me");
- }
- //$_SESSION['user'] = $insert_value['id'];
- //var_dump($_SESSION['user']);
- } else $this->flash->error('Wachtwoorden komen niet overeen!');
- } else $this->flash->error('Gebruikersnaam al in gebruik!');
- } else $this->flash->error('Geen correct email adres!');
- } else $this->flash->error('Vul alle velden in!');
- }
- }
- }
- $router = new Router;
- $register = new Register;
- $register->createUser();
- $router->render("register");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement