<?php

/* FIRESHOP: Advanced Content Market System                         */

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

/*                                                                      */

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

/* http://Firedesign.ir                                                   */

/*                                                                      */

/* This program is free software.  */

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

/* $Id: view_product.php,v 1.0.0.1 2012/02/18 By Mohamad Porhaji $ */

if (stristr(htmlentities($_SERVER["PHP_SELF"]), "view_product.php")) {
    Header("Location: index.php");
    die();
}



if(isset($_POST['view_product'])){
$id=$_POST['id'];

$query = $db->sql_query("SELECT * FROM fireshop_product WHERE `id`='$id'");
$row = $db->sql_fetchrow($query);
$product_title = $row['product_title'];
$product_des = $row['product_des'];
$product_pic = $row['product_pic'];
$id= $row['id'];
$product_price = $row['product_price'];
$product_price = number_format($product_price, 0);
$is_active = $row['is_active'];
$is_vip = $row['is_vip'];
$product_cat = $row['product_cat'];
$product_date = $row['product_date'];
$total_sale = $row['total_sale'];
if($is_vip>0){$is_vip="بله";}else{$is_vip="خير";}
if($is_active>0){$is_active="فعال";}else{$is_active="غير فعال";}

$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/>
<b>$product_title</b> | <a target='_blank' href='product.php?id=$id'>لينك مستقيم</a> <br/><br/>
قيمت : $product_price تومان <br/>
تاريخ ارسال : $product_date  | وضعيت : $is_active | ويژه : $is_vip<br/>
تعداد فروش : $total_sale  | دسته بندي : $cat_title <br/><br/><br/>

</td>
</tr>
</table>
<br/>
</div>
<div dir='rtl' align='right' style='padding:10px;'>
$product_des</div>
<br/><br/>
<div style='padding:10px;'>
<form style='float:left;' action=\"admin.php?do=del_product\" method=\"post\">
<input  type='hidden' size='10' name='id'  value='$id'/>
<input  type='submit' name='del_product' value='حذف'/></form>
<form style='float:left;' action=\"admin.php?do=product\" method=\"post\">
<input  type='hidden' size='10' name='id'  value='$id'/>
<input  type='submit' name='edit_product' value='ويرايش'/></form>
<form style='float:left;' method=\"post\">
<input  type='hidden' size='10' name='id'  value='$id'/>
<input  type='submit' onclick='javascript:history.go(-1)'  value='بازگشت'/></form>
<div class=\"clear\"></div></div>

";

}else{echo"ورودي نامعتبر است";}
?>