File: //home/temp/autoprokat.vladweb.ru/index.php
<?
	session_start();
	include("cfg/connect.inc.php");
	include("cfg/mysql.php");
	include("cfg/general.inc.php");
	include("cfg/lang.inc.php");  	//authorized login check echo    $_SESSION["login"];
//echo    $_SESSION["password"];
	include("./checklogin.php");  //echo    $_SESSION["login"];
//echo    $_SESSION["password"];
//exit;
foreach($_POST as $k=>$v){
$$k = $v;
}
	if (!isset($_SESSION["login"]) || !isset($_SESSION["password"])) //unauthorized
	{
		header("Location: access_admin.php");
	} 
	//logout?
	if (isset($_GET["logout"])) //logout
	{
		//show authorization form
		unset($_SESSION["login"]);
		unset($_SESSION["pass"]);
		header("Location: index.php?xyu!!!");
	}
	//init Smarty
	require 'smarty/Smarty.class.php';
	$smarty = new Smarty; //core smarty object
	$smarty_mail = new Smarty; //for e-mails
	//connect to database
	db_connect(DB_HOST,DB_USER,DB_PASS) or die (db_error());
	db_select_db(DB_NAME) or die (db_error());
	mysql_query ("set character_set_client='cp1251'"); 
mysql_query ("set character_set_results='cp1251'"); 
mysql_query ("set collation_connection='cp1251_general_ci'");
@mysql_query("/*!40101 SET NAMES 'cp1251' */");
	//set Smarty include files dir
	$smarty->template_dir = $template_path."/admin";
	//define smarty template
	$smarty->assign("admin_main_content_template", "default.tpl");
	// includes all .php files from includes/ dir
	$includes_dir = opendir("./includes/admin");
	$file_count = 0;
	while ( ($inc_file = readdir($includes_dir)) != false )
		if (strstr($inc_file,".php"))
		{
			include("./includes/admin/$inc_file");
			$file_count++;
		}
	//show Smarty output
	$smarty->display("index.tpl");
?>