add basefiles
This commit is contained in:
parent
673a27e710
commit
89795faddc
10 changed files with 2407 additions and 0 deletions
61
index.php
Normal file
61
index.php
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: jedi
|
||||
* Date: 12/27/18
|
||||
* Time: 2:49 AM
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (!auth()) {
|
||||
header('WWW-Authenticate: Basic realm="C3CLOC"');
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
exit;
|
||||
} else {
|
||||
?>
|
||||
<!--p>
|
||||
<?php
|
||||
$mysqli = new mysqli("localhost", "c3cloc", "lrE6AG74aoDBLy.y", "c3cloc");
|
||||
if ($mysqli->connect_errno) {
|
||||
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
|
||||
}
|
||||
echo $mysqli->host_info . "\n";
|
||||
?>
|
||||
</p>
|
||||
<hr>
|
||||
<p>
|
||||
<?php
|
||||
$res = $mysqli->query("SELECT id FROM items ORDER BY id ASC");
|
||||
|
||||
echo "Result set order...\n";
|
||||
while ($row = $res->fetch_assoc()) {
|
||||
echo " id = " . $row['id'] . "\n";
|
||||
}
|
||||
?>
|
||||
</p-->
|
||||
<?php
|
||||
|
||||
include "templates/dashboard.php";
|
||||
}
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue