<?php

/* FIRESHOP: Advanced Content Market System                         */

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

/*                                                                      */

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

/* http://Firedesign.ir                                                   */

/*                                                                      */

/* This program is free software.  */

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

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

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


if(isset($_POST['contact_del']))
{define('ADMIN_FILE_DEL', true);
$id=$_POST['id'];
$datasql = $db->sql_query("SELECT * FROM fireshop_contact where `id`='$id' Limit 1");
$mydata = $db->sql_fetchrow($datasql); $contact_id = $mydata['id'];$contact_title = $mydata['title'];
echo"<div align=\"center\">
آيا از حذف اين تماس ($contact_title) مطمئن هستيد؟
<br/><br/>
<form action=\"admin.php?do=delete_contact\" method=\"post\">
<input  type='hidden' size='50' name='id'  value='$id'/>
<input  type='submit' name='contact_delete' value='بله'/> | 
<input  type='submit' name='' onclick='javascript:history.go(-1)' value='خير'/>
</form></div>";
}else{
echo"<table dir=\"rtl\" style=\"width: 670px;border: 1px solid #C0C0C0\"><tr>
<td style=\"width: 48px; border-left-style: solid; border-left-width: 1px; border-left-color: #C0C0C0;\">آيدي</td>
<td style=\"width: 480px; border-left-style: solid; border-left-width: 1px; border-left-color: #C0C0C0;\">عنوان</td>
<td style=\"width: 206px\">اختيارات</td></tr>";
$datasql = $db->sql_query("SELECT * FROM fireshop_contact where `is_read` > 0 ORDER BY `time_stamp` DESC");
while ($mydata = $db->sql_fetchrow($datasql)) {$contact_name  	= $mydata['name'];$contact_email  	= $mydata['email'];$contact_des  	= $mydata['des'];$contact_date 	= $mydata['date'];$contact_ip	= $mydata['ip'];$contact_tel	= $mydata['tel'];$contact_id 	= $mydata['id'];$contact_read	 =  $mydata['is_read'];$contact_javab 	= $mydata['javab'];$contact_title 	= $mydata['title'];
if($contact_tel==NULL){$contact_tel="ندارد";}else{$contact_tel= $mydata['tel'];}
echo"<tr>
<td style=\"width: 48px; border-left-style: solid; border-left-width: 1px; border-left-color: #C0C0C0;border-top-style: solid; border-top-width: 1px; border-top-color: #C0C0C0;\">$contact_id</td>
<td style=\"width: 405px; border-left-style: solid; border-left-width: 1px; border-left-color: #C0C0C0;border-top-style: solid; border-top-width: 1px; border-top-color: #C0C0C0;\">$contact_title</td>
<td style=\"width: 226px;border-top-style: solid; border-top-width: 1px; border-top-color: #C0C0C0;\">
<form style='float:right;' action=\"admin.php?do=new_contact\" method=\"post\">
<input  type='hidden' size='10' name='id'  value='$contact_id'/>
<input  type='submit' name='contact_del' value='حذف'/></form>
<form style='float:right;' action=\"admin.php?do=view_contact\" method=\"post\">
<input  type='hidden' size='10' name='id'  value='$contact_id'/>
<input  type='submit' name='contact_view' value='مشاهده'/></form>
<form style='float:right;' action=\"admin.php?do=contact_send_j\" method=\"post\">
<input  type='hidden' size='10' name='id'  value='$contact_id'/>
<input  type='submit' name='contact_send_j' value='ارسال پاسخ'/></form><div class=\"clear\"></div>
</td></tr>";}echo"</table>";}
?>