<?php

/* FIRESHOP: Advanced Content Market System                         */

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

/*                                                                      */

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

/* http://Firedesign.ir                                                   */

/*                                                                      */

/* This program is free software.  */

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

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

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


if(isset($_POST['edit_paydway_res'])){
$id=$_POST['id'];
$title=$_POST['title'];
$des=$_POST['des'];
$is_active=$_POST['is_active'];
$query = $db->sql_query("UPDATE `fireshop_payway` SET `title`='$title',`des`='$des', `is_active`='$is_active'  WHERE id='$id' LIMIT 1");if($query){print('<div class="contact_active"> با موفقيت ويرايش گرديد<br/></div>');
}else{print('<div class="failed"><div class="MsgBody">خطا<br/><button onclick="javascript:history.go(-1)" class="button">بازگشت</button></div></div>');}
}
if(isset($_POST['edit_payway'])){
$id=$_POST['id'];
$sql = $db->sql_query("SELECT * FROM fireshop_payway WHERE id='$id'");
$row = $db->sql_fetchrow($sql);
$id = $row['id'];
$title = $row['title'];
$is_active= $row['is_active'];
$des=$row['des'];

echo"
<div align='right' style='padding:10px' dir='rtl'>
<form action='admin.php?do=payway' method='POST'>
<div style='float:right;width:80px' for=\"name\">عنوان : <span style='color: red'>*</span></div>
<div style='float:right;'><input type='text' name=\"title\" size='50' style='height: 20px' value='$title' /></div><div class='clear'></div><br/>

<div style='float:right;width:80px' for=\"name\">توضيحات : <span style='color: red'>*</span></div>
<div style='float:right;'><textarea name=\"des\" size='30' style='width:350px;height: 80px'>$des</textarea></div><div class='clear'></div><br/>

وضعيت  : <span style='color: red'>*</span> فعال <input type='radio' name='is_active' checked='checked' value='1'/> غيرفعال <input type='radio' name='is_active' value='0'/><br/><br/>
<div style='margin-right:300px'>
<input  type='hidden' size='10' name='id'  value='$id'/>
<input  type='submit' name='edit_paydway_res' value='ويرايش' />
<button onclick='javascript:history.go(-1)' class='button'>بازگشت</button>

</div><br/>
</form>
</div>
</div>";


}else{

echo"<div align='center' dir='rtl' style='padding:10px'>
<table style='background-color: #333333; font-family: tahoma; font-size: 11px; text-decoration: none; color: #CCCCCC'>
<tr>
<td style='width: 460px; border-left-style: solid; border-left-width: 1px; border-left-color: #CCCCCC;'>
نحوه پرداخت</td>
<td style='width: 50px; border-left-style: solid; border-left-width: 1px; border-left-color: #CCCCCC;'>
وضعيت</td>
<td style='width: 130px;'>

اختيارات</td>

</tr>
</table>";

$sql = $db->sql_query("SELECT * FROM fireshop_payway ORDER BY  `id` DESC");
while ($row = $db->sql_fetchrow($sql)) {
$id = $row['id'];
$title = $row['title'];
$is_active= $row['is_active'];
$des=$row['des'];
if($is_active==1){$is_active="فعال";}else{$is_active="غيرفعال";}

echo"
<table style='background-color: #CCCCCC; font-family: tahoma; font-size: 11px; text-decoration: none; color: #333333'>
<tr>
<td style='width: 460px; border-left-style: solid; border-left-width: 1px; border-left-color: #ffffff;border-top-style: solid; border-top-width: 1px; border-top-color: #ffffff;'>
 $title
<br/>
توضيحات : $des
</td>
<td style='width: 50px; border-left-style: solid; border-left-width: 1px; border-left-color: #ffffff;border-top-style: solid; border-top-width: 1px; border-top-color: #ffffff;'>
$is_active</td>
<td style='width: 130px; border-top-style: solid; border-top-width: 1px; border-top-color: #ffffff;'>
<div style='float:right;'><form action='admin.php?do=payway' method='post'>
<input  type='hidden' size='10' name='id'  value='$id'/>
<input  type='submit' name='edit_payway' value='ويرايش'/></form></div>
<div style='float:right;'><form style='float:right;' action='admin.php?do=del_payway' method='post'>
<input  type='hidden' size='10' name='id'  value='$id'/>
<input  type='submit' name='del_payway' value='حذف'/></form></div>
<div class=\"clear\"></div>
</td>
</tr>
</table>
";
}
echo"</div>";
}
?>