2014-03-22 04:15:45 +08:00
|
|
|
<?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()
|
|
|
|
{
|
2014-04-02 06:47:48 +08:00
|
|
|
global $security, $mainPage;
|
|
|
|
if($security == 1) session_destroy();
|
|
|
|
header("Location: ".$mainPage);
|
2014-03-22 04:15:45 +08:00
|
|
|
}
|
2014-04-02 06:47:48 +08:00
|
|
|
?>
|