<?php
if(!defined('IN_TM')) {exit('Access Denied');}
if($id){
	$id = intval($id);
	$product = $db->get_one("SELECT * FROM ".DB_PRE."product WHERE `id` = '{$id}'");
	$head['title'] = $product[title].'-'.$TM['meta_title'];
	$head['keywords'] = $TM['meta_keywords'];
	$head['description'] = $TM['meta_description'];
	$title = $product[title];
	$body = $product[body];
	$time = date("YÄê-mÔÂ-dÈÕ hÊ±:i·Ö", $product[time]);
	$zz = $product[zz];
	$ly= $product[ly];
	$hist= $product[hist];
	$db->query("UPDATE ".DB_PRE."product SET hist = hist+1 WHERE id ={$id};");
	$db->close();
	$tplid=1;
	include view('product');
}elseif($fid){
	$fid = intval($fid);
	$page = max(intval($page), 1);
	$page_size = 20; 
	$r = $db->get_one("SELECT count(*) as num FROM ".DB_PRE."product WHERE `ssfl` =$fid");
	$mpurl =$PHP_SELF.'?file=product&fid='.$fid.'&';
	$dispage =  page($r['num'],$page_size,$page,$mpurl);
	$newslist = get('product',"WHERE `ssfl` =$fid",'id DESC', $page, $page_size);
	$a = 'Y-m-d H:i';
	$tplid=2;
	include view('product');
}else{
	$page = max(intval($page), 1);
	$page_size = 20; 
	$r = $db->get_one("SELECT count(*) as num FROM ".DB_PRE."product");
	$mpurl =$PHP_SELF.'?file=product&';
	$dispage =  page($r['num'],$page_size,$page,$mpurl);
	$newslist = get('product',"",'id DESC', $page, $page_size);
	$a = 'Y-m-d H:i';
	$tplid = 3;
	$db->close();
	include view('product');
}
?>