if (!isset($_GET['p'])) { $PageName = "Welcome"; } else { $PageName = $_GET['p']; } //Connect to DB $Link = MySQL_open_connection($User, $Pass, $DB); //Check if page exists $Temp = MySQL_get_array("Pages", "Name", "Name='" . $PageName . "'"); if (strcasecmp($Temp[0], $PageName) !== 0) { echo "Page does not exist!"; exit; } unset($Temp); //Get info for page $Page_info = MySQL_get_array("Pages", "*", "Name='" . $PageName . "'"); mysql_close($Link); DB_MSG("Loading Settings..."); //Create associative array for settings $Temp = explode(";", $Page_info['Settings']); $Settings = array(); foreach ($Temp as $Value) { //Split value and variable name $Variable = explode("=", $Value); //Asign value to $Settings['Variablename'] $Settings[$Variable[0]] = $Variable[1]; } unset($Temp); DB_MSG("Loading Modules..."); //Create array for modules $Modules = explode(";", $Page_info['Modules']);
//Check if Username exists $Temp = MySQL_get_array("Users", "Username", "Username='******'"); if ($Temp[0] != $_COOKIE["Username"]) { $GLOBALS['AuthWhy'] = "Username incorrect!"; $GLOBALS['AuthStatus'] = 0; } unset($Temp); //Check Hash $Temp = MySQL_get_array("Users", "Hash", "Username='******'"); if ($Temp[0] != $_COOKIE["Hash"]) { $GLOBALS['AuthWhy'] = "Hash incorrect!"; $GLOBALS['AuthStatus'] = 0; } unset($Temp); //Check Session $Temp = MySQL_get_array("Users", "Session", "Username='******'"); if ($Temp[0] != $_COOKIE["Session"]) { $GLOBALS['AuthWhy'] = "Session incorrect!"; $GLOBALS['AuthStatus'] = 0; } unset($Temp); //Check IP $Temp = MySQL_get_array("Users", "IP", "Username='******'"); if ($Temp[0] != $_SERVER['REMOTE_ADDR']) { $GLOBALS['AuthWhy'] = "IP incorrect!"; $GLOBALS['AuthStatus'] = 0; } unset($Temp); } DB_MSG($GLOBALS['AuthWhy']); DB_MSG($_SERVER['REMOTE_ADDR']);