c3lf-system-3/index.php

53 lines
1.1 KiB
PHP
Raw Normal View History

2018-12-27 04:23:10 +00:00
<?php
/**
* Created by PhpStorm.
* User: jedi
* Date: 12/27/18
* Time: 2:49 AM
*/
2018-12-27 07:27:47 +00:00
include "backend.php";
2018-12-27 04:23:10 +00:00
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;
}
2018-12-27 07:52:14 +00:00
function get_founditems(){
2018-12-27 04:23:10 +00:00
global $mysqli;
$res = $mysqli->query("SELECT * FROM items ORDER BY id ASC");
$ret = array();
while ($row = $res->fetch_assoc()) {
$ret[] = $row;
}
return $ret;
}
2018-12-27 07:52:14 +00:00
function get_lostitems(){
global $mysqli;
$res = $mysqli->query("SELECT * FROM lost ORDER BY id ASC");
$ret = array();
while ($row = $res->fetch_assoc()) {
$ret[] = $row;
}
return $ret;
}
2018-12-27 07:27:47 +00:00
$page = isset($_GET["page"])?$_GET["page"]:"dashboard";
2018-12-27 04:23:10 +00:00
if (!auth()) {
header('WWW-Authenticate: Basic realm="C3CLOC"');
header('HTTP/1.0 401 Unauthorized');
2018-12-27 07:27:47 +00:00
include "templates/404.php";
2018-12-27 04:23:10 +00:00
exit;
} else {
2018-12-27 07:27:47 +00:00
include "templates/page.php";
2018-12-27 04:23:10 +00:00
}
?>