<?
include('../includes/common.php');

$action = $_GET['action']==""?$_POST['action']:$_GET['action'];

$page_code = $_GET['page_code']==""?$_POST['page_code']:$_GET['page_code']; // pseudostatics
$page_code=trim($page_code,"/");
$id = $_GET['id']==""?$_POST['id']:$_GET['id'];

if(!is_numeric($id))
{
	if(eregi("^[A-Za-z_/0-9.]+$",$page_code))
	{
		$row = @mysql_fetch_object(mysql_query("select * from pages where pseudo_name='$page_code' and status=1"));

		if($row->id!="")
		{
			$id = $row->id;
		}
		else
		{
			header($_SERVER['SERVER_PROTOCOL']." 404 Not Found");
			echo file_get_contents("404.php");
			exit;
		}
	}
	else
	{
		$id = -1;
	}
}

$page_row = @mysql_fetch_object(mysql_query("select * from pages where id=$id and status=1"));
if($page_row->id==""){
	header($_SERVER['SERVER_PROTOCOL']." 404 Not Found");
	echo file_get_contents("404.php");
	exit;
}

$smarty->assign("title", $SETTINGS['site_name']);
$smarty->assign("info", "С помощью обменника вы можете моментально 
обменять одну электронную валюту на другую. Для совершения операции
 нажмите на строку с той валютой, которую вы хотите получить.");
$smarty->assign("ex_currencies", $ex_currencies);
$smarty->assign("main_class", "main");
$smarty->assign("money_cources", get_currency_cources());
$smarty->assign("metal_cources", get_metal_cources());
$smarty->assign("content", stripslashes($page_row->content));
$smarty->assign("page_title", stripslashes($page_row->title));
$smarty->display("smartex_page.tpl");
?>