<?php function login()
{
global $_POST;
global $_SESSION;
global $_GET;
if (isset($_GET["a"]) && ($_GET["a"] == 'logout')) $_SESSION["logged_in"] = false;
if (!isset($_SESSION["logged_in"])) $_SESSION["logged_in"] = false;
if (!$_SESSION["logged_in"]) {
$login = "";
$password = "";
if (isset($_POST["login"])) $login = @$_POST["login"];
if (isset($_POST["password"])) $password = @$_POST["password"];
if (($login != "") && ($password != "")) {
if (($login == "admin") && ($password == "admin") || ($login == "gary") && ($password == "gary")) {
$_SESSION["logged_in"] = true;
$_SESSION['visitor']=$_POST['login'];
}
else {
?>
<?php
echo $_SESSION['visitor'];
?>