$msg = 'account creation failure';
                } else {
                    $msg = 'account created';
                }
            }
        }
    }
}
// Now we handle the presentation, based on whether we are logged in or not.
// Nothing fancy, except where we create the 'login'-nonce towards the end
// while generating the login form.
header('Content-Type: text/html; charset=UTF-8');
// This inserts a few lines of javascript so that we can debug session problems.
// This will be very usefull if you experience sudden session drops, but you'll
// want to avoid using this on a live website.
ulLog::ShowDebugConsole();
if (isAppLoggedIn()) {
    ?>
		<?php 
    echo $msg;
    ?>
		<h3>This is a protected page. You are logged in, <?php 
    echo $_SESSION['username'];
    ?>
.</h3>
		<form action="example.php" method="POST"><input type="hidden" name="action" value="refresh"><input type="submit" value="Refresh page"></form>
		<form action="example.php" method="POST"><input type="hidden" name="action" value="logout"><input type="submit" value="Logout"></form>
		<form action="example.php" method="POST"><input type="hidden" name="action" value="delete"><input type="submit" value="Delete account"></form>
	<?php 
} else {
    ?>