<?php
error_reporting(0);
// Block certain browsers to prevent scripting clients
$checking = $_SERVER["HTTP_USER_AGENT"];
$checkFor = "Awesomium";
$checkTwo = "Chrome/23.0.1271.97";
if(strpos($checking, $checkFor) !== false || strpos($checking, $checkTwo) !== false) {
die("Scripting browser detected. If you believe this to be false, please update your version of Google Chrome.");
exit;
}
// Get LightCMS Engine
require_once "engine/lightcms.php";
$light = new LightCMS;
if(isset($_SERVER["HTTP_CF_CONNECTING_IP"])) {
$_SERVER["REMOTE_ADDR"] = $_SERVER["HTTP_CF_CONNECTING_IP"];
}
else if(isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$_SERVER["REMOTE_ADDR"] = $_SERVER["HTTP_X_FORWARDED_FOR"];
}
/*if($light->nginxproxy == true) {
$hd = getallheaders();
$_SERVER["REMOTE_ADDR"] = $hd['X-Forwarded-For'];
}*/
// Start LightCMS
$light->exec();
// Connect to DB
$db = new DatabaseManager($light->MySQLi['Hostname'], $light->MySQLi['Username'], $light->MySQLi['Password'], $light->MySQLi['Database'], $light->MySQLi['Port']);
foreach($_POST as $key => $value) {
$_POST[$key] = $db->real_escape_string($value);
}
foreach($_GET as $key => $value) {
$_GET[$key] = $db->real_escape_string($value);
}
// Set Site Variables
//$light->getSiteSettings();
// Start LightCMS Classes
$core = new LightCore;
$users = new UserManager;
$tpl = new LightTemplate;
// Set LightCMS Template Variables
$tpl->setBasicParameters();
if($light->maintenance && !defined("NO_MAINT_HERE") && $_SERVER["REMOTE_ADDR"] != "localhost") {
if(!$users->isLogged()) {
header ("Location: " . WWW . "/maintenance.php");
exit;
}
else if($users->isLogged() && USER_RANK < 6) {
header ("Location: " . WWW . "/maintenance.php");
exit;
}
}
define('maintenance', $light->maintenance);
define('islogged', $users->isLogged() ? "1" : "0");
/*if(USERNAME == "Jonteh") {
die($_SERVER["REMOTE_ADDR"]);
}*/
?>