include_once("includes/mysql.php"); $db = &new MySQL($host, $dbUser, $dbPass, $dbName); $tmp = explode('/', $_SERVER['REQUEST_URI']); $link = $tmp[1]; if(isset($_GET['cat_name'])) { $cat_name = trim($_GET['cat_name'], '/'); $cat_name = str_replace('-','_',urldecode($cat_name)); $query = "SELECT * FROM `categories` WHERE `category_string`='".$cat_name."'"; $res = mysql_query($query); $row = mysql_fetch_assoc($res); if(!empty($row['category_id'])) $_GET['cat'] = $row['category_id']; } else { $query = "SELECT * FROM `posts` WHERE `link`<>'' AND `link`='".$link."'"; $res = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($res); if(isset($row['post_id']) && !empty($row['post_id'])) { $_GET['post_id']= $row['post_id']; $post_title = $row['title']; } } if(empty($_GET['post_id']) && empty($_GET['cat']) && empty($_SERVER['QUERY_STRING'])) { $req_path = $_SERVER['DOCUMENT_ROOT'] . "/" . $_SERVER['REQUEST_URI']; if(!is_file($req_path) && !file_exists($req_path)) { header("HTTP/1.1 404 Not found"); include('404.php'); exit; } } include("includes/setup_meta.php"); include_once 'includes/functions.php'; ?>
$page = "home"; include("includes/header.php") ?> if (!isset($_GET['post_id'])) { $addstyle = "inline"; } include("includes/sub_header.php") ?> if (isset($_GET['post_id'])) { include("includes/post_details.php"); } else { include("includes/posts_homepage.php"); } ?> include("includes/footer.php") ?>