if (isset($_POST['gracefulstop'])) {
    shutdownworld();
    redirect($_SERVER['REQUEST_URI'], 'Server shutting down. Redirecting …');
} elseif (isset($_POST['update'])) {
    $message = trim($_POST['update_message']);
    updateworld($message);
    redirect($_SERVER['REQUEST_URI'], 'The server will shut down in 60 seconds. Redirecting …');
} elseif (isset($_POST['global'])) {
    $message = trim($_POST['global_message']);
    if (empty($message)) {
        message('You didn\'t enter a message');
    }
    sendglobal($message);
    redirect($_SERVER['REQUEST_URI'], 'Global message sent. Redirecting …');
} elseif (isset($_POST['alert'])) {
    $user = encode_username($_POST['alert_username']);
    $message = trim($_POST['alert_message']);
    if (!$user || empty($message)) {
        message('Invalid username, or no message supplied');
    }
    alertplayer($user, $message);
    redirect($_SERVER['REQUEST_URI'], pun_htmlspecialchars($result) . '. Redirecting …');
}
generate_admin_menu('rscd_control');
?>
	<div class="blockform">
		<h2 class="block2"><span>Server Control</span></h2>
		<div class="box">
			<form method="post" action="admin_rscd_control.php">
				<div class="inform">
<?php 
Example #2
0
                    ?>
" /><input type="submit" name="cancel" value="<?php 
                    echo $lang_register['Cancel'];
                    ?>
" /></p>
		</form>
	</div>
</div>
<?php 
                    require PUN_ROOT . 'footer.php';
                } else {
                    if (isset($_POST['form_sent'])) {
                        $username = pun_trim($_POST['req_username']);
                        $password1 = trim($_POST['req_password1']);
                        $password2 = trim($_POST['req_password2']);
                        $username_hash = encode_username($username);
                        $username = decode_username($username_hash);
                        // Validate username and passwords
                        if (!$username_hash) {
                            message('Invalid username');
                        } else {
                            if (strlen($username) < 2) {
                                message($lang_prof_reg['Username too short']);
                            } else {
                                if (pun_strlen($username) > 12) {
                                    // This usually doesn't happen since the form element only accepts 12 characters
                                    message($lang_common['Bad request']);
                                } else {
                                    if (strlen($password1) < 4) {
                                        message($lang_prof_reg['Pass too short']);
                                    } else {