<?php

/* FIRESHOP: Advanced Content Market System                         */
/* ============================================                         */
/*                                                                      */
/* Copyright (c) 2012 by Mohamad Porhaji                                */
/* http://Firedesign.ir                                                   */
/*                                                                      */
/* This program is free software.  */
/************************************************************************/
/* $Id: content_page.php,v 1.0.0.1 2012/02/18 By Mohamad Porhaji $ */

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




function themecontent() {
  global $db,$title_page_over,$pro_limit,$az;


echo"<div class=\"main_warp\">
<table>
<tr align=\"center\">
<td width=\"270\" valign=\"top\">
<div class=\"mini_slider\">
<div class=\"mini_slider_top\">&nbsp;&nbsp;&nbsp;اخبار فروشگاه</div>
<div class=\"mini_slider_bg\">
<div class=\"content_mini\">

<!-- Loop content -->";
$sql = $db->sql_query("SELECT * FROM fireshop_news ORDER BY `time_stamp` DESC Limit 10");
while ($row = $db->sql_fetchrow($sql)) {
$title = $row['title'];
$title = substr($title, 0,70);
$id= $row['id'];
echo"
<div align=\"right\" class=\"news\"><a href=\"news.php?id=$id\"><img src=\"template/fireshop_default/images/arrow000.gif\"/>&nbsp; 

$title</a></div>";}

echo"<!--  End Loop content -->


</div></div>
<div class=\"mini_slider_bt\"></div>
</div>
<br/>
<div class=\"mini_slider\">
<div class=\"mini_slider_top\">&nbsp;&nbsp;&nbsp;دسته بندي فروشگاه</div>
<div class=\"mini_slider_bg\">
<div class=\"content_mini\">";

$sql = $db->sql_query("SELECT * FROM fireshop_category where `is_active`> 0 ORDER BY `id` ASC");
while ($row = $db->sql_fetchrow($sql)) {
$title = $row['title'];
$id= $row['id'];
echo"
<div align=\"right\" class=\"news\"><a href='category.php?id=$id'><img src=\"template/fireshop_default/images/news-bul.jpg\"/> $title</a></div>
";
}



echo"</div></div>
<div class=\"mini_slider_bt\"></div>
</div>
<br/>
<div class=\"mini_slider\">
<div class=\"mini_slider_top\">&nbsp;&nbsp;&nbsp;محصول تصادفي</div>
<div class=\"mini_slider_bg\">
<div class=\"content_mini\">";

$numrows =  $db->sql_numrows($db->sql_query("SELECT * FROM fireshop_product WHERE `is_active` >0 "));
mt_srand((double)microtime()*1000000);
$id_product = mt_rand(1,$numrows);

$sql = $db->sql_query("SELECT * FROM fireshop_product where `id`='$id_product'");
if($db->sql_numrows($sql)<1){$sql = $db->sql_query("SELECT * FROM fireshop_product where `id`='1'");}else{$sql = $db->sql_query("SELECT * FROM fireshop_product where `id`='$id_product'");}


$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 align=\"center\">
<img src=\"$product_pic\" height=\"110\" 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>";




echo"</div></div>
<div class=\"mini_slider_bt\"></div>
</div>
<br/>
<div class=\"mini_slider\">
<div class=\"mini_slider_top\">&nbsp;&nbsp;&nbsp;آمار فروشگاه</div>
<div class=\"mini_slider_bg\">
<div class=\"content_mini\">

<div align=\"right\">";
$sql = $db->sql_query("SELECT * FROM fireshop_counter where id=1;");
$row = $db->sql_fetchrow($sql);
$todaycounts  = number_format($row['todaycounts'], 0);
$yescounts  = number_format($row['yescounts'], 0);
$total   = number_format($row['total'], 0);
$month  = number_format($row['month'], 0);
$year  = number_format($row['year'], 0);
$num_product = $db->sql_numrows($db->sql_query("SELECT * FROM fireshop_product "));
echo"
<img src=\"template/fireshop_default/images/news-bul.jpg\"/> بازديد امروز : $todaycounts<br/>
<img src=\"template/fireshop_default/images/news-bul.jpg\"/> بازديد ديروز : $yescounts <br/>
<img src=\"template/fireshop_default/images/news-bul.jpg\"/> بازديد كل : $total<br/>
<img src=\"template/fireshop_default/images/news-bul.jpg\"/> بازديد اين ماه : $month<br/>
<img src=\"template/fireshop_default/images/news-bul.jpg\"/> تعداد كل محصولات : $num_product<br/>
</div>

</div></div>
<div class=\"mini_slider_bt\"></div>
</div>
<br/>
<div class=\"mini_slider\">
<div class=\"mini_slider_top\">&nbsp;&nbsp;&nbsp;رهگيري سفارش</div>
<div class=\"mini_slider_bg\">
<div class=\"content_mini\">
<form method='POST' action='rahgiri.php' target='_blank'>
	<div style='margin-bottom:5px;'>برای رهگیری کلیک کنید :</div>
	<div style='margin:10px auto'><input type='submit' value='رهگیری سفارش' name='B4' style='-moz-border-radius:5px;background:#fff;border:1px solid #DFDBD0;font: normal 1.0em/1.6 tahoma;height:30px;color:#cc0000'></div>
</form>

</div></div>
<div class=\"mini_slider_bt\"></div>
</div>



</td>
<td width=\"690\" valign=\"top\">";


content();

$sql = $db->sql_query("SELECT * FROM fireshop_product  ORDER BY `product_time_stamp` DESC LIMIT $az,$pro_limit");
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=\"110\" 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>
";
}


pagination_page();

echo"</td>
</tr>
</table>


</div>\n";







}
?>