start of admin panel

testing
nokonoko 2021-06-21 23:44:27 +02:00
parent d3acd4328d
commit b873b00865
2 changed files with 36 additions and 0 deletions

31
static/php/admin.php Normal file
View File

@ -0,0 +1,31 @@
<?php
session_start();
//include the database which also includes the settings
require_once('includes/database.inc.php');
function hash_pw($in){
$options = [
'cost' => 12,
];
return password_hash($in, PASSWORD_BCRYPT, $options);
}
//Check if the login details are correct
if($_POST['user'] == UGUU_ADMIN_USER && hash_pw($_POST['pass']) == UGUU_ADMIN_PASS){
$_SESSION['valid'] = true;
$_SESSION['timeout'] = time();
}else{
echo 'wrong bitch!';
}
//function to delete file or delete it and blacklist
function delete_file($in, $opt){
//Check if admin is logged in
if(isset($_SESSION['valid'])){
//Check if blacklist or not
if(isset($opt)){
}
}
}

View File

@ -25,6 +25,11 @@ define('UGUU_DB_USER', 'NULL');
/* @param string UGUU_DB_PASS Database password */
define('UGUU_DB_PASS', 'NULL');
/* @param string UGUU_ADMIN_NAME username */
define('UGUU_ADMIN_USER', 'admin');
/* @param string UGUU_ADMIN_PASS password as hash*/
define('UGUU_ADMIN_PASS', '$2y$12$.NHW25QBD/XPSYkNe6tEtObwEXsJeiQIo3xWidU.21ECkFMK.SE8C%');
/** Log IP of uploads */
define('LOG_IP', 'no');