c3lf-system-3/index.php
2018-12-27 08:27:47 +01:00

43 lines
No EOL
880 B
PHP

<?php
/**
* Created by PhpStorm.
* User: jedi
* Date: 12/27/18
* Time: 2:49 AM
*/
include "backend.php";
function auth(){
if(!isset($_SERVER['PHP_AUTH_USER']))
return false;
if(!isset($_SERVER['PHP_AUTH_PW']))
return false;
if($_SERVER['PHP_AUTH_USER']!="c3cloc")
return false;
if($_SERVER['PHP_AUTH_PW']!="c3cloc")
return false;
return true;
}
function get_items(){
global $mysqli;
$res = $mysqli->query("SELECT * FROM items ORDER BY id ASC");
$ret = array();
while ($row = $res->fetch_assoc()) {
$ret[] = $row;
}
return $ret;
}
$page = isset($_GET["page"])?$_GET["page"]:"dashboard";
if (!auth()) {
header('WWW-Authenticate: Basic realm="C3CLOC"');
header('HTTP/1.0 401 Unauthorized');
include "templates/404.php";
exit;
} else {
include "templates/page.php";
}
?>