<?php

/* FIRESHOP: Advanced Content Market System                         */

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

/*                                                                      */

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

/* http://Firedesign.ir                                                   */

/*                                                                      */

/* This program is free software.  */

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

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


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

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

$query = $db->sql_fetchrow($query);
$title =   $query['title'];
$id = $query['id'];
$des = $query['des'];
$date = $query['date'];

}
}



$title_page_over="$title";
$page_title ="$title  | اخبار فروشگاه";

function content()

{

if(!isset($_GET['id']) or !is_numeric(@$_GET['id'])){
global $db;
echo"<div class=\"content_mini\">";
$query = $db->sql_query("SELECT * FROM fireshop_news ORDER BY `time_stamp` DESC ");
while ($row = $db->sql_fetchrow($query)) {
$date = $row['date'];
$title = $row['title'];
$des = $row['des'];
$total_view= $row['total_view'];
$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"</div>";

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

$query = $db->sql_fetchrow($query);
$title =   $query['title'];
$id = $query['id'];
$des = $query['des'];
$date = $query['date'];

$total_view =$query['total_view'];
$db->sql_query("UPDATE `fireshop_news` SET total_view=total_view+1  WHERE id='$id'");


echo"
<div align='right' class=\"content_mini\">
<img src=\"template/fireshop_default/images/arrow000.gif\"/>&nbsp;[$date]  |  بازديد : $total_view
<br/><br/>
 <b>$title </b>:
<br/><br/>
$des
</div>
</br/>
<div class='clear'></div>
</br/><br/>
";
?>

<div align='right'>  &nbsp;&nbsp;
اخبار | News
</div>
<br/>

<div dir='rtl'>


<?php
echo"<div class=\"content_mini\">";
$query = $db->sql_query("SELECT * FROM fireshop_news ORDER BY `time_stamp` DESC Limit 0,6");
while ($row = $db->sql_fetchrow($query)) {
$date = $row['date'];
$title = $row['title'];
$des = $row['des'];
$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"</div>";
?>
</div>





<br/>


<?php



}

}



}
theme();
?>