<?
if (isset($_POST["click"]))
{


$sitename=$_POST["sitename"];
$sitepp=$_POST["sitepp"];
$WMZ=$_POST["WMZ"];
$WMR=$_POST["WMR"];
$click=$_POST["click"];
$referalclick=$_POST["referalclick"];
$payment=$_POST["payment"];
$premiumclick=$_POST["premiumclick"];
$premiumreferalc=$_POST["premiumreferalc"];

$upgrade=$_POST["upgrade"];
$WMZupgrade=$_POST["WMZupgrade"];
$WMRupgrade=$_POST["WMRupgrade"];

$hits500=$_POST["hits500"];
$hits1000=$_POST["hits1000"];
$hits2000=$_POST["hits2000"];
$hits3000=$_POST["hits3000"];
$hits5000=$_POST["hits5000"];
$hits10000=$_POST["hits10000"];

$WMZhits500=$_POST["WMZhits500"];
$WMZhits1000=$_POST["WMZhits1000"];
$WMZhits2000=$_POST["WMZhits2000"];
$WMZhits3000=$_POST["WMZhits3000"];
$WMZhits5000=$_POST["WMZhits5000"];
$WMZhits10000=$_POST["WMZhits10000"];

$WMRhits500=$_POST["WMRhits500"];
$WMRhits1000=$_POST["WMRhits1000"];
$WMRhits2000=$_POST["WMRhits2000"];
$WMRhits3000=$_POST["WMRhits3000"];
$WMRhits5000=$_POST["WMRhits5000"];
$WMRhits10000=$_POST["WMRhits10000"];








    //Todo parece correcto procedemos con la inserccion


	$query = "UPDATE tb_site SET sitename='$sitename' where id='1'";
    mysql_query($query) or die(mysql_error());

	$query = "UPDATE tb_site SET sitepp='$sitepp' where id='1'";
    mysql_query($query) or die(mysql_error());
    
	$query = "UPDATE tb_site SET WMZ='$WMZ' where id='1'";
    mysql_query($query) or die(mysql_error());
    
	$query = "UPDATE tb_site SET WMR='$WMR' where id='1'";
    mysql_query($query) or die(mysql_error());



    $query = "UPDATE tb_config SET price='$click' where item='click' and howmany='1'";
    mysql_query($query) or die(mysql_error());

    $query = "UPDATE tb_config SET price='$referalclick' where item='referalclick' and howmany='1'";
    mysql_query($query) or die(mysql_error());

    $query = "UPDATE tb_config SET price='$premiumclick' where item='premiumclick' and howmany='1'";
    mysql_query($query) or die(mysql_error());

    $query = "UPDATE tb_config SET price='$premiumreferalc' where item='premiumreferalc' and howmany='1'";
    mysql_query($query) or die(mysql_error());

    $query = "UPDATE tb_config SET price='$payment' where item='payment' and howmany='1'";
    mysql_query($query) or die(mysql_error());

    $query = "UPDATE tb_config SET price='$upgrade', WMZ='$WMZupgrade', WMR='$WMRupgrade' where item='upgrade' and howmany='1'";
    mysql_query($query) or die(mysql_error());

    $query = "UPDATE tb_config SET price='$hits500', WMZ='$WMZhits500', WMR='$WMRhits500' where item='hits' and howmany='500'";
    mysql_query($query) or die(mysql_error());

    $query = "UPDATE tb_config SET price='$hits1000', WMZ='$WMZhits1000', WMR='$WMRhits1000' where item='hits' and howmany='1000'";
    mysql_query($query) or die(mysql_error());

    $query = "UPDATE tb_config SET price='$hits2000', WMZ='$WMZhits2000', WMR='$WMRhits2000' where item='hits' and howmany='2000'";
    mysql_query($query) or die(mysql_error());

    $query = "UPDATE tb_config SET price='$hits3000', WMZ='$WMZhits3000', WMR='$WMRhits3000' where item='hits' and howmany='3000'";
    mysql_query($query) or die(mysql_error());

    $query = "UPDATE tb_config SET price='$hits5000', WMZ='$WMZhits5000', WMR='$WMRhits5000' where item='hits' and howmany='5000'";
    mysql_query($query) or die(mysql_error());

    $query = "UPDATE tb_config SET price='$hits10000', WMZ='$WMZhits10000', WMR='$WMRhits10000' where item='hits' and howmany='10000'";
    mysql_query($query) or die(mysql_error());


    echo "<font color=\"green\"><b>Дата удаления.</b></font><br><br>";


}


