Youtube-dl-WebUI/sessions.php
p1rox 30f2477d34 Password protection added with session
Functions freeSpace and destFolderExists moved to utilities.php
2014-03-21 21:15:45 +01:00

33 lines
No EOL
559 B
PHP

<?php
// Start session
session_start();
// Include config.php
require_once("config.php");
function startSession($pass)
{
$pass = htmlentities($pass);
global $security;
if($security == 1)
{
if(passwordMatch($pass)) $_SESSION['logged'] = 1;
else $_SESSION['logged'] = 0;
} else {
$_SESSION['logged'] = 1;
}
}
function passwordMatch($pass)
{
global $secretPassword;
if(md5($pass) == $secretPassword) return 1;
else return 0;
}
function endSession()
{
global $security;
if($security == 1) session_destroy();
}
?>