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; } function hashPassword($password, $salt) { $hashed = hash("sha512", $salt.$password); for ($i=0; $i<10000; $i++) { $hashed = hash("sha512", $salt.hex2bin($hashed)); } return $hashed; } function error($error) { echo $error."
\n"; } connectToDatabase(); function getSetting($name) { $results = databaseQuery("SELECT value FROM settings WHERE name=%s", $name); if ($results==NULL) { return ""; } $result = databaseFetchAssoc($results); return $result['value']; } function setSetting($name, $value) { $results = databaseQuery("SELECT value FROM settings WHERE name=%s", $name); if ($results==NULL || databaseRowCount($results)==0) { databaseQuery("INSERT INTO settings (name,value) VALUES (%s,%s)", $name, $value); } else { databaseQuery("UPDATE settings SET value=%s WHERE name=%s", $value, $name); } } 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 (isset($_MGM['user']) && $_MGM['user']['level']==1 && $_MGM['path'][0]=="sidebar") { require("code/sidebar.php"); } else if (isset($_MGM['user']) && $_MGM['user']['level']==1 && $_MGM['path'][0]=="users") { require("code/users.php"); } else if (isset($_MGM['user']) && $_MGM['user']['level']==1 && $_MGM['path'][0]=="settings") { require("code/settings.php"); } else if (isset($_MGM['user']) && $_MGM['path'][0]=="members") { require("code/members.php"); } else if (isset($_MGM['user']) && $_MGM['path'][0]=="meetings") { require("code/meetings.php"); } else if (isset($_MGM['user']) && $_MGM['path'][0]=="announcements") { require("code/announcements.php"); } else if ($_MGM['path'][0]=="rsvp") { require("code/rsvp.php"); } else if ($_MGM['path'][0]=="api") { require("code/api.php"); } $page = str_replace("..", "", $_MGM['fullPath']); if ($page=="" || substr($page, strlen($page)-1, 1)=="/") { $page .= "index"; } if (!file_exists("pages/".$page.".html")) { header("HTTP/1.0 404 Not Found"); require_once("header.php"); readfile("pages/404.html"); require_once("footer.php"); exit(); } require_once("header.php"); readfile("pages/".$page.".html"); require_once("footer.php"); ?>