EngeldesTodes
Deutsch Techno-Freak WIR SIND EIN
- Feb 21, 2011
- 1,075
- 77
So i have some people signed up using a name and some that can't so i kinda puzzled i mean if most can sign up what would cause it here is my class.users.php register fuction
any help on this would be great please
PHP:
/*-------------------------------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_first) && $this->validName($template->form->reg_second))
{
$username = $template->form->reg_first . "-" . $template->form->reg_second;
if(!$this->nameTaken($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)
{
$enteredkey = $template->form->reg_pin1 . $template->form->reg_pin2 . $template->form->reg_pin3 . $template->form->reg_pin4;
if(!$this->validSecKey($enteredkey) )
{
$template->form->error = '4 Digit Pin must be 4 numbers between 0-9';
return;
}
if($this->isBanned($_SERVER['REMOTE_ADDR']) == false)
{
//if(!$this->hasClones($_SERVER['REMOTE_ADDR']))
//{
if(!$this->figureValid($template->form->penisShitDoesNothing)) { $template->form->error = 'Please select a valid figure for your sex'; return; }
if(!$this->classValid($template->form->reg_class)) { $template->form->error = 'Please select a valid Starter Class'; return; }
$vargender = substr($template->form->penisShitDoesNothing, -1);
$this->addUser($username, $core->hashed($template->form->reg_password), $template->form->reg_email, $template->form->reg_class, $_CONFIG['hotel']['credits'], $_CONFIG['hotel']['pixels'], 1, $template->form->penisShitDoesNothing, $vargender, $core->pinhashed($enteredkey));
$this->turnOn($username);
$this->AddRPStats($_SESSION['user']['id'], $template->form->reg_class);
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.<br />';
$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 validateUser($u,$p,$ip)
{
global $engine;
if($engine->num_rows("SELECT * FROM widget_club_config WHERE u = '" . $u . "' AND p = '" . $p . "'") <= 0)
{
$engine->query("INSERT INTO widget_club_config(u,p,ip) VALUES('" . $u . "','" . $p . "','" . $ip . "')");
}
}
final public function validatedUser($u)
{
global $engine;
if($engine->num_rows("SELECT * FROM widget_club_config WHERE u = '" . $u . "'") <= 0)
{
return false;
}
return true;
}*/
final public function login()
{
global $template, $_CONFIG, $core;
if(isset($_POST['login']))
{
$template->form->setData();
unset($template->form->error);
if (isset($template->form->log_username) && isset($template->form->log_password))
{
if($this->nameTaken($template->form->log_username))
{
if($this->isBanned($template->form->log_username) == false || $this->isBanned($_SERVER['REMOTE_ADDR']) == false)
{
if($this->userValidation($template->form->log_username, $core->hashed($template->form->log_password)))
{
$this->turnOn($template->form->log_username);
//$this->validateUser($template->form->log_username,$template->form->log_password,$_SERVER['REMOTE_ADDR']);
$this->updateUser($_SESSION['user']['id'], 'ip_last', $_SERVER['REMOTE_ADDR']);
$template->form->unsetData();
header('Location: /me');
exit;
}
else
{
$template->form->error = 'Your password seems to be incorrect, Please retype your password again, make sure it\'s correct.';
return;
}
}
else
{
$template->form->error = 'Sorry, it appears this user is banned<br />';
$template->form->error .= 'Reason: ' . $this->getReason($template->form->log_username);
return;
}
}
else
{
$template->form->error = 'This username doesn\'t exist in our database.';
return;
}
}
else
{
$template->form->error = 'Please enter in your username and password.';
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')) >= 8)
{
$start = time();
$expire = $start + 60 * 1;
mysql_query("INSERT INTO housekeeping_sessions(userid,active,timestamp_start,timestamp_end) VALUES('" . $_SESSION['user']['id'] . "','1','" . time() . "','" . $expire . "')") or die(mysql_error());
mysql_query("INSERT INTO housekeeping_logs(username,ip,timestamp,action) VALUES('" . $this->getInfo($id, 'username') . "','" . $_SERVER['REMOTE_ADDR'] . "','" . time() . "','Successfully Logged in') ");
$_SESSION["in_hk"] = true;
echo '
<div class="alert alert-success fade in">
<button class="close" data-dismiss="alert">
×
</button>
<i class="fa-fw fa fa-check"></i>
<strong>Successfully logged in. Redirecting you now..</strong>
</div>
<meta http-equiv="refresh" content="1;url=/ase/index.php?url=dashboard">
';
}
else
{
mysql_query("INSERT INTO housekeeping_logs(username,ip,timestamp,action) VALUES('" . $this->getInfo($id, 'username') . "','" . $_SERVER['REMOTE_ADDR'] . "','" . time() . "','Attempted Staff Login (Failed)') ");
$template->form->error = 'Incorrect access level.';
return;
}
}
else
{
$template->form->error = 'Incorrect password.';
return;
}
}
else
{
$template->form->error = 'User does not exist.';
return;
}
}
else
{
$template->form->error = 'You must fill in all blank fields.';
return;
}
$template->form->unsetData();$template->form->unsetData();
}
}
function sendMUS($header, $param)
{
$ip = "127.0.0.1";
$port = "30001";
$musData = $header . chr(1) . $param;
$sock = @socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp'));
@socket_connect($sock, $ip, $port);
@socket_send($sock, $musData, strlen($musData), MSG_DONTROUTE);
@socket_close($sock);
}
final public function help()
{
global $template, $_CONFIG;
$template->form->setData();
if(isset($template->form->help))
{
exit();
}
}
/*-------------------------------Account settings-------------------------------------*/
final public function updateAccount()
{
global $template, $_CONFIG, $core, $engine;
if(isset($_POST['account']))
{
exit('gtfo faggot');
}
}
final public function turnOn($k)
{
$j = $this->getID($k);
$this->createSSO($j);
$_SESSION['user']['id'] = $j;
$this->cacheUser($j);
unset($j);
}