include_once $_SERVER['DOCUMENT_ROOT']."/config.php";
$template=file_get_contents("Templates/main.dwt");
$data='';
$error='';
if (isset($_GET['n']) && is_numeric($_GET['n'])) $n=$_GET['n'];
elseif (isset($up_n) && is_numeric($up_n)) $n=$up_n;
else $error='Ошибка. Неправильно задан идентификатор товара.';
if (isset($_GET['image']) && is_numeric($_GET['image'])) $image=$_GET['image'];
else $image=1;
if ($error=='')
{
$res=mysql_query("select * from `goods` where `n`=$n");
if (mysql_num_rows($res)!=1) $error='Ошибка. Такого товара на сайте нет.';
}
if ($error!='') $data=$error;
else
{
$row=mysql_fetch_array($res);
$images='';
for ($i=1;$i<=5;$i++)
{
$sm=$_SERVER['DOCUMENT_ROOT']."/goods_pictures/".$row['n']."/sm/".$i.".jpg";
$page=$_SERVER['SCRIPT_NAME'];
if ($page=='/item.htm') $hvost='?n='.$n;
else $hvost='';
if ($i!=1)
{
if ($hvost=='') $hvost2='?';
else $hvost2='&';
$hvost2.='image='.$i;
}
else $hvost2='';
if (file_exists($sm))
{
$images.='';
}
}
$images='
'.$row['name'].'Артикул: '.$row['art'].''.$colors.' '.$params.' '.nl2br($row['dsc']).' |