www: Add optional debugging
debug.php: Set verbose error reporting
{post,session}.php: Make val() function static
debug.php: Add shutdown and error handlers