?>

<form method="post" action="index.php?op=9">


<?
$sql = "SELECT * FROM tb_site WHERE id='1'";
$result = mysql_query($sql);        
$row = mysql_fetch_array($result);
?>

<b>Настроики сайта</b><br>
<table>
<tr><th width="200">
Имя сайта</th><td> <input type="text" name="sitename" value="<? echo $row["sitename"]; ?>" size="30" maxlength="150">
</td></tr>

<tr><th>
WME кошелек:</th><td> <input type="text" name="sitepp" value="<?
$sql = "SELECT * FROM tb_site WHERE id='1'";
$result = mysql_query($sql);        
$row = mysql_fetch_array($result);
echo $row["sitepp"]; ?>" size="30" maxlength="30"></td></tr>
 
<tr><th>
WMZ кошелек:</th><td> <input type="text" name="WMZ" value="<?
$sql = "SELECT * FROM tb_site WHERE id='1'";
$result = mysql_query($sql);        
$row = mysql_fetch_array($result);
echo $row["WMZ"]; ?>" size="30" maxlength="13"></td></tr>

<tr><th>
WMR кошелек:</th><td> <input type="text" name="WMR" value="<?
$sql = "SELECT * FROM tb_site WHERE id='1'";
$result = mysql_query($sql);        
$row = mysql_fetch_array($result);
echo $row["WMR"]; ?>" size="30" maxlength="13"></td></tr> 
 
</table>



<?

$sql = "SELECT * FROM tb_config WHERE item='click' and howmany='1'";
$result = mysql_query($sql);        
$row = mysql_fetch_array($result);

?>
<b>Настройки юзеров</b><br>
<table>
<tr>
<th width="200">Цена за клик:</th><td> <input type="text" name="click" value="<? echo $row["price"]; ?>"> €</td></tr>
<tr>
<th width="200">Цена за клик реферала:</th><td> <input type="text" name="referalclick" value="<?

$sql = "SELECT * FROM tb_config WHERE item='referalclick' and howmany='1'";
$result = mysql_query($sql);        
$row = mysql_fetch_array($result);

 echo $row["price"]; ?>"> €</td></tr>
<tr>
<th width="200">Минимум к выплате:</th><td> <input type="text" name="payment" value="<?

$sql = "SELECT * FROM tb_config WHERE item='payment' and howmany='1'";
$result = mysql_query($sql);        
$row = mysql_fetch_array($result);

echo $row["price"]; ?>"> €</td></tr></table>


<?

$sql = "SELECT * FROM tb_config WHERE item='premiumclick' and howmany='1'";
$result = mysql_query($sql);        
$row = mysql_fetch_array($result);

?>
<b>Premium настройки</b><br>
<table>
<tr>
<th width="200">Цена premium за клик:</th><td> <input type="text" name="premiumclick" value="<? echo $row["price"]; ?>"> €</td></tr>
<tr>
<th width="200">Цена premium за клик реферала:</th><td> <input type="text" name="premiumreferalc" value="<?

$sql = "SELECT * FROM tb_config WHERE item='premiumreferalc' and howmany='1'";
$result = mysql_query($sql);        
$row = mysql_fetch_array($result);

echo $row["price"]; ?>"> €</td></tr></table>

<b>Апгрейды</b><br>
<table>
<tr>
<th width="200">Апгрейды цена (2 months):</th>
<td> <b>€:</b> <input type="text" name="upgrade" value="<?
$sql = "SELECT * FROM tb_config WHERE item='upgrade' and howmany='1'";
$result = mysql_query($sql);        
$row = mysql_fetch_array($result);
echo $row["price"]; ?>"></td>
<td> <b>WMZ:</b> <input type="text" name="WMZupgrade" value="<?echo $row["WMZ"]; ?>"></td>
<td> <b>WMR:</b> <input type="text" name="WMRupgrade" value="<?echo $row["WMR"]; ?>"></td>
</tr></table>


