255) error("The URI you entered is to large"); $_MGM['path'] = explode("/", strtolower($_MGM['fullPath'])); $_MGM['CookiePrefix'] = ""; $_MGM['CookiePath'] = $_MGM['installPath']; $_MGM['CookieDomain'] = ".".$_MGM['domainname']; function generateURL($path) { global $_MGM; return "http".($_MGM['ssl'] ? "s" : "")."://".$_MGM['domain'].(((!$_MGM['ssl'] && $_MGM['port']==80) || ($_MGM['ssl'] && $_MGM['port']==443)) ? "" : ":{$_MGM['port']}").$_MGM['installPath'].$path; } connectToDatabase(); if (file_exists("code/setup.php")) { require("code/setup.php"); } if (isset($_COOKIE["{$_MGM['CookiePrefix']}user_email"])) { $result = databaseQuery("SELECT * FROM users WHERE email=%s AND level!=0", $_COOKIE["{$_MGM['CookiePrefix']}user_email"]); $user = databaseFetchAssoc($result); if ($user!=NULL && hash("sha512", $user['password'].$user['time'])==$_COOKIE["{$_MGM['CookiePrefix']}user_password"]) { $_MGM['user'] = $user; } } if (!isset($_MGM['user']) && $_MGM['path'][0]=="login") { require("code/login.php"); } if (isset($_MGM['user']) && $_MGM['path'][0]=="logout") { require("code/logout.php"); } if ($_MGM['path'][0]=="re-ocr") { require("code/re-ocr.php"); } if (isset($_MGM['user']) && $_MGM['path'][0]=="upload") { require("code/upload.php"); } if ($_MGM['path'][0]=="api") { require("code/api.php"); } if (isset($_MGM['user']) && $_MGM['user']['level']==1 && $_MGM['path'][0]=="users") { require("code/users.php"); } if (isset($_MGM['user']) && $_MGM['path'][0]=="tagless") { require("code/tagless.php"); } if ($_MGM['path'][0]=="hash") { require("code/hash.php"); } if ($_MGM['path'][0]!="") { require("code/404.php"); } require("code/index.php"); ?>