Tobias Hopp 8bfe0c6205 Adding sort algorythm
Wasted already 10hrs 17mins  on that project.

Took 2 minutes
2020-08-07 15:30:57 +02:00

59 lines
1.3 KiB
PHP

<?php
/**
* The Main file of the website
*/
require_once 'main.inc.php';
try
{
// Better Cache-Control
$etag = filesize( LANG_DIRECTORY . language::$lang . '.ini' ) + filesize( 'website.html' ) . filesize( 'website.class.inc.php' );
header( 'Cache-Control: max-age=86400' );
header( 'ETag: ' . $etag );
if( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && $_SERVER['HTTP_IF_NONE_MATCH'] === $etag )
{
header( 'HTTP/1.1 304 Not Modified', true, 304 );
exit();
}
$website = new website();
if( isset( $_POST['submit'] ) )
{
$content = $website->showScore();
}
else
{
$content = $website->buildWebsite();
}
//@ob_clean();
echo $content;
} catch( Exception $e )
{
if( $e->getCode() === 201 )
{
HTTPStatus( 503 );
echo 'We encountered an critical error.<br>The website file cannot be loaded!';
return;
}
if ( $e->getCode() === 202 )
{
HTTPStatus( 503 );
echo 'We encountered a critical error.<br>The language file cannot be loaded!';
return;
}
if( $e->getCode() === 203 )
{
HTTPStatus( 503 );
echo 'We encountered a critical error<br>The questions cannot be loaded!';
return;
}
HTTPStatus( 500 );
echo 'We encountered a critical error.<br>That\'s all what we known!';
}