<b>Настройки рекламы</b><br>

<table>

<tr>
<th width="200">Цена за 500 кликов:</th><td> <b>€:</b> <input type="text" name="hits500" value="<?
$sqlfn = "SELECT * FROM tb_config WHERE item='hits' and howmany='500'";
$resultfn = mysql_query($sqlfn);        
$rowfn = mysql_fetch_array($resultfn);
echo $rowfn["price"];
?>"></td>
    <td> <b>WMZ:</b> <input type="text" name="WMZhits500" value="<?echo $rowfn["WMZ"]; ?>"></td>
    <td> <b>WMR:</b> <input type="text" name="WMRhits500" value="<?echo $rowfn["WMR"]; ?>"></td>
</tr>

<tr>
<th width="200">Цена за 1000 кликов:</th><td> <b>€:</b> <input type="text" name="hits1000" value="<?
$sqlfn = "SELECT * FROM tb_config WHERE item='hits' and howmany='1000'";
$resultfn = mysql_query($sqlfn);        
$rowfn = mysql_fetch_array($resultfn);
echo $rowfn["price"];
?>"></td>
    <td> <b>WMZ:</b> <input type="text" name="WMZhits1000" value="<?echo $rowfn["WMZ"]; ?>"></td>
    <td> <b>WMR:</b> <input type="text" name="WMRhits1000" value="<?echo $rowfn["WMR"]; ?>"></td>
</tr>

<tr>
<th width="200">Цена за 2000 кликов:</th><td> <b>€:</b> <input type="text" name="hits2000" value="<?
$sqlfn = "SELECT * FROM tb_config WHERE item='hits' and howmany='2000'";
$resultfn = mysql_query($sqlfn);        
$rowfn = mysql_fetch_array($resultfn);
echo $rowfn["price"];
?>"></td>
    <td> <b>WMZ:</b> <input type="text" name="WMZhits2000" value="<?echo $rowfn["WMZ"]; ?>"></td>
    <td> <b>WMR:</b> <input type="text" name="WMRhits2000" value="<?echo $rowfn["WMR"]; ?>"></td>
</tr>

<tr>
<th width="200">Цена за 3000 кликов:</th><td> <b>€:</b> <input type="text" name="hits3000" value="<?
$sqlfn = "SELECT * FROM tb_config WHERE item='hits' and howmany='3000'";
$resultfn = mysql_query($sqlfn);        
$rowfn = mysql_fetch_array($resultfn);
echo $rowfn["price"];
?>"></td>
    <td> <b>WMZ:</b> <input type="text" name="WMZhits3000" value="<?echo $rowfn["WMZ"]; ?>"></td>
    <td> <b>WMR:</b> <input type="text" name="WMRhits3000" value="<?echo $rowfn["WMR"]; ?>"></td>
</tr>

<tr>
<th width="200">Цена за 5000 кликов:</th><td> <b>€:</b> <input type="text" name="hits5000" value="<?
$sqlfn = "SELECT * FROM tb_config WHERE item='hits' and howmany='5000'";
$resultfn = mysql_query($sqlfn);        
$rowfn = mysql_fetch_array($resultfn);
echo $rowfn["price"];
?>"></td>
    <td> <b>WMZ:</b> <input type="text" name="WMZhits5000" value="<?echo $rowfn["WMZ"]; ?>"></td>
    <td> <b>WMR:</b> <input type="text" name="WMRhits5000" value="<?echo $rowfn["WMR"]; ?>"></td>
</tr>

<tr>
<th width="200">Цена за 10000 кликов:</th><td> <b>€:</b> <input type="text" name="hits10000" value="<?
$sqlfn = "SELECT * FROM tb_config WHERE item='hits' and howmany='10000'";
$resultfn = mysql_query($sqlfn);        
$rowfn = mysql_fetch_array($resultfn);
echo $rowfn["price"];
?>"></td>
    <td> <b>WMZ:</b> <input type="text" name="WMZhits10000" value="<?echo $rowfn["WMZ"]; ?>"></td>
    <td> <b>WMR:</b> <input type="text" name="WMRhits10000" value="<?echo $rowfn["WMR"]; ?>"></td>
</tr>


</table>


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


</form>
