Example #1
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 {
                                        if (pun_strlen($password1) > 16) {
function extractplayers($result)
{
    $players = array();
    $lines = explode(' ', $result);
    foreach ($lines as $line) {
        list($user, $x, $y, $world) = explode(',', $line);
        $players[] = array('user' => $user, 'username' => decode_username($user), 'x' => $x, 'y' => $y, 'world' => $world);
    }
    return $players;
}