<? include('checkcookie.php'); ?>
<b>Настройки Авто-Серфинга</b>
<br><br>
<?php
include('config.php');
if(count($_POST)>0) {
	$tarifs_100 = floatval($_POST["tarifs100"]);
	$tarifs_300 = floatval($_POST["tarifs300"]);
	$tarifs_500 = floatval($_POST["tarifs500"]);
	$tarifs_700 = floatval($_POST["tarifs700"]);
	$tarifs_1000 = floatval($_POST["tarifs1000"]);
	$tarifs_2000 = floatval($_POST["tarifs2000"]);
	$tarifs_3000 = floatval($_POST["tarifs3000"]);
	$tarifs_4000 = floatval($_POST["tarifs4000"]);
	$tarifs_5000 = floatval($_POST["tarifs5000"]);
	$tarifs_10000 = floatval($_POST["tarifs10000"]);
	$tarifs_20000 = floatval($_POST["tarifs20000"]);
	$tarifs_30000 = floatval($_POST["tarifs30000"]);

	$auto_click = floatval($_POST["auto_click"]);
	$auto_timer_ot = intval($_POST["auto_timer_ot"]);
	$auto_timer_do = intval($_POST["auto_timer_do"]);
	$auto_timer_cena = floatval($_POST["auto_timer_cena"]);
	$auto_timer_us = floatval($_POST["auto_timer_us"]);
	$limit_min = intval($_POST["limit_min"]);

	mysql_query("UPDATE tb_config SET price='$tarifs_100' WHERE item='tarifs_auto' AND howmany='100'") or die(mysql_error());
	mysql_query("UPDATE tb_config SET price='$tarifs_300' WHERE item='tarifs_auto' AND howmany='300'") or die(mysql_error());
	mysql_query("UPDATE tb_config SET price='$tarifs_500' WHERE item='tarifs_auto' AND howmany='500'") or die(mysql_error());
	mysql_query("UPDATE tb_config SET price='$tarifs_700' WHERE item='tarifs_auto' AND howmany='700'") or die(mysql_error());
	mysql_query("UPDATE tb_config SET price='$tarifs_1000' WHERE item='tarifs_auto' AND howmany='1000'") or die(mysql_error());
	mysql_query("UPDATE tb_config SET price='$tarifs_2000' WHERE item='tarifs_auto' AND howmany='2000'") or die(mysql_error());
	mysql_query("UPDATE tb_config SET price='$tarifs_3000' WHERE item='tarifs_auto' AND howmany='3000'") or die(mysql_error());
	mysql_query("UPDATE tb_config SET price='$tarifs_4000' WHERE item='tarifs_auto' AND howmany='4000'") or die(mysql_error());
	mysql_query("UPDATE tb_config SET price='$tarifs_5000' WHERE item='tarifs_auto' AND howmany='5000'") or die(mysql_error());
	mysql_query("UPDATE tb_config SET price='$tarifs_10000' WHERE item='tarifs_auto' AND howmany='10000'") or die(mysql_error());
	mysql_query("UPDATE tb_config SET price='$tarifs_20000' WHERE item='tarifs_auto' AND howmany='20000'") or die(mysql_error());
	mysql_query("UPDATE tb_config SET price='$tarifs_30000' WHERE item='tarifs_auto' AND howmany='30000'") or die(mysql_error());

	mysql_query("UPDATE tb_config SET price='$auto_click' WHERE item='auto_click' AND howmany='1'") or die(mysql_error());
	mysql_query("UPDATE tb_config SET price='$auto_timer_ot' WHERE item='auto_timer_ot' AND howmany='1'") or die(mysql_error());
	mysql_query("UPDATE tb_config SET price='$auto_timer_do' WHERE item='auto_timer_do' AND howmany='1'") or die(mysql_error());
	mysql_query("UPDATE tb_config SET price='$auto_timer_cena' WHERE item='auto_timer_cena' AND howmany='1'") or die(mysql_error());
	mysql_query("UPDATE tb_config SET price='$auto_timer_us' WHERE item='auto_timer_us ' AND howmany='1'") or die(mysql_error());
	mysql_query("UPDATE tb_config SET price='$limit_min' WHERE item='limit_min' AND howmany='1'") or die(mysql_error());

	echo '<font color="green"><b>Настройки успешно сохранены.</b></font><br />';
}
?>
<form method="post" action="">
<b>Настройки стоимости рекламы в автосерфинге</b>
<table>
<tr><th width="320" align="left">Цена за 100 кликов:</th><td align="left"><input type="text" size="10" name="tarifs100" value="<?php $sql=mysql_query("SELECT price FROM tb_config WHERE item='tarifs_auto' AND howmany='100'"); echo mysql_result($sql,0,0);?>" style="text-align:right;"> руб.</td></tr>
<tr><th width="320" align="left">Цена за 300 кликов:</th><td align="left"><input type="text" size="10" name="tarifs300" value="<?php $sql=mysql_query("SELECT price FROM tb_config WHERE item='tarifs_auto' AND howmany='300'"); echo mysql_result($sql,0,0);?>" style="text-align:right;"> руб.</td></tr>
<tr><th width="320" align="left">Цена за 500 кликов:</th><td align="left"><input type="text" size="10" name="tarifs500" value="<?php $sql=mysql_query("SELECT price FROM tb_config WHERE item='tarifs_auto' AND howmany='500'"); echo mysql_result($sql,0,0);?>" style="text-align:right;"> руб.</td></tr>
<tr><th width="320" align="left">Цена за 700 кликов:</th><td align="left"><input type="text" size="10" name="tarifs700" value="<?php $sql=mysql_query("SELECT price FROM tb_config WHERE item='tarifs_auto' AND howmany='700'"); echo mysql_result($sql,0,0);?>" style="text-align:right;"> руб.</td></tr>
<tr><th width="320" align="left">Цена за 1000 кликов:</th><td align="left"><input type="text" size="10" name="tarifs1000" value="<?php $sql=mysql_query("SELECT price FROM tb_config WHERE item='tarifs_auto' AND howmany='1000'"); echo mysql_result($sql,0,0);?>" style="text-align:right;"> руб.</td></tr>
<tr><th width="320" align="left">Цена за 2000 кликов:</th><td align="left"><input type="text" size="10" name="tarifs2000" value="<?php $sql=mysql_query("SELECT price FROM tb_config WHERE item='tarifs_auto' AND howmany='2000'"); echo mysql_result($sql,0,0);?>" style="text-align:right;"> руб.</td></tr>
<tr><th width="320" align="left">Цена за 3000 кликов:</th><td align="left"><input type="text" size="10" name="tarifs3000" value="<?php $sql=mysql_query("SELECT price FROM tb_config WHERE item='tarifs_auto' AND howmany='3000'"); echo mysql_result($sql,0,0);?>" style="text-align:right;"> руб.</td></tr>
<tr><th width="320" align="left">Цена за 4000 кликов:</th><td align="left"><input type="text" size="10" name="tarifs4000" value="<?php $sql=mysql_query("SELECT price FROM tb_config WHERE item='tarifs_auto' AND howmany='4000'"); echo mysql_result($sql,0,0);?>" style="text-align:right;"> руб.</td></tr>
<tr><th width="320" align="left">Цена за 5000 кликов:</th><td align="left"><input type="text" size="10" name="tarifs5000" value="<?php $sql=mysql_query("SELECT price FROM tb_config WHERE item='tarifs_auto' AND howmany='5000'"); echo mysql_result($sql,0,0);?>" style="text-align:right;"> руб.</td></tr>
<tr><th width="320" align="left">Цена за 10000 кликов:</th><td align="left"><input type="text" size="10" name="tarifs10000" value="<?php $sql=mysql_query("SELECT price FROM tb_config WHERE item='tarifs_auto' AND howmany='10000'"); echo mysql_result($sql,0,0);?>" style="text-align:right;"> руб.</td></tr>
<tr><th width="320" align="left">Цена за 20000 кликов:</th><td align="left"><input type="text" size="10" name="tarifs20000" value="<?php $sql=mysql_query("SELECT price FROM tb_config WHERE item='tarifs_auto' AND howmany='20000'"); echo mysql_result($sql,0,0);?>" style="text-align:right;"> руб.</td></tr>
<tr><th width="320" align="left">Цена за 30000 кликов:</th><td align="left"><input type="text" size="10" name="tarifs30000" value="<?php $sql=mysql_query("SELECT price FROM tb_config WHERE item='tarifs_auto' AND howmany='30000'"); echo mysql_result($sql,0,0);?>" style="text-align:right;"> руб.</td></tr>
</table>
<b>Дополнительные настройки</b>
<table>
<tr><th width="320" align="left">Оплата пользователю за просмотр ссылки:</th><td align="left"><input type="text" size="10" name="auto_click" value="<?php $sql=mysql_query("SELECT price FROM tb_config WHERE item='auto_click' AND howmany='1'"); echo mysql_result($sql,0,0);?>" style="text-align:right;"> руб.</td></tr>
<tr><th width="320" align="left">Таймер:</th><td align="left">от <input type="text" size="4" name="auto_timer_ot" value="<?php $sql=mysql_query("SELECT price FROM tb_config WHERE item='auto_timer_ot' AND howmany='1'"); echo mysql_result($sql,0,0);?>" style="text-align:right;"> до <input type="text" size="4" name="auto_timer_do" value="<?php $sql=mysql_query("SELECT price FROM tb_config WHERE item='auto_timer_do' AND howmany='1'"); echo mysql_result($sql,0,0);?>" style="text-align:right;"> сек.</td></tr>
<tr><th width="320" align="left">Доплата за таймер, за 1 секунду:</th><td align="left"><input type="text" size="10" name="auto_timer_cena" value="<?php $sql=mysql_query("SELECT price FROM tb_config WHERE item='auto_timer_cena' AND howmany='1'"); echo mysql_result($sql,0,0);?>" style="text-align:right;"> руб.</td></tr>
<tr><th width="320" align="left">Доплата пользователю за таймер, за 1 секунду:</th><td align="left"><input type="text" size="10" name="auto_timer_us" value="<?php $sql=mysql_query("SELECT price FROM tb_config WHERE item='auto_timer_us' AND howmany='1'"); echo mysql_result($sql,0,0);?>" style="text-align:right;"> руб.</td></tr>
<tr><th width="320" align="left">Ограничение показов (минимум в сутки):</th><td align="left"><input type="text" size="10" name="limit_min" value="<?php $sql=mysql_query("SELECT price FROM tb_config WHERE item='limit_min' AND howmany='1'"); echo mysql_result($sql,0,0);?>" style="text-align:right;"></td></tr>
<tr><td align="right" colspan="2"><br><br><input type="submit" value="Сохранить изменения"></td></tr>
</table><br />
</form>