<? include('checkcookie.php'); ?>
<?
if (isset($_POST["mail_p"]))
{
	$mail_p=$_POST["mail_p"];
	$mail_min=$_POST["mail_min"];
	$mail_25=$_POST["mail_25"];
	$mail_30=$_POST["mail_30"];
	$mail_35=$_POST["mail_35"];
	$mail_40=$_POST["mail_40"];
	$mail_pod=$_POST["mail_pod"];
	$mail_all=$_POST["mail_all"];
	$mail_clic=$_POST["mail_clic"];
	$mail_refclic=$_POST["mail_refclic"];

	mysql_query("update tb_config set price='$mail_p' where item='mail_p'");
	mysql_query("update tb_config set price='$mail_min' where item='mail_min'");
	mysql_query("update tb_config set price='$mail_25' where item='mail_25'");
	mysql_query("update tb_config set price='$mail_30' where item='mail_30'");
	mysql_query("update tb_config set price='$mail_35' where item='mail_35'");
    mysql_query("update tb_config set price='$mail_40' where item='mail_40'");
    mysql_query("update tb_config set price='$mail_pod' where item='mail_pod'");
	mysql_query("update tb_config set price='$mail_all' where item='mail_all'");
	mysql_query("update tb_config set price='$mail_clic' where item='mail_clic'");
	mysql_query("update tb_config set price='$mail_refclic' where item='mail_refclic'");

	echo "<br><br><font color=\"green\"><b>Настройки сохранены</b></font><br><br>";
}
?>

<form method="post" action="adminmain.php?p=messcfg">

<?
$sql="select price from tb_config where item='mail_p'";
$res=mysql_query($sql);
$mail_p=mysql_result($res,0,0);


$sql="select price from tb_config where item='mail_min'";
$res=mysql_query($sql);
$mail_min=mysql_result($res,0,0);

$sql="select price from tb_config where item='mail_25'";
$res=mysql_query($sql);
$mail_25=mysql_result($res,0,0);

$sql="select price from tb_config where item='mail_30'";
$res=mysql_query($sql);
$mail_30=mysql_result($res,0,0);

$sql="select price from tb_config where item='mail_35'";
$res=mysql_query($sql);
$mail_35=mysql_result($res,0,0);

$sql="select price from tb_config where item='mail_40'";
$res=mysql_query($sql);
$mail_40=mysql_result($res,0,0);

$sql="select price from tb_config where item='mail_pod'";
$res=mysql_query($sql);
$mail_pod=mysql_result($res,0,0);

$sql="select price from tb_config where item='mail_all'";
$res=mysql_query($sql);
$mail_all=mysql_result($res,0,0);
?>

<h3>Настройки цен на заказ писем</h3>
<table>
<tr>
<th width="200">Стоимость одного письма</th><td><input type="text" name="mail_p" value="<?=$mail_p?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Минимум для заказа</th><td><input type="text" name="mail_min" value="<?=$mail_min?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Таймер 25 сек.</th><td><input type="text" name="mail_25" value="<?=$mail_25?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Таймер 30 сек.</th><td><input type="text" name="mail_30" value="<?=$mail_30?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Таймер 35 сек.</th><td><input type="text" name="mail_35" value="<?=$mail_35?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Таймер 40 сек.</th><td><input type="text" name="mail_40" value="<?=$mail_40?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Цена за подтверждение</th><td><input type="text" name="mail_pod" value="<?=$mail_pod?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Рассылка для всех</th><td><input type="text" name="mail_all" value="<?=$mail_all?>" size="30" maxlength="30"></td></tr>
</table>

<?
$sql="select price from tb_config where item='mail_clic'";
$res=mysql_query($sql);
$mail_clic=mysql_result($res,0,0);

$sql="select price from tb_config where item='mail_refclic'";
$res=mysql_query($sql);
$mail_refclic=mysql_result($res,0,0);
?>

<h3>Настройки оплаты за просмотр</h3>
<table>
<tr>
<th width="200">Цена за клик</th><td><input type="text" name="mail_clic" value="<?=$mail_clic?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Цена за реф клик</th><td><input type="text" name="mail_refclic" value="<?=$mail_refclic?>" size="30" maxlength="30"></td></tr>
</table>

<center><input type="submit" value="Сохранить изменения" class="button"></center>
</form>