Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
Register page not sending data to database
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="HotelHoster" data-source="post: 294764" data-attributes="member: 37666"><p><strong>Here is the class.users.php</strong></p><p>[SPOILER="class.users.php"]</p><p>[PHP]<?php</p><p></p><p>namespace Revolution;</p><p>if(!defined('IN_INDEX')) { die('Sorry, you cannot access this file.'); }</p><p>class users implements iUsers</p><p>{</p><p> </p><p> /*-------------------------------Authenticate-------------------------------------*/</p><p> </p><p> final public function isLogged()</p><p> {</p><p> if(isset($_SESSION['user']['id']))</p><p> {</p><p> return true;</p><p> }</p><p> </p><p> return false;</p><p> }</p><p> </p><p> /*-------------------------------Checking of submitted data-------------------------------------*/</p><p> </p><p> final public function validName($username) </p><p> {</p><p> if(strlen($username) <= 25 && ctype_alnum($username)) </p><p> { </p><p> return true; </p><p> } </p><p> </p><p> return false; </p><p> } </p><p> </p><p> final public function validEmail($email) </p><p> { </p><p> return preg_match("/^[a-z0-9_\.-]+@([a-z0-9]+([\-]+[a-z0-9]+)*\.)+[a-z]{2,7}$/i", $email); </p><p> } </p><p> </p><p> final public function validSecKey($seckey)</p><p> {</p><p> if(is_numeric($seckey) && strlen($seckey) == 4)</p><p> {</p><p> return true;</p><p> }</p><p> </p><p> return false;</p><p> }</p><p> </p><p> final public function nameTaken($username) </p><p> { </p><p> global $engine; </p><p> </p><p> if($engine->num_rows("SELECT * FROM users WHERE username = '" . $username . "' LIMIT 1") > 0)</p><p> {</p><p> return true;</p><p> } </p><p> </p><p> return false;</p><p> }</p><p> </p><p> final public function emailTaken($email)</p><p> {</p><p> global $engine;</p><p> </p><p> if($engine->num_rows("SELECT * FROM users WHERE mail = '" . $email . "' LIMIT 1") > 0)</p><p> {</p><p> return true;</p><p> }</p><p> </p><p> return false;</p><p> }</p><p> </p><p> final public function userValidation($username, $password)</p><p> { </p><p> global $engine;</p><p> if($engine->num_rows("SELECT * FROM users WHERE username = '" . $username . "' AND password = '" . $password . "' LIMIT 1") > 0)</p><p> {</p><p> return true;</p><p> } </p><p> </p><p> return false;</p><p> } </p><p> </p><p> /*-------------------------------Stuff related to bans-------------------------------------*/</p><p> </p><p> final public function isBanned($value)</p><p> {</p><p> global $engine;</p><p> </p><p> if ($engine->num_rows("SELECT * FROM bans WHERE value = '" . $value . "' AND expire >= '" . time() . "' ") > 0)</p><p> {</p><p> return true;</p><p> }</p><p></p><p> return false;</p><p> }</p><p> </p><p> final public function getReason($value)</p><p> {</p><p> global $engine;</p><p> return $engine->result("SELECT reason FROM bans WHERE value = '" . $value . "' LIMIT 1");</p><p> }</p><p> </p><p> final public function hasClones($ip)</p><p> {</p><p> global $engine;</p><p> if($engine->num_rows("SELECT * FROM users WHERE ip_reg = '" . $_SERVER['REMOTE_ADDR'] . "'") == 5)</p><p> {</p><p> return true;</p><p> }</p><p> </p><p> return false;</p><p> }</p><p> </p><p> /*-------------------------------Login or Register user-------------------------------------*/</p><p> </p><p> final public function register()</p><p> {</p><p> global $core, $template, $_CONFIG;</p><p> </p><p> if(isset($_POST['register']))</p><p> {</p><p> unset($template->form->error);</p><p> </p><p> $template->form->setData();</p><p> </p><p> if($this->validName($template->form->reg_username))</p><p> {</p><p> if(!$this->nameTaken($template->form->reg_username))</p><p> {</p><p> if($this->validEmail($template->form->reg_email))</p><p> {</p><p> if(!$this->emailTaken($template->form->reg_email))</p><p> {</p><p> if(strlen($template->form->reg_password) > 6)</p><p> {</p><p> if($template->form->reg_password == $template->form->reg_rep_password)</p><p> {</p><p> if(isset($template->form->reg_seckey))</p><p> {</p><p> if($this->validSecKey($template->form->reg_seckey))</p><p> {</p><p> //Continue</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Secret key must only have 4 numbers';</p><p> return;</p><p> }</p><p> }</p><p> if($this->isBanned($_SERVER['REMOTE_ADDR']) == false)</p><p> {</p><p> if(!$this->hasClones($_SERVER['REMOTE_ADDR']))</p><p> {</p><p> if(!isset($template->form->reg_gender)) { $template->form->reg_gender = 'M'; }</p><p> if(!isset($template->form->reg_figure)) { $template->form->reg_figure = $_CONFIG['hotel']['figure']; }</p><p> </p><p> $this->addUser($template->form->reg_username, $core->hashed($template->form->reg_password), $template->form->reg_email, $_CONFIG['hotel']['motto'], $_CONFIG['hotel']['credits'], $_CONFIG['hotel']['pixels'], 1, $template->form->reg_figure, $template->form->reg_gender, $core->hashed($template->form->reg_key));</p><p> </p><p> $this->turnOn($template->form->reg_username);</p><p> </p><p> header('Location: ' . $_CONFIG['hotel']['url'] . '/me');</p><p> exit;</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Sorry, but you cannot register twice';</p><p> }</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Sorry, it appears you are IP banned. ';</p><p> $template->form->error .= 'Reason: ' . $this->getReason($_SERVER['REMOTE_ADDR']);</p><p> return;</p><p> }</p><p> }</p><p> else </p><p> {</p><p> $template->form->error = 'Password does not match repeated password';</p><p> return;</p><p> }</p><p></p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Password must have more than 6 characters';</p><p> return;</p><p> }</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Email: <b>' . $template->form->reg_email . '</b> is already registered';</p><p> return;</p><p> }</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Email is not valid';</p><p> return;</p><p> }</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Username is already registered';</p><p> return;</p><p> }</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Username is invalid';</p><p> return;</p><p> }</p><p> }</p><p> } </p><p> </p><p> final public function login()</p><p> {</p><p> global $template, $_CONFIG, $core;</p><p> </p><p> if(isset($_POST['login']))</p><p> {</p><p> $template->form->setData();</p><p> unset($template->form->error);</p><p> </p><p> if($this->nameTaken($template->form->log_username))</p><p> {</p><p> if($this->isBanned($_SERVER['REMOTE_ADDR']) == false)</p><p> {</p><p> if($this->isBanned($template->form->log_username) == false)</p><p> {</p><p> if($this->userValidation($template->form->log_username, $core->hashed($template->form->log_password)))</p><p> {</p><p> $this->turnOn($template->form->log_username);</p><p> $this->updateUser($_SESSION['user']['id'], 'ip_last', $_SERVER['REMOTE_ADDR']);</p><p> $template->form->unsetData();</p><p> header('Location: ' . $_CONFIG['hotel']['url'] . '/me');</p><p> exit;</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Details do not match';</p><p> return;</p><p> }</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Sorry, it appears this user is banned. ';</p><p> $template->form->error .= 'Reason: ' . $this->getReason($template->form->log_username);</p><p> return;</p><p> }</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Sorry, it appears this IP is banned. ';</p><p> $template->form->error .= 'Reason: ' . $this->getReason($_SERVER['REMOTE_ADDR']);</p><p> return;</p><p> }</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Username does not exist';</p><p> return;</p><p> }</p><p> }</p><p> }</p><p> </p><p> final public function loginHK()</p><p> {</p><p> global $template, $_CONFIG, $core;</p><p> </p><p> if(isset($_POST['login']))</p><p> { </p><p> $template->form->setData();</p><p> unset($template->form->error);</p><p> </p><p> if(isset($template->form->username) && isset($template->form->password))</p><p> {</p><p> if($this->nameTaken($template->form->username))</p><p> { </p><p> if($this->userValidation($template->form->username, $core->hashed($template->form->password)))</p><p> {</p><p> if(($this->getInfo($_SESSION['user']['id'], 'rank')) >= 9)</p><p> {</p><p> $_SESSION["in_hk"] = true;</p><p> header("Location:".$_CONFIG['hotel']['url']."/ase/dash");</p><p> exit;</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Incorrect access level.';</p><p> return;</p><p> }</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Incorrect password.';</p><p> return;</p><p> } </p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'User does not exist.';</p><p> return;</p><p> }</p><p> }</p><p> </p><p> $template->form->unsetData();</p><p> }</p><p> } </p><p> </p><p> final public function help()</p><p> {</p><p> global $template, $_CONFIG;</p><p> $template->form->setData();</p><p> </p><p> if(isset($template->form->help))</p><p> {</p><p> $to = $_CONFIG['hotel']['email'];</p><p> $subject = "Help from RevCMS user - " . $this->getInfo($_SESSION['user']['id'], 'username');</p><p> $body = $template->form->question;</p><p> </p><p> if (mail($to, $subject, $body))</p><p> {</p><p> $template->form->error = 'Message successfully sent! We will answer you shortly!';</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Message delivery failed.';</p><p> }</p><p> }</p><p> }</p><p></p><p> /*-------------------------------Account settings-------------------------------------*/</p><p> </p><p> final public function updateAccount()</p><p> {</p><p> global $template, $_CONFIG, $core, $engine;</p><p></p><p> if(isset($_POST['account']))</p><p> {</p><p></p><p> if(isset($_POST['acc_frndreq']) && strlen($_POST['acc_frndreq']) < 2 && $_POST['acc_frndreq'] != $this->getInfo($_SESSION['user']['id'], 'block_newfriends'))</p><p> {</p><p> $this->updateUser($_SESSION['user']['id'], 'block_newfriends', $engine->secure($_POST['acc_frndreq']));</p><p> header('Location: '.$_CONFIG['hotel']['url'].'/account');</p><p> exit;</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Setting is invalid.';</p><p> }</p><p></p><p> </p><p></p><p></p><p> if(isset($_POST['acc_trade']) && strlen($_POST['acc_trade']) < 2 && $_POST['acc_trade'] != $this->getInfo($_SESSION['user']['id'], 'accept_trading'))</p><p> {</p><p> $this->updateUser($_SESSION['user']['id'], 'accept_trading', $engine->secure($_POST['acc_trade']));</p><p> header('Location: '.$_CONFIG['hotel']['url'].'/account');</p><p> exit;</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Setting is invalid.';</p><p> }</p><p></p><p></p><p> if(isset($_POST['acc_online']) && strlen($_POST['acc_online']) < 2 && $_POST['acc_online'] != $this->getInfo($_SESSION['user']['id'], 'hide_online'))</p><p> {</p><p> $this->updateUser($_SESSION['user']['id'], 'hide_online', $engine->secure($_POST['acc_online']));</p><p> header('Location: '.$_CONFIG['hotel']['url'].'/account');</p><p> exit;</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Setting is invalid.';</p><p> }</p><p></p><p> if(isset($_POST['acc_follow']) && strlen($_POST['acc_follow']) < 2 && $_POST['acc_follow'] != $this->getInfo($_SESSION['user']['id'], 'hide_inroom'))</p><p> {</p><p> $this->updateUser($_SESSION['user']['id'], 'hide_inroom', $engine->secure($_POST['acc_follow']));</p><p> header('Location: '.$_CONFIG['hotel']['url'].'/account');</p><p> exit;</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Setting is invalid.';</p><p></p><p> }</p><p></p><p></p><p></p><p> if(isset($_POST['acc_motto']) && strlen($_POST['acc_motto']) < 30 && $_POST['acc_motto'] != $this->getInfo($_SESSION['user']['id'], 'motto'))</p><p> {</p><p> $this->updateUser($_SESSION['user']['id'], 'motto', $engine->secure($_POST['acc_motto']));</p><p> header('Location: '.$_CONFIG['hotel']['url'].'/account');</p><p> exit;</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Motto is invalid.';</p><p> }</p><p></p><p> if(isset($_POST['acc_email']) && $_POST['acc_email'] != $this->getInfo($_SESSION['user']['id'], 'mail'))</p><p> {</p><p> if($this->validEmail($_POST['acc_email']))</p><p> {</p><p> $this->updateUser($_SESSION['user']['id'], 'mail', $engine->secure($_POST['acc_email']));</p><p> header('Location: '.$_CONFIG['hotel']['url'].'/account');</p><p> exit;</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Email is not valid';</p><p> return;</p><p> }</p><p> }</p><p></p><p> if(!empty($_POST['acc_old_password']) && !empty($_POST['acc_new_password']))</p><p> {</p><p> if($this->userValidation($this->getInfo($_SESSION['user']['id'], 'username'), $core->hashed($_POST['acc_old_password'])))</p><p> {</p><p> if(strlen($_POST['acc_new_password']) >= 8)</p><p> {</p><p> $this->updateUser($_SESSION['user']['id'], 'password', $core->hashed($_POST['acc_new_password']));</p><p> header('Location: '.$_CONFIG['hotel']['url'].'/me');</p><p> exit;</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'New password is too short';</p><p> return;</p><p> }</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Current password is wrong';</p><p> return;</p><p> }</p><p> }</p><p> }</p><p> }</p><p></p><p></p><p> final public function turnOn($k)</p><p> {</p><p> $j = $this->getID($k);</p><p> $this->createSSO($j);</p><p> $_SESSION['user']['id'] = $j;</p><p> $this->cacheUser($j);</p><p> unset($j);</p><p> } </p><p> /*-------------------------------Loggin forgotten-------------------------------------*/ </p><p> </p><p> final public function forgotten()</p><p> {</p><p> global $template, $_CONFIG, $core;</p><p> </p><p> if(isset($_POST['forgot']))</p><p> {</p><p> </p><p> $template->form->setData();</p><p> unset($template->form->error);</p><p> </p><p> if($this->nameTaken($template->form->for_username))</p><p> {</p><p> if(strlen($template->form->for_password) > 6)</p><p> {</p><p> if($this->getInfo($this->getID($template->form->for_username), 'seckey') == $core->hashed($template->form->for_key))</p><p> {</p><p> $this->updateUser($this->getID($template->form->for_username), 'password', $core->hashed($template->form->for_password));</p><p> $template->form->error = 'Account recovered! Go <b><a href="index">here</a></b> to login!';</p><p> return;</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Secret key is incorrect';</p><p> return;</p><p> }</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Password must have more than 6 characters.';</p><p> return;</p><p> }</p><p> }</p><p> else</p><p> {</p><p> $template->form->error = 'Username does not exist';</p><p> return;</p><p> }</p><p> }</p><p> }</p><p> </p><p> /*-------------------------------Create SSO auth_ticket-------------------------------------*/</p><p> </p><p> final public function createSSO($k) </p><p> { </p><p> $sessionKey = 'RevCMS-'.rand(9,999).'/'.substr(sha1(time()).'/'.rand(9,9999999).'/'.rand(9,9999999).'/'.rand(9,9999999),0,33);</p><p> </p><p> $this->updateUser($k, 'auth_ticket', $sessionKey);</p><p> </p><p> unset($sessionKey);</p><p> } </p><p>[/PHP]</p><p>[/SPOILER]</p><p></p><p><strong>Need to cut this into 2 parts as still to big :/</strong></p></blockquote><p></p>
[QUOTE="HotelHoster, post: 294764, member: 37666"] [B]Here is the class.users.php[/B] [SPOILER="class.users.php"] [PHP]<?php namespace Revolution; if(!defined('IN_INDEX')) { die('Sorry, you cannot access this file.'); } class users implements iUsers { /*-------------------------------Authenticate-------------------------------------*/ final public function isLogged() { if(isset($_SESSION['user']['id'])) { return true; } return false; } /*-------------------------------Checking of submitted data-------------------------------------*/ final public function validName($username) { if(strlen($username) <= 25 && ctype_alnum($username)) { return true; } return false; } final public function validEmail($email) { return preg_match("/^[a-z0-9_\.-]+@([a-z0-9]+([\-]+[a-z0-9]+)*\.)+[a-z]{2,7}$/i", $email); } final public function validSecKey($seckey) { if(is_numeric($seckey) && strlen($seckey) == 4) { return true; } return false; } final public function nameTaken($username) { global $engine; if($engine->num_rows("SELECT * FROM users WHERE username = '" . $username . "' LIMIT 1") > 0) { return true; } return false; } final public function emailTaken($email) { global $engine; if($engine->num_rows("SELECT * FROM users WHERE mail = '" . $email . "' LIMIT 1") > 0) { return true; } return false; } final public function userValidation($username, $password) { global $engine; if($engine->num_rows("SELECT * FROM users WHERE username = '" . $username . "' AND password = '" . $password . "' LIMIT 1") > 0) { return true; } return false; } /*-------------------------------Stuff related to bans-------------------------------------*/ final public function isBanned($value) { global $engine; if ($engine->num_rows("SELECT * FROM bans WHERE value = '" . $value . "' AND expire >= '" . time() . "' ") > 0) { return true; } return false; } final public function getReason($value) { global $engine; return $engine->result("SELECT reason FROM bans WHERE value = '" . $value . "' LIMIT 1"); } final public function hasClones($ip) { global $engine; if($engine->num_rows("SELECT * FROM users WHERE ip_reg = '" . $_SERVER['REMOTE_ADDR'] . "'") == 5) { return true; } return false; } /*-------------------------------Login or Register user-------------------------------------*/ final public function register() { global $core, $template, $_CONFIG; if(isset($_POST['register'])) { unset($template->form->error); $template->form->setData(); if($this->validName($template->form->reg_username)) { if(!$this->nameTaken($template->form->reg_username)) { if($this->validEmail($template->form->reg_email)) { if(!$this->emailTaken($template->form->reg_email)) { if(strlen($template->form->reg_password) > 6) { if($template->form->reg_password == $template->form->reg_rep_password) { if(isset($template->form->reg_seckey)) { if($this->validSecKey($template->form->reg_seckey)) { //Continue } else { $template->form->error = 'Secret key must only have 4 numbers'; return; } } if($this->isBanned($_SERVER['REMOTE_ADDR']) == false) { if(!$this->hasClones($_SERVER['REMOTE_ADDR'])) { if(!isset($template->form->reg_gender)) { $template->form->reg_gender = 'M'; } if(!isset($template->form->reg_figure)) { $template->form->reg_figure = $_CONFIG['hotel']['figure']; } $this->addUser($template->form->reg_username, $core->hashed($template->form->reg_password), $template->form->reg_email, $_CONFIG['hotel']['motto'], $_CONFIG['hotel']['credits'], $_CONFIG['hotel']['pixels'], 1, $template->form->reg_figure, $template->form->reg_gender, $core->hashed($template->form->reg_key)); $this->turnOn($template->form->reg_username); header('Location: ' . $_CONFIG['hotel']['url'] . '/me'); exit; } else { $template->form->error = 'Sorry, but you cannot register twice'; } } else { $template->form->error = 'Sorry, it appears you are IP banned. '; $template->form->error .= 'Reason: ' . $this->getReason($_SERVER['REMOTE_ADDR']); return; } } else { $template->form->error = 'Password does not match repeated password'; return; } } else { $template->form->error = 'Password must have more than 6 characters'; return; } } else { $template->form->error = 'Email: <b>' . $template->form->reg_email . '</b> is already registered'; return; } } else { $template->form->error = 'Email is not valid'; return; } } else { $template->form->error = 'Username is already registered'; return; } } else { $template->form->error = 'Username is invalid'; return; } } } final public function login() { global $template, $_CONFIG, $core; if(isset($_POST['login'])) { $template->form->setData(); unset($template->form->error); if($this->nameTaken($template->form->log_username)) { if($this->isBanned($_SERVER['REMOTE_ADDR']) == false) { if($this->isBanned($template->form->log_username) == false) { if($this->userValidation($template->form->log_username, $core->hashed($template->form->log_password))) { $this->turnOn($template->form->log_username); $this->updateUser($_SESSION['user']['id'], 'ip_last', $_SERVER['REMOTE_ADDR']); $template->form->unsetData(); header('Location: ' . $_CONFIG['hotel']['url'] . '/me'); exit; } else { $template->form->error = 'Details do not match'; return; } } else { $template->form->error = 'Sorry, it appears this user is banned. '; $template->form->error .= 'Reason: ' . $this->getReason($template->form->log_username); return; } } else { $template->form->error = 'Sorry, it appears this IP is banned. '; $template->form->error .= 'Reason: ' . $this->getReason($_SERVER['REMOTE_ADDR']); return; } } else { $template->form->error = 'Username does not exist'; return; } } } final public function loginHK() { global $template, $_CONFIG, $core; if(isset($_POST['login'])) { $template->form->setData(); unset($template->form->error); if(isset($template->form->username) && isset($template->form->password)) { if($this->nameTaken($template->form->username)) { if($this->userValidation($template->form->username, $core->hashed($template->form->password))) { if(($this->getInfo($_SESSION['user']['id'], 'rank')) >= 9) { $_SESSION["in_hk"] = true; header("Location:".$_CONFIG['hotel']['url']."/ase/dash"); exit; } else { $template->form->error = 'Incorrect access level.'; return; } } else { $template->form->error = 'Incorrect password.'; return; } } else { $template->form->error = 'User does not exist.'; return; } } $template->form->unsetData(); } } final public function help() { global $template, $_CONFIG; $template->form->setData(); if(isset($template->form->help)) { $to = $_CONFIG['hotel']['email']; $subject = "Help from RevCMS user - " . $this->getInfo($_SESSION['user']['id'], 'username'); $body = $template->form->question; if (mail($to, $subject, $body)) { $template->form->error = 'Message successfully sent! We will answer you shortly!'; } else { $template->form->error = 'Message delivery failed.'; } } } /*-------------------------------Account settings-------------------------------------*/ final public function updateAccount() { global $template, $_CONFIG, $core, $engine; if(isset($_POST['account'])) { if(isset($_POST['acc_frndreq']) && strlen($_POST['acc_frndreq']) < 2 && $_POST['acc_frndreq'] != $this->getInfo($_SESSION['user']['id'], 'block_newfriends')) { $this->updateUser($_SESSION['user']['id'], 'block_newfriends', $engine->secure($_POST['acc_frndreq'])); header('Location: '.$_CONFIG['hotel']['url'].'/account'); exit; } else { $template->form->error = 'Setting is invalid.'; } if(isset($_POST['acc_trade']) && strlen($_POST['acc_trade']) < 2 && $_POST['acc_trade'] != $this->getInfo($_SESSION['user']['id'], 'accept_trading')) { $this->updateUser($_SESSION['user']['id'], 'accept_trading', $engine->secure($_POST['acc_trade'])); header('Location: '.$_CONFIG['hotel']['url'].'/account'); exit; } else { $template->form->error = 'Setting is invalid.'; } if(isset($_POST['acc_online']) && strlen($_POST['acc_online']) < 2 && $_POST['acc_online'] != $this->getInfo($_SESSION['user']['id'], 'hide_online')) { $this->updateUser($_SESSION['user']['id'], 'hide_online', $engine->secure($_POST['acc_online'])); header('Location: '.$_CONFIG['hotel']['url'].'/account'); exit; } else { $template->form->error = 'Setting is invalid.'; } if(isset($_POST['acc_follow']) && strlen($_POST['acc_follow']) < 2 && $_POST['acc_follow'] != $this->getInfo($_SESSION['user']['id'], 'hide_inroom')) { $this->updateUser($_SESSION['user']['id'], 'hide_inroom', $engine->secure($_POST['acc_follow'])); header('Location: '.$_CONFIG['hotel']['url'].'/account'); exit; } else { $template->form->error = 'Setting is invalid.'; } if(isset($_POST['acc_motto']) && strlen($_POST['acc_motto']) < 30 && $_POST['acc_motto'] != $this->getInfo($_SESSION['user']['id'], 'motto')) { $this->updateUser($_SESSION['user']['id'], 'motto', $engine->secure($_POST['acc_motto'])); header('Location: '.$_CONFIG['hotel']['url'].'/account'); exit; } else { $template->form->error = 'Motto is invalid.'; } if(isset($_POST['acc_email']) && $_POST['acc_email'] != $this->getInfo($_SESSION['user']['id'], 'mail')) { if($this->validEmail($_POST['acc_email'])) { $this->updateUser($_SESSION['user']['id'], 'mail', $engine->secure($_POST['acc_email'])); header('Location: '.$_CONFIG['hotel']['url'].'/account'); exit; } else { $template->form->error = 'Email is not valid'; return; } } if(!empty($_POST['acc_old_password']) && !empty($_POST['acc_new_password'])) { if($this->userValidation($this->getInfo($_SESSION['user']['id'], 'username'), $core->hashed($_POST['acc_old_password']))) { if(strlen($_POST['acc_new_password']) >= 8) { $this->updateUser($_SESSION['user']['id'], 'password', $core->hashed($_POST['acc_new_password'])); header('Location: '.$_CONFIG['hotel']['url'].'/me'); exit; } else { $template->form->error = 'New password is too short'; return; } } else { $template->form->error = 'Current password is wrong'; return; } } } } final public function turnOn($k) { $j = $this->getID($k); $this->createSSO($j); $_SESSION['user']['id'] = $j; $this->cacheUser($j); unset($j); } /*-------------------------------Loggin forgotten-------------------------------------*/ final public function forgotten() { global $template, $_CONFIG, $core; if(isset($_POST['forgot'])) { $template->form->setData(); unset($template->form->error); if($this->nameTaken($template->form->for_username)) { if(strlen($template->form->for_password) > 6) { if($this->getInfo($this->getID($template->form->for_username), 'seckey') == $core->hashed($template->form->for_key)) { $this->updateUser($this->getID($template->form->for_username), 'password', $core->hashed($template->form->for_password)); $template->form->error = 'Account recovered! Go <b><a href="index">here</a></b> to login!'; return; } else { $template->form->error = 'Secret key is incorrect'; return; } } else { $template->form->error = 'Password must have more than 6 characters.'; return; } } else { $template->form->error = 'Username does not exist'; return; } } } /*-------------------------------Create SSO auth_ticket-------------------------------------*/ final public function createSSO($k) { $sessionKey = 'RevCMS-'.rand(9,999).'/'.substr(sha1(time()).'/'.rand(9,9999999).'/'.rand(9,9999999).'/'.rand(9,9999999),0,33); $this->updateUser($k, 'auth_ticket', $sessionKey); unset($sessionKey); } [/PHP] [/SPOILER] [B]Need to cut this into 2 parts as still to big :/[/B] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Register page not sending data to database
Top