<? include('checkcookie.php'); ?>
<?
if (isset($_POST["wmdyn"]))
{
	$wmdyn=$_POST["wmdyn"];
	$wmhldyn=$_POST["wmhldyn"];
	$wmstatlink=$_POST["wmstatlink"];
	$statlink=$_POST["statlink"];
	$wmbanner=$_POST["wmbanner"];
	$wmbannerclick=$_POST["wmbannerclick"];
	$wm1banner=$_POST["wm1banner"];
        $wmbanner200=$_POST["wmbanner200"];
	$timer5=$_POST["timer5"];
	$wmfa=$_POST["wmframe"];
	$ta=$_POST["ta"];
	$dopsec=$_POST["dopsec"];
	$lb=$_POST["leftblock"];
	$vip=$_POST["vip"];
	$vipcount=$_POST["vipcount"];
	$cha=$_POST["wmchat"];
	$captcha=$_POST["captcha"];
	$cat=$_POST["cat"];
        $questions=$_POST['questions'];
	$dyn=$_POST["dyn"];
	$hldyn=$_POST["hldyn"];
	$statlink=$_POST["statlink"];
        $ban=$_POST["banner"];
        $ban100=$_POST["banner100"];
	$ab=$_POST["adblock"];
        $chain=$_POST["chain"];
	$fa=$_POST["frame"];
        $down=$_POST['down'];
        $psevdoweek1=$_POST["psevdoweek1"]; 
	$actwin=$_POST["actwin"];
	$cvetstat=$_POST["cvetstat"];
	mysql_query("update tb_config set price='$wmdyn' where item='hits'");
	mysql_query("update tb_config set price='$wmhldyn' where item='hldyn'");
	mysql_query("update tb_config set price='$dopsec' where item='dopsec'");
	mysql_query("update tb_config set price='$captcha' where item='captcha'");
	mysql_query("update tb_config set price='$timer5' where item='timer5'");
        mysql_query("update tb_config set price='$wmbanner' where item='advbanner'"); 
        mysql_query("update tb_config set price='$wmbannerclick' where item='advbannerclick'"); 
        mysql_query("update tb_config set price='$wmbanner200' where item='advbanner200'"); 
        mysql_query("update tb_config set price='$wm1banner' where item='banner'");
	mysql_query("update tb_config set price='$vip' where item='vipblock'");
	mysql_query("update tb_config set price='$vipcount' where item='vipcount'");
	mysql_query("update tb_config set price='$wmstatlink' where item='advstatlink'");
	mysql_query("update tb_config set price='$statlink' where item='adtatlink'");
	mysql_query("update tb_config set price='$lb' where item='cvet_link'");
	mysql_query("update tb_config set price='$actwin' where item='actwin'");
	mysql_query("update tb_config set price='$questions' where item='downr'");
	mysql_query("update tb_config set price='$wmfa' where item='wmframeads'");
	mysql_query("update tb_config set price='$ta' where item='textads'");
	mysql_query("update tb_config set price='$cha' where item='wmchatads'");
	mysql_query("update tb_config set price='$cat' where item='catads'");
	mysql_query("update tb_config set price='$cvetstat' where item='cvet_link_stat'");
	mysql_query("update tb_config set price='$dyn' where item='mfadyn'");
	mysql_query("update tb_config set price='$hldyn' where item='mfahldyn'");
	mysql_query("update tb_config set price='$statlink' where item='mfastatlink'");
	mysql_query("update tb_config set price='$ban' where item='mfabanner'");
        mysql_query("update tb_config1 set price='$ban100' where item='mfabanner'");
	mysql_query("update tb_config set price='$ab' where item='adblock'");
        mysql_query("update tb_config set price='$chain' where item='adchain'");
	mysql_query("update tb_config set price='$fa' where item='frameads'");
        mysql_query("update tb_config set price='$down' where item='downr'");

	mysql_query("update tb_config set price='$psevdoweek1' where item='psevdoweek1'");

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

$res=mysql_query("SELECT * FROM tb_config WHERE item='adchain'"); 
$res=mysql_fetch_array($res); 
$chain=$res["price"];

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

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

<h3>Настройки рекламы за WM</h3><br>
<table>
<tr>
<th width="200">Динамические ссылки (цена за 1 визит)</th><td><input type="text" name="wmdyn" value="<?=$dyn ?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Стоимость выделения динамической ссылки</th><td><input type="text" name="wmhldyn" value="<?=$hldyn ?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Стоимость доп. 5 секунд таймера</th><td><input type="text" name="timer5" value="<?=$timer5 ?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Доп. защита от автокликеров (подтверждение просмотра)</th><td><input type="text" name="dopsec" value="<?=$dopsec ?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Доп. защита от автокликеров (ввод каптчи)</th><td><input type="text" name="captcha" value="<?=$captcha ?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Доп. плата за размещение ссылки в VIP блоке</th><td><input type="text" name="vip" value="<?=$vip ?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Максимальное число ссылок в VIP блоке</th><td><input type="text" name="vipcount" value="<?=$vipcount ?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Доп.плата за активное окно</th><td><input type="text" name="actwin" value="<?=$actwin ?>" size="30" maxlength="30"></td></tr>
<tr> 
<th width="200">Псевдодинамические ссылки 1 день</th><td><input type="text" name="psevdoweek1" value="<?=$psevdoweek1 ?>" size="30" maxlength="30"></td></tr> 
<tr>
<th width="200">Платные скачивания(цена за 1 ответ)</th><td><input type="text" name="down" value="<?=$down ?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Платные вопросы(цена за 1 ответ)</th><td><input type="text" name="questions" value="<?=$questions ?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Статические ссылки (цена за 1 сутки)</th><td><input type="text" name="wmstatlink" value="<?=$sl ?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="400">Доплата за выделением цвета</th><td><input type="text" name="cvetstat" value="<?=$cvetstat ?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="400">Контекстная реклама (цена за 1 сутки)</th><td><input type="text" name="statlink" value="<?=$sll ?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="400">Доплата за выделением цвета</th><td><input type="text" name="leftblock" value="<?=$lb ?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Баннеры 468 на 60 </th><td><input type="text" name="wmbanner" value="<?=$ban ?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Баннеры 468 на 60 кликовые (цена за 1 клик) </th><td><input type="text" name="wmbannerclick" value="<?=$banclick ?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Баннеры 200 на 300 </th><td><input type="text" name="wmbanner200" value="<?=$ban200 ?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Баннеры 100 на 100</th><td><input type="text" name="wm1banner" value="<?=$ban1 ?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Ссылка в блоке "Платная реклама"</th><td><input type="text" name="adblock" value="<?=$ab ?>" size="30" maxlength="30"></td></tr> 
<tr>
<th width="200">Текстовое объявление (цена за 1 сутки)</th><td><input type="text" name="ta" value="<?=$ta ?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Реклама во фрейме (цена за 1 сутки)</th><td><input type="text" name="wmframe" value="<?=$wmfa ?>" size="30" maxlength="30"></td></tr>
</table>
<br><br>

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

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

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

$sql="select price from tb_config1 where item='mfabanner'";
$res=mysql_query($sql);
$ban100=mysql_result($res,0,0);

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

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

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

<h3>Настройки рекламы с внутреннего счета</h3><br>
<table>
<tr>
<th width="200">Динамические ссылки (цена за 1 визит)</th><td><input type="text" name="dyn" value="<?=$dyn ?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">Стоимость выделения динамической ссылки</th><td><input type="text" name="hldyn" value="<?=$hldyn ?>" size="30" maxlength="30"></td></tr>
</table>

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