From be2491b093b1f0ca430bede679ecbb670041e483 Mon Sep 17 00:00:00 2001 From: cassio Date: Tue, 2 Jul 2013 09:46:45 +0400 Subject: restructuring of boca's git --- src/site/header.php | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 src/site/header.php (limited to 'src/site/header.php') diff --git a/src/site/header.php b/src/site/header.php new file mode 100644 index 0000000..f1b47b3 --- /dev/null +++ b/src/site/header.php @@ -0,0 +1,88 @@ +. +//////////////////////////////////////////////////////////////////////////////// +// Last modified 05/aug/2012 by cassio@ime.usp.br +ob_start(); +header ("Expires: " . gmdate("D, d M Y H:i:s") . " GMT"); +header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); +header ("Cache-Control: no-cache, must-revalidate"); +header ("Pragma: no-cache"); +header ("Content-Type: text/html; charset=utf-8"); +session_start(); +//require_once('../version.php'); +require_once("../globals.php"); +require_once("../db.php"); + +if(!function_exists("globalconf") || !function_exists("sanitizeVariables")) { + ob_end_flush(); + ForceLoad("../index.php"); + exit; +} + +$getx=array(); +if(isset($_GET['name'])) $getx['name']=$_GET['name']; +if(isset($_GET['password'])) $getx['password']=$_GET['password']; +if(isset($_GET['check'])) $getx['check']=$_GET['check']; +//if(isset($_POST)) { +if(isset($_POST["name"])) $getx['name']=$_POST['name']; +if(isset($_POST["password"])) $getx['password']=$_POST['password']; +if(isset($_POST["check"])) $getx['check']=$_POST['check']; +//} +//LOGError("PHPID=".$_COOKIE['PHPSESSID'].",extra=".$_SESSION['usertable']['usersessionextra']. +// ",session=".session_id().",name=".$getx['name'].", password=".$getx['password'].",check=".$getx['check']); +if (!isset($_SESSION["usertable"])) { + if(isset($getx['name']) && $getx['name'] != "" && isset($getx['password']) && $getx['password'] != "") { + $name = $getx["name"]; + LogLevel("Connection try by IP " . getIP() . ", username=" . $name,2); + $password = $getx["password"]; + $usertable = DBLogIn($name, $password, false); + if(!$usertable) { + ob_end_flush(); + echo "\n"; + exit; + } + if(!isset($getx['check'])) { + ob_end_flush(); + echo "\n"; + exit; + } + } else { + ob_end_flush(); + LogLevel("Init connection by IP " . getIP(),2); + echo "\n"; + exit; + } +} +if(!ValidSession()) { + ob_end_flush(); + InvalidSession("site/index.php"); + ForceLoad("../index.php"); + exit; +} +if(isset($getx['check']) && isset($getx["password"]) && $getx['check'] != myhash($getx["password"] . $_SESSION['usertable']['userpassword'])) { + ob_end_flush(); + echo "\n"; + exit; +} + +if($_SESSION["usertable"]["usertype"] != "site") { + ob_end_flush(); + IntrusionNotify("site/index.php"); + ForceLoad("../index.php"); + exit; +} +?> -- cgit v1.2.3