<? include('checkcookie.php'); ?>
<?
if (isset($_POST["wmdyn"]))
{
	$wmdyn=$_POST["wmdyn"];
	$wmhldyn=$_POST["wmhldyn"];
	$wmstatlink=$_POST["wmstatlink"];
	$wmbanner=$_POST["wmbanner"];
	$banner=$_POST["banner"];
	$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"];
	$dyn=$_POST["dyn"];
	$hldyn=$_POST["hldyn"];
	$statlink=$_POST["statlink"];
	$ab=$_POST["adblock"];
        $chain=$_POST["chain"];
	$fa=$_POST["frame"];
        $psevdoweek1=$_POST["psevdoweek1"]; 
        $psevdoweek2=$_POST["psevdoweek2"]; 
        $psevdoweek3=$_POST["psevdoweek3"]; 
        $psevdoweek4=$_POST["psevdoweek4"];
	$actwin=$_POST["actwin"];

	mysql_query("update tb_config1 set price='$wmdyn' where item='hits'");
	mysql_query("update tb_config1 set price='$wmhldyn' where item='hldyn'");
	mysql_query("update tb_config1 set price='$dopsec' where item='dopsec'");
	mysql_query("update tb_config1 set price='$captcha' where item='captcha'");
	mysql_query("update tb_config1 set price='$timer5' where item='timer5'");
	mysql_query("update tb_config1 set price='$vip' where item='vipblock'");
	mysql_query("update tb_config1 set price='$vipcount' where item='vipcount'");
	mysql_query("update tb_config1 set price='$wmstatlink' where item='advstatlink'");
	mysql_query("update tb_config1 set price='$lb' where item='leftblock'");
	mysql_query("update tb_config1 set price='$actwin' where item='actwin'");
	
	mysql_query("update tb_config1 set price='$wmfa' where item='wmframeads'");
	mysql_query("update tb_config1 set price='$ta' where item='textads'");
	mysql_query("update tb_config1 set price='$cha' where item='wmchatads'");
	mysql_query("update tb_config1 set price='$cat' where item='catads'");

	mysql_query("update tb_config1 set price='$dyn' where item='mfadyn'");
	mysql_query("update tb_config1 set price='$hldyn' where item='mfahldyn'");
	mysql_query("update tb_config1 set price='$statlink' where item='mfastatlink'");
	mysql_query("update tb_config1 set price='$banner' where item='mfabanner'");
        mysql_query("update tb_config1 set price='$banner' where item='banner'");
	mysql_query("update tb_config1 set price='$ab' where item='adblock'");
        mysql_query("update tb_config1 set price='$chain' where item='adchain'");
	mysql_query("update tb_config1 set price='$fa' where item='frameads'");

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

$sql="select price from tb_config1 where item='psevdoweek4'"; 
$res=mysql_query($sql); 
$psevdoweek4=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">Доп. защита от автокликеров (ввод каптчи)</th><td><input type="text" name="captcha" value="<?=$captcha ?>" 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">Максимальное число ссылок в МИНИ блоке</th><td><input type="text" name="vipcount" value="<?=$vipcount ?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">ТУТ ДОЛЖЕН БЫТЬ 0</th><td><input type="text" name="timer5" value="<?=$timer5 ?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">ТУТ ДОЛЖЕН БЫТЬ 0</th><td><input type="text" name="dopsec" value="<?=$dopsec ?>" size="30" maxlength="30"></td></tr>
<tr>
<th width="200">ТУТ ДОЛЖЕН БЫТЬ 0</th><td><input type="text" name="vip" value="<?=$vip ?>" size="30" maxlength="30"></td></tr>
<tr>
</table>
<br><br>

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

$sql="select price from tb_config1 where item='mfahldyn'";
$res=mysql_query($sql);
$hldyn=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>