\n"; timer_start(); // put the categories in here... $cats = array(); $cats[] = "Games"; $cats[] = "Funny"; $cats[] = "Music"; $cats[] = "Shocking"; $cats[] = "Animations"; $cats[] = "Movies"; $cats[] = "Funpics"; $cats[] = "Werbeclips"; $cats[] = "Schocker"; $cats[] = "Funtexte"; $cats[] = "TV"; $cats[] = "Cool"; $cats[] = "Other"; // We start the user's login... if needed, // We also get an array of all ( $ranks[] ) and the user's variables ( $user[] ) $ranks = array(); $query = "SELECT id, name FROM " . $DBPREFIX . "ranks"; $rst = mysql_query($query); while($row = mysql_fetch_row($rst)) { $ranks[$row[0]] = $row[1]; } $user = array(); // IP Check if (getenv('HTTP_CLIENT_IP')) { $temp = getenv('HTTP_CLIENT_IP'); } elseif (getenv('HTTP_X_FORWARDED_FOR')) { $temp = getenv('HTTP_X_FORWARDED_FOR'); } elseif (getenv('HTTP_X_FORWARDED')) { $temp = getenv('HTTP_X_FORWARDED'); } elseif (getenv('HTTP_FORWARDED_FOR')) { $temp = getenv('HTTP_FORWARDED_FOR'); } elseif (getenv('HTTP_FORWARDED')) { $temp = getenv('HTTP_FORWARDED'); } else { $temp = $_SERVER['REMOTE_ADDR']; } $temp = gethostbyname($temp); $user["ip"] = $temp; if( isset($_COOKIE[$DBPREFIX]) ) { // Person has a cookie, let's check it out $data = unserialize(stripslashes($_COOKIE[$DBPREFIX]));; if($data['name'] && $data['id'] && $data['login'] < (time()-60)) { $query = "SELECT password FROM " . $DBPREFIX . "users WHERE name = '". $data['name'] ."'"; $rst = mysql_query($query); while($row = mysql_fetch_row($rst)) { $temp = $row[0]; } if($temp == $data['password']) { $user['id'] = $data['id']; $user['name'] = $data['name']; $user['email'] = $data['email']; $user['site'] = $data['website']; $user['theme'] = $data['layout']; $user['login'] = $data['login']; $user['ranks'] = $data['rank']; } } $query = "SELECT password FROM " . $DBPREFIX . "users WHERE name = '". $cookie['username'] ."'"; $rst = mysql_query($query); while($row = mysql_fetch_row($rst)) { $temp = $row[0]; } if($temp == $cookie['password_hash']) { login($cookie['username'], time()+(3600*24*1000)); // login for 1000 days :p } } if(!$user['id']) { $user["id"] = "1"; $user["name"] = "Guest"; $user["theme"] = "default"; } // check if the user's banned... if(banned($user['ip']) == true && $page != "banned.php") { header('Location: banned.php'); } // include the style (needed for the midsection / menu functions) if(!file_exists($base."themes/".$user["theme"]."/style.php")) { $user["theme"] = "default"; } include $base."themes/".$user["theme"]."/style.php"; $debug .= "Included style @ ". (getmicrotime()-$START) ." \n
\n"; // Setting up the online data.... $past = time()-140; // you stay online 300 seconds after clicking your last link $query = "SELECT time FROM " . $DBPREFIX . "online WHERE ip = '". $user['ip'] ."' AND time > ". $past; $rst = mysql_query($query); if(mysql_num_rows($rst) == "0") { $query = "INSERT INTO ". $DBPREFIX ."online values ('','". $user['ip'] ."', '". $page ."', '". time() ."')"; } else $query = "UPDATE ". $DBPREFIX ."online set page = '". $page ."', time = '". time() ."' WHERE ip = '". $user['ip'] ."'"; @mysql_query($query); $query = "DELETE FROM ". $DBPREFIX ."online WHERE time < ". $past; @mysql_query($query); $query = "SELECT * FROM ". $DBPREFIX ."online"; $rst = mysql_query($query); $num_users = mysql_num_rows($rst); $debug .= "Updated online status @ ". (getmicrotime()-$START) ." \n
\n"; // And now we run through the MENUS folder and put all the menus' HTML code inside 1 big array ($MENUS['menuname']) $MENUS = Array(); $handle=opendir($base ."menus/"); while (false !== ($menufile = readdir($handle))) { if($menufile != "." && $menufile != "..") { // echo "Including : ". $base."menus/".$menufile ."
"; include_once($base."menus/".$menufile); $debug .= "Included menu (". $menufile .") @ ". (getmicrotime()-$START) ." \n
\n"; } } closedir($handle); $temp = Array(); $MENUNAMES = Array(); $query = "SELECT * FROM " . $DBPREFIX . "menus ORDER BY 'volgorde'"; $rst = mysql_query($query, $con); while ($row = mysql_fetch_row($rst)) { $temp[$row[1]] .= $MENUS[$row[0]]; } foreach($MENUS as $tempname => $html) { $MENUNAMES[$tempname] = "true"; } $MENUS = $temp; unset ($temp); $debug .= "Finnished config file @ ". (getmicrotime()-$START) ." \n
\n"; ?>