checkActivation($_POST['username'])) {
print $flashii->printMessage("
Your account is deactivated, try again later or contact an Admin.
", $redir);
} else {
if($flashii->login($_POST['username'], $_POST['password'])) {
print $flashii->printMessage("You are now logged in.
", $redir);
} else {
print $flashii->printMessage("Username or Password was wrong.
", $redir);
}
}
break;
case 'logout':
if($flashii->loggedIn()) {
if($flashii->logout())
print $flashii->printMessage("You are now logged out.
", $redir);
else
print $flashii->printMessage("You somehow managed to fuck up while trying to log out.
Good job!", $redir);
} else {
header('Location: '. $redir);
}
break;
case 'regkey':
$flashii->newRegistrationCode();
header('Location: '. $redir);
break;
case 'session':
if(!isset($_POST['submit'])) {
header('Location: '. $redir);
exit;
}
if(isset($_POST['submit'])) {
if($flashii->checkIfSessionExists($_POST['sessionid'])) {
$flashii->killSession($_POST['sessionid'], true);
print $flashii->printMessage("Requested session has been killed.
", $redir);
} else {
print $flashii->printMessage("Requested session does not exist.
", $redir);
}
} else {
print $flashii->printMessage("Fuck off.
", $redir);
}
break;
case 'register':
if(!isset($_POST['submit'])) {
header('Location: '. $redir);
exit;
}
if(!recaptcha_check_answer($RECAPTCHAprivatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"])->is_valid) {
print $flashii->printMessage("The reCAPTCHA wasn't entered correctly. Go back and try it again.
", $redir);
exit;
}
if(!$flashii->registrationCodeCheck(@$_POST['registrationcode'])) {
print $flashii->printMessage("The provided registration code is invalid.
", $redir);
exit;
}
if(!@$_POST['tos']) {
print $flashii->printMessage("Please agree to the Terms of Service and try again.
", $redir);
exit;
}
if($flashii->checkIfUserExists(@$_POST['username'])) {
print $flashii->printMessage("Username is taken.
", $redir);
exit;
}
if(preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/', @$_POST['username'])) {
print $flashii->printMessage("One or more characters in your username is disallowed.
", $redir);
exit;
}
if(!$flashii->checkEmail(@$_POST['email'], true)) {
print $flashii->printMessage("The E-mail Address given has already been registered or was invalid.
", $redir);
exit;
}
if(strlen(@$_POST['password']) < 4 || strlen(@$_POST['password']) > 128) {
print $flashii->printMessage("Password was either too long or too short.
", $redir);
exit;
}
if(@$_POST['password'] != @$_POST['confirmpassword']) {
print $flashii->printMessage("Passwords do not match.
", $redir);
exit;
}
$flashii->registerUser(@$_POST['username'], @$_POST['password'], $_POST['email']);
print $flashii->printMessage("Successfully Registered! Welcome to Flashii!
", "/login");
break;
default:
header('Location: '. $redir);
}
} else {
header('Location: '. $redir);
}