include('phpcode.php'); // Null out important variables $log = false; $sub = false; // Verify page validity if(isset($_GET['p']) && isset($validPages[$_GET['p']])) { $thisPage = $validPages[$_GET['p']]; // If there's an s, check that it's a valid titleurl or id if(isset($_GET['s']) && in_array($_GET['p'], $haveSubs)) { connectdb(); $q = "SELECT pid FROM posts WHERE pid = '".clean($_GET['s'])."' OR titleurl = '".clean($_GET['s'])."'"; $r = mysql_fetch_assoc(mysql_query($q)); closedb(); if($r) { $sub = $r['pid']; $thisPage = $validPages['archive']; } else { $sub = "invalid"; } } } else { // Check if we have a content page by titleurl and id connectdb(); $q = "SELECT pid FROM posts WHERE pid = '".clean($_GET['p'])."' OR titleurl = '".clean($_GET['p'])."'"; $r = mysql_fetch_assoc(mysql_query($q)); closedb(); if($r) { $thisPage = $validPages['archive']; $sub = $r['pid']; } //otherwise, default to main else { $thisPage = $validPages['main']; } } // If logging out, go to main // If logged in, verify login if($_COOKIE['login']) { $tmp = explode("-", $_COOKIE['login']); connectdb(); $q = "SELECT * FROM users WHERE uid = '".clean($tmp[1])."'"; $r = mysql_fetch_assoc(mysql_query($q)); if(!$r) { unset($_COOKIE['login']); setcookie("login", "", 0, "/"); } else { $hashcookie = md5(strtolower($r['username']).$r['passcode']); if($tmp[0] != $hashcookie) { unset($_COOKIE['login']); setcookie("login", "", 0, "/"); } else { $log = array(); $log['uid'] = $r['uid']; $log['realname'] = $r['realname']; $log['username'] = $r['username']; $log['perm'] = $r['perm']; } } closedb(); } // Preload files $imgList = array(); if ($handle = opendir('content')) { while (false !== ($entry = readdir($handle))) { if(in_array(getExtension($entry), $imgTypes)) { $imgList[] = "content/".$entry; } } } ?>
// HTML Head Info include("htmlhead.php"); ?>