0
0
This repository has been archived on 2020-11-15. You can view files and clone it, but cannot push or open issues or pull requests.
OpenShorte.old/index.php
Bryan Pedini 4a6630bacb
Refactored database, refactored config file, corrected login redirection
Moved database function in class "Database";
Corrected database-using webpages accordingly;
Moved config file from PHP to JSON with more config variables;
Corrected login page redirection on wrong username or password.
2019-03-21 12:07:23 +01:00

31 lines
977 B
PHP

<?php
session_start ( );
require_once ( 'config.php' );
require_once ( 'functions.php' );
$config = load_config ( );
$request = split_uri_array ( $_SERVER [ 'SCRIPT_NAME' ], $_SERVER [ 'REQUEST_URI' ] );
if ( isset ( $request [ 0 ] ) && $request [ 0 ] != "" ) {
switch ( $request [ 0 ] ) {
case "go":
include ( 'lib/php/go.php' );
break;
case "login":
include ( 'lib/php/login.php' );
break;
case "logout":
include ( 'lib/php/logout.php' );
break;
case "insert":
include ( 'lib/php/insert.php' );
break;
default:
http_response_code ( 404 );
include ( 'errors/404.html' );
die ( );
}
}
else {
header ( "Location: " . substr ( $_SERVER [ 'SCRIPT_NAME' ], 0, -10 ) . "/login" );
}
?>