<?php

/* FIRESHOP: Advanced Content Market System                         */

/* ============================================                         */

/*                                                                      */

/* Copyright (c) 2012 by Mohamad Porhaji                                */

/* http://Firedesign.ir                                                   */

/*                                                                      */

/* This program is free software.  */

/************************************************************************/

/* $Id: product.php,v 1.0.0.1 2012/02/18 By Mohamad Porhaji $ */
define('PRODUCT_FILE', true);
require_once("mainfile.php");
global $db;


if(!isset($_GET['id']) or !is_numeric(@$_GET['id']))
{
echo"چنين صفحه اي در سايت وجود ندارد";

}else{

global $db;
counter_face();
$id =$_GET['id'];
$query = $db->sql_query("SELECT * FROM `fireshop_product` WHERE id='$id'") or die(mysql_error());
if($db->sql_numrows($query) == 0 ){
echo"چنين محصولي در سايت وجود ندارد";
}else{

$row = $db->sql_fetchrow($query);
$product_date = $row['product_date'];
$product_title=$row['product_title'];
$product_des = $row['product_des'];
$id= $row['id'];
$product_pic = $row['product_pic'];
$product_cat = $row['product_cat'];
$product_price = $row['product_price'];
$product_view = $row['product_view'];
$db->sql_query("UPDATE `fireshop_product` SET product_view=product_view+1  WHERE id='$id'");

$query = $db->sql_query("SELECT * FROM fireshop_category WHERE `id`='$product_cat'");
$row = $db->sql_fetchrow($query);
$cat_title = $row['title'];
}
}

$title_page_over="$product_title";
$page_title = "$product_title | توضيحات محصول";


function content()

{

if(!isset($_GET['id']) or !is_numeric(@$_GET['id']))
{
echo"چنين صفحه اي در سايت وجود ندارد";

}else{

global $db;
$id =$_GET['id'];
$query = $db->sql_query("SELECT * FROM `fireshop_product` WHERE id='$id'") or die(mysql_error());
if($db->sql_numrows($query) == 0 ){
echo"چنين محصولي در سايت وجود ندارد";
}else{

$row = $db->sql_fetchrow($query);
$product_date = $row['product_date'];
$product_title=$row['product_title'];
$product_des = $row['product_des'];
$id= $row['id'];
$product_pic = $row['product_pic'];
$product_cat = $row['product_cat'];
$product_price = $row['product_price'];
$product_price = number_format($product_price, 0);
$product_view = $row['product_view'];



$db->sql_query("UPDATE `fireshop_product` SET product_view=product_view+1  WHERE id='$id'");

$query = $db->sql_query("SELECT * FROM fireshop_category WHERE `id`='$product_cat'");
$row = $db->sql_fetchrow($query);
$cat_title = $row['title'];

echo"
<div dir='rtl' align='right' style='padding:10px;'>
<table>
<tr>
<td valign='top'>
<br/>
<img src='$product_pic' width='190' height='145'/>
<br/>
</td>
<td valign='top'>
<br/>
<div style='padding:10px;'>
<b>$product_title</b> <br/><br/>
قيمت : <b>$product_price</b> تومان <br/>
تعداد بازديد : $product_view  | دسته بندي : $cat_title <br/><br/>

<form action='buy.php' method='post'>
<input type='hidden' name='id' value='$id'/>
<input type='hidden' name='buy'/>
<input type=\"image\"  src='img/buy_el.gif' width='100' height='25' >
</form>

<br/>
</div>
</td>
</tr>
</table>
<br/>
</div>
<div dir='rtl' align='justify' style='padding:10px;'>
$product_des</div>
<br/><br/>
<div align='left' style='padding:10px;'>
<form action='buy.php' method='post'>
<input type='hidden' name='id' value='$id'/>
<input type='hidden' name='buy'/>
<input type=\"image\" src='img/buy_el.gif' width='128'   >
</form>

<div class=\"clear\"></div></div>";


}
}
}

function in_model(){
global $db,$product_cat;

$sql = $db->sql_query("SELECT * FROM fireshop_product  ORDER BY `product_time_stamp` DESC Limit 6");
while ($row = $db->sql_fetchrow($sql)) {
$product_title = $row['product_title'];
$product_title = substr($product_title, 0,70);
$product_pic = $row['product_pic'];
$id= $row['id'];
$product_price = $row['product_price'];
$product_price = number_format($product_price, 0);
echo"
<div class=\"product_self\">
<table>
<tr>
<td width=\"223\" valign=\"top\">
<div class=\"product\">
<div class=\"product_top\">&nbsp;&nbsp;$product_title</div>
<div class=\"product_bg\">
<div class=\"product_content\">
<div align=\"center\">
<img src=\"$product_pic\" height=\"145\" width=\"190\"/>
<br/><br/>
<div class=\"cust_pro\">$product_price&nbsp; تومان</div>
<div align=\"center\" style=\"width: 180px; margin-top: 5px;\">
<form action='buy.php' method='post'>
<input type='hidden' name='id' value='$id'/>
<input type='hidden' name='buy'/>
<div class=\"buy_pro\"><a><input type=\"image\" src=\"template/fireshop_default/images/buy_p.png\"  onmouseover=this.src='template/fireshop_default/images/buy_p_hover.png' onmouseout=this.src='template/fireshop_default/images/buy_p.png' ></a></div></form>
<div class=\"more_pro\"><a href=\"product.php?id=$id\"></a></div>
</div>
<div class=\"clear\"></div>
</div>
</div></div>
<div class=\"product_bt\"></div>
</div>
</td>
</tr>
</table>
</div>
";
}
}
theme();
?>