<?php

/* FIRESHOP: Advanced Content Market System                         */

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

/*                                                                      */

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

/* http://Firedesign.ir                                                   */

/*                                                                      */

/* This program is free software.  */

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

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

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


if(isset($_POST['contact_send_j'])){
$id=$_POST['id'];$read = "0";
$query = $db->sql_query("UPDATE fireshop_contact SET `is_read`='$read'  WHERE `id`='$id' LIMIT 1");
$datasql = $db->sql_query("SELECT * FROM fireshop_contact where `id`='$id'");
$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_javab 	= $mydata['javab'];$contact_title 	= $mydata['title'];$contact_date_j 	= $mydata['date_j'];
if($contact_tel==NULL){$contact_tel="ندارد";
}else{$contact_tel= $mydata['tel'];}
if($contact_javab==NULL){
$contact_javab_check="پاسخ داده نشده";
$contact_javab_huke="پاسخ داده نشده";}else{
$contact_javab_check="پاسخ داده شده";
$contact_javab_huke= $mydata['javab'];}
echo"
<div dir='rtl' align='right' style='padding:10px;'>
وضعيت : خوانده شده | $contact_javab_check &nbsp;|&nbsp; نام فرستنده : $contact_name &nbsp;|&nbsp;
تاريخ ارسال : $contact_date  <br/><br/>
متن :  $contact_des  <br/><br/>
ايميل فرستنده :$contact_email  &nbsp;|&nbsp;
شماره تماس فرستنده : $contact_tel &nbsp;|&nbsp;
آي پي فرستنده : $contact_ip 
<br/><h2></h2>
پاسخ شما : $contact_javab_huke | $contact_date_j</div><br/>";
echo"


<div style='padding:10px'  align='center' >
<form action='admin.php?do=contact_send_j' method='post'>
<input  type='hidden' size='50' name='id'  value='$id'/><br/>";

wysiwyg_textarea('javab', "$contact_javab", 'FireShopAdmin', 50, 15);

echo"<br /><br />
<input  type='submit' name='contact_send_j_ok' value='ارسال جواب'/>&nbsp;&nbsp;&nbsp;
<button onclick='javascript:history.go(-1)' class='button'>بازگشت</button>&nbsp;&nbsp;&nbsp;
</form></div>



";}
if(isset($_POST['contact_send_j_ok'])){
$id=$_POST['id'];
$javab=$_POST['javab'];
include("includes/jdate.php");
$today = jdate(" d /m /13y");
$dater = $today;
$query = $db->sql_query("UPDATE fireshop_contact SET `javab`='$javab',`date_j`='$dater'  WHERE id='$id' LIMIT 1");
if($query){
print('<div class="contact_active"> جواب با موفقيت ارسال گرديد</div>');
}else{print('<div class="failed"><div class="MsgBody">خطا</div></div>');}}

?>