<?php session_start() ;
include("include/config.php");
include("include/db.class.php");
include("include/functions.php");
include_once("adminparspatent/include/jdf.php");
$db=new DB($globalConfig['dbase'], $globalConfig['dbhost'],$globalConfig['dbuser'], $globalConfig['dbpass']);
if(isset($_GET['lang'])){
			$t=$_GET['lang'];
		if($t=="en"){
$_SESSION['language']="en";

}
else{
	$_SESSION['language']="pr";

}}elseif(!isset($_SESSION['language'])){$_SESSION['language']="pr";} 
$array = explode('/',$_SERVER["REQUEST_URI"]);
switch(urlencode($array[1])){
	case '':
 		include("home.php"); 
    break;
	case 'RSS':
 		include("rss.php"); 
    break;
	case 'rss':
 		include("rss.php"); 
    break;		
	case 'login':
		include("login.php");
    break;
	case 'register':
		include("register.php");
    break;
	case 'career':
		include("career.php");
    break;

	case 'gallery':
		include("gallery.php");
    break;
	case 'articles':
	include("article.php");
		 break;
	case 'category':
	$epad = $db->query("SELECT * FROM categories WHERE slug = '".$db->safe_string(urldecode($array[2]))."'");
	$return=mysql_num_rows($epad);
	
	if($return>0){
		$post1=$db->fetchNextArray($epad);
		include("category.php");
		}else{
			include("home.php");
			}
			
    break;
	case 'products':
	$epad = $db->query("SELECT * FROM parts WHERE slug = '".$db->safe_string(urldecode($array[2]))."' and category=11");
	$return=mysql_num_rows($epad);
	
	if($return>0){
		$post=$db->fetchNextArray($epad);
		include("products.php");
		}else{
			include("home.php");
			}
			
    break;
	
case 'tag':
	
	$ecat = $db->query("SELECT * FROM tags WHERE slug = '".$db->safe_string(urldecode($array[2]))."'");
	$catnum=mysql_num_rows($ecat);
	
	if($catnum>0){
		$tag=$db->fetchNextArray($epad);
		include("tags.php"); 
		}else{
			include("home.php"); 
			}
			
		
    break;
	default:
	$epad = $db->query("SELECT * FROM parts WHERE slug = '".$db->safe_string(urldecode($array[1]))."'");
	$return=mysql_num_rows($epad);
	
	if($return>0){
		$post=$db->fetchNextArray($epad);
		include("pages.php");
		}else{
			include("home.php");
			}
	break;
}

?>

