<?php
session_start();

include "../config.php";
include "../header.php";
include "../style.php";
if( isset($_SESSION["alogin"]) ) {
?><table>
<tr>
<td width="15%" valign=top><br>
<? include("adminnavigation.php"); ?>
</td>
<td valign="top" align="center"><br><br> <?
echo "<font size=2 face='$fonttype' color='$fontcolour'><p><center>";

echo "<center><H2>Edit Offer Page</H2></center>";

if($_POST['action'] == "update") {

mysql_query("UPDATE offerpage SET price = '".dbput($_POST['price'])."', points = '".dbput($_POST['points'])."', banner_num = '".dbput($_POST['banner_num'])."', 
banner_views = '".dbput($_POST['banner_views'])."', solo_num = '".dbput($_POST['solo_num'])."', hheadlinead_num = '".dbput($_POST['hheadlinead_num'])."', 
hheadlinead_views = '".dbput($_POST['hheadlinead_views'])."', hheaderad_num = '".dbput($_POST['hheaderad_num'])."', hheaderad_views = '".dbput($_POST['hheaderad_views'])."', 
traffic_num = '".dbput($_POST['traffic_num'])."', traffic_views = '".dbput($_POST['traffic_views'])."', 
upgrade_pro = '".dbput($_POST['upgrade_pro'])."', upgrade_jv = '".dbput($_POST['upgrade_jv'])."', login_num = '".dbput($_POST['login_num'])."', 
login_views = '".dbput($_POST['login_views'])."', hotlink_num = '".dbput($_POST['hotlink_num'])."', hotlink_views = '".dbput($_POST['hotlink_views'])."', 
button_num = '".dbput($_POST['button_num'])."', button_views = '".dbput($_POST['button_views'])."', headline_num = '".dbput($_POST['headline_num'])."', 
headline_views = '".dbput($_POST['headline_views'])."', ptc_num = '".dbput($_POST['ptc_num'])."', ptc_views = '".dbput($_POST['ptc_views'])."',	cashsolo_num = '".dbput($_POST['cashsolo_num'])."', memtype = '".dbput($_POST['memtype'])."', enable = '".dbput($_POST['enable'])."',
upgrade1_price = '".dbput($_POST['upgrade1_price'])."', upgrade1_text = '".dbput($_POST['upgrade1_text'])."', upgrade1_points = '".dbput($_POST['upgrade1_points'])."', 
upgrade2_price = '".dbput($_POST['upgrade2_price'])."', upgrade2_text = '".dbput($_POST['upgrade2_text'])."', upgrade2_solos = '".dbput($_POST['upgrade2_solos'])."',
upgrade3_price = '".dbput($_POST['upgrade3_price'])."', upgrade3_text = '".dbput($_POST['upgrade3_text'])."', upgrade3_banners = '".dbput($_POST['upgrade3_banners'])."', upgrade3_views = '".dbput($_POST['upgrade3_views'])."', 
upgrade4_price = '".dbput($_POST['upgrade4_price'])."', upgrade4_text = '".dbput($_POST['upgrade4_text'])."', upgrade4_traffic = '".dbput($_POST['upgrade4_traffic'])."', upgrade4_views = '".dbput($_POST['upgrade4_views'])."', 
upgrade5_price = '".dbput($_POST['upgrade5_price'])."', upgrade5_text = '".dbput($_POST['upgrade5_text'])."', upgrade5_login = '".dbput($_POST['upgrade5_login'])."', upgrade5_views = '".dbput($_POST['upgrade5_views'])."', 
upgrade6_price = '".dbput($_POST['upgrade6_price'])."', upgrade6_text = '".dbput($_POST['upgrade6_text'])."', upgrade6_hotlink = '".dbput($_POST['upgrade6_hotlink'])."', upgrade6_views = '".dbput($_POST['upgrade6_views'])."', 
upgrade7_price = '".dbput($_POST['upgrade7_price'])."', upgrade7_text = '".dbput($_POST['upgrade7_text'])."', upgrade7_button = '".dbput($_POST['upgrade7_button'])."', upgrade7_views = '".dbput($_POST['upgrade7_views'])."', 
upgrade8_price = '".dbput($_POST['upgrade8_price'])."', upgrade8_text = '".dbput($_POST['upgrade8_text'])."', upgrade8_headline = '".dbput($_POST['upgrade8_headline'])."', upgrade8_views = '".dbput($_POST['upgrade8_views'])."', 
upgrade9_price = '".dbput($_POST['upgrade9_price'])."', upgrade9_text = '".dbput($_POST['upgrade9_text'])."', upgrade9_ptc = '".dbput($_POST['upgrade9_ptc'])."', upgrade9_views = '".dbput($_POST['upgrade9_views'])."', 
upgrade10_price = '".dbput($_POST['upgrade10_price'])."', upgrade10_text = '".dbput($_POST['upgrade10_text'])."', upgrade10_cashsolos = '".dbput($_POST['upgrade10_cashsolos'])."' WHERE 1");

echo "<font color=red>The settings have been updated.</font><br><br>";

}

if($_POST['reset']) {
mysql_query("UPDATE members SET viewed_offer=0 WHERE 1");
echo "<font color=red>The views have been reset.</font><br><br>";
}


$sql = mysql_query("SELECT * FROM offerpage LIMIT 1");
$offer = mysql_fetch_array($sql);
$offer = $offer;


?>

<form method="POST" action="editoffer.php">
<input type="hidden" name="action" value="update">
<table>
<tr><td>Price:</td><td><input type="text" name="price" value="<? echo $offer['price']; ?>">$</td></tr>
<tr><td>Points to add:</td><td><input type="text" name="points" value="<? echo $offer['points']; ?>"> points</td></tr>
<tr><td>Solo to add:</td><td><input type="text" name="solo_num" value="<? echo $offer['solo_num']; ?>"> solos</td></tr>

<tr><td>Hot Headline Adz to add:</td><td><input type="text" name="hheadlinead_num" value="<? echo $offer['hheadlinead_num']; ?>"> hot headline ads</td></tr>
<tr><td>Clicks per Hot Headline Ad:</td><td><input type="text" name="hheadlinead_views" value="<? echo $offer['hheadlinead_views']; ?>"> clicks</td></tr>
<tr><td>Hot Header Ads to add:</td><td><input type="text" name="hheaderad_num" value="<? echo $offer['hheaderad_num']; ?>"> hot header ads</td></tr>
<tr><td>Clicks per Hot Header Ad:</td><td><input type="text" name="hheaderad_views" value="<? echo $offer['hheaderad_views']; ?>"> clicks</td></tr>
<tr><td>Cash Solo to add:</td><td><input type="text" name="cashsolo_num" value="<? echo $offer['cashsolo_num']; ?>"> cash solos</td></tr>
<tr><td>Banners to add:</td><td><input type="text" name="banner_num" value="<? echo $offer['banner_num']; ?>"> banners</td></tr>
<tr><td>Views per banner:</td><td><input type="text" name="banner_views" value="<? echo $offer['banner_views']; ?>"> views</td></tr>
<tr><td>Traffic links to add:</td><td><input type="text" name="traffic_num" value="<? echo $offer['traffic_num']; ?>"> traffic links</td></tr>
<tr><td>Views per traffic link:</td><td><input type="text" name="traffic_views" value="<? echo $offer['traffic_views']; ?>"> views</td></tr>
<tr><td>Login ads to add:</td><td><input type="text" name="login_num" value="<? echo $offer['login_num']; ?>"> login ads</td></tr>
<tr><td>Views per login ad:</td><td><input type="text" name="login_views" value="<? echo $offer['login_views']; ?>"> views</td></tr>
<tr><td>Hotlinks to add:</td><td><input type="text" name="hotlink_num" value="<? echo $offer['hotlink_num']; ?>"> hotlinks</td></tr>
<tr><td>Views per hotlink:</td><td><input type="text" name="hotlink_views" value="<? echo $offer['hotlink_views']; ?>"> views</td></tr>
<tr><td>Button ads to add:</td><td><input type="text" name="button_num" value="<? echo $offer['button_num']; ?>"> button ads</td></tr>
<tr><td>Views per button ad:</td><td><input type="text" name="button_views" value="<? echo $offer['button_views']; ?>"> views</td></tr>
<tr><td>Headline ads to add:</td><td><input type="text" name="headline_num" value="<? echo $offer['headline_num']; ?>"> headline ads</td></tr>
<tr><td>Views per headline ad:</td><td><input type="text" name="headline_views" value="<? echo $offer['headline_views']; ?>"> views</td></tr>
<tr><td>PTC ads to add:</td><td><input type="text" name="ptc_num" value="<? echo $offer['ptc_num']; ?>"> ptc ads</td></tr>
<tr><td>Views per PTC ad:</td><td><input type="text" name="ptc_views" value="<? echo $offer['ptc_views']; ?>"> views</td></tr>
<tr><td>Upgrade:</td><td><input type="radio" name="upgrade_pro" value="1"<? if($offer['upgrade_pro'] == "1") echo " CHECKED"; ?>> JV Member <input type="radio" name="upgrade_pro" value="2"<? if($offer['upgrade_pro'] == "2") echo " CHECKED"; ?>> SUPER JV <input type="radio" name="upgrade_pro" value="0"<? if($offer['upgrade_pro'] == 0) echo " CHECKED"; ?>> No</td></tr>
<tr><td>Show to:</td><td><input type="radio" name="memtype" value="PRO"<? if($offer['memtype'] == "PRO") echo " CHECKED"; ?>> Pro Members <input type="radio" name="memtype" value="JV Member"<? if($offer['memtype'] == "JV Member") echo " CHECKED"; ?>> JV Members <input type="radio" name="memtype" value="SUPER JV"<? if($offer['memtype'] == "SUPER JV") echo " CHECKED"; ?>> SUPER JV Members <input type="radio" name="memtype" value="ALL"<? if($offer['memtype'] == "ALL") echo " CHECKED"; ?>> All</td></tr>
<!--tr><td>Show after login:</td><td><input type="radio" name="enable" value="1"<? if($offer['enable'] == 1) echo " CHECKED"; ?>> Yes <input type="radio" name="enable" value="0"<? if($offer['enable'] == 0) echo " CHECKED"; ?>> No</td></tr-->	 

<tr><td>Show after login:</td><td><input type="radio" name="enable" value="1"<? if($offer['enable'] == 1) echo " CHECKED"; ?>> Always <input type="radio" name="enable" value="2"<? if($offer['enable'] == 2) echo " CHECKED"; ?>> Only Once <input type="radio" name="enable" value="0"<? if($offer['enable'] == 0) echo " CHECKED"; ?>> No</td></tr>        

<tr><td colspan=2 align=center><br><br><b>Upgrade 1</b></td></tr>
<tr><td>Text:</td><td><input type="text" name="upgrade1_text" value="<? echo dbget($offer['upgrade1_text']); ?>"></td></tr>
<tr><td>Price:</td><td>$<input type="text" name="upgrade1_price" value="<? echo $offer['upgrade1_price']; ?>"></td></tr>
<tr><td>Points to add:</td><td><input type="text" name="upgrade1_points" value="<? echo $offer['upgrade1_points']; ?>"> points</td></tr>



<tr><td colspan=2 align=center><br><br><b>Upgrade 2</b></td></tr>
<tr><td>Text:</td><td><input type="text" name="upgrade2_text" value="<? echo dbget($offer['upgrade2_text']); ?>"></td></tr>
<tr><td>Price:</td><td>$<input type="text" name="upgrade2_price" value="<? echo $offer['upgrade2_price']; ?>"></td></tr>
<tr><td>Solos to add:</td><td><input type="text" name="upgrade2_solos" value="<? echo $offer['upgrade2_solos']; ?>"> solos</td></tr>		


<tr><td colspan=2 align=center><br><br><b>Upgrade 3</b></td></tr>
<tr><td>Text:</td><td><input type="text" name="upgrade3_text" value="<? echo dbget($offer['upgrade3_text']); ?>"></td></tr>
<tr><td>Price:</td><td>$<input type="text" name="upgrade3_price" value="<? echo $offer['upgrade3_price']; ?>"></td></tr>
<tr><td>Banners to add:</td><td><input type="text" name="upgrade3_banners" value="<? echo $offer['upgrade3_banners']; ?>"> banners</td></tr>		 
<tr><td>Views per banner:</td><td><input type="text" name="upgrade3_views" value="<? echo $offer['upgrade3_views']; ?>"> views</td></tr>		 


<tr><td colspan=2 align=center><br><br><b>Upgrade 4</b></td></tr>
<tr><td>Text:</td><td><input type="text" name="upgrade4_text" value="<? echo dbget($offer['upgrade4_text']); ?>"></td></tr>
<tr><td>Price:</td><td>$<input type="text" name="upgrade4_price" value="<? echo $offer['upgrade4_price']; ?>"></td></tr>
<tr><td>Traffic links to add:</td><td><input type="text" name="upgrade4_traffic" value="<? echo $offer['upgrade4_traffic']; ?>"> traffic links</td></tr>		 
<tr><td>Views per traffic link:</td><td><input type="text" name="upgrade4_views" value="<? echo $offer['upgrade4_views']; ?>"> views</td></tr>	

<tr><td colspan=2 align=center><br><br><b>Upgrade 5</b></td></tr>
<tr><td>Text:</td><td><input type="text" name="upgrade5_text" value="<? echo dbget($offer['upgrade5_text']); ?>"></td></tr>
<tr><td>Price:</td><td>$<input type="text" name="upgrade5_price" value="<? echo $offer['upgrade5_price']; ?>"></td></tr>
<tr><td>Login ads to add:</td><td><input type="text" name="upgrade5_login" value="<? echo $offer['upgrade5_login']; ?>"> login ads</td></tr>		 
<tr><td>Views per login ad:</td><td><input type="text" name="upgrade5_views" value="<? echo $offer['upgrade5_views']; ?>"> views</td></tr>

<tr><td colspan=2 align=center><br><br><b>Upgrade 6</b></td></tr>
<tr><td>Text:</td><td><input type="text" name="upgrade6_text" value="<? echo dbget($offer['upgrade6_text']); ?>"></td></tr>
<tr><td>Price:</td><td>$<input type="text" name="upgrade6_price" value="<? echo $offer['upgrade6_price']; ?>"></td></tr>
<tr><td>Hotlinks to add:</td><td><input type="text" name="upgrade6_hotlink" value="<? echo $offer['upgrade6_hotlink']; ?>"> hotlinks</td></tr>		 
<tr><td>Views per hotlink:</td><td><input type="text" name="upgrade6_views" value="<? echo $offer['upgrade6_views']; ?>"> views</td></tr>

<tr><td colspan=2 align=center><br><br><b>Upgrade 7</b></td></tr>
<tr><td>Text:</td><td><input type="text" name="upgrade7_text" value="<? echo dbget($offer['upgrade7_text']); ?>"></td></tr>
<tr><td>Price:</td><td>$<input type="text" name="upgrade7_price" value="<? echo $offer['upgrade7_price']; ?>"></td></tr>
<tr><td>Button ads to add:</td><td><input type="text" name="upgrade7_button" value="<? echo $offer['upgrade7_button']; ?>"> button ads</td></tr>		 
<tr><td>Views per button ad:</td><td><input type="text" name="upgrade7_views" value="<? echo $offer['upgrade7_views']; ?>"> views</td></tr>			   

<tr><td colspan=2 align=center><br><br><b>Upgrade 8</b></td></tr>
<tr><td>Text:</td><td><input type="text" name="upgrade8_text" value="<? echo dbget($offer['upgrade8_text']); ?>"></td></tr>
<tr><td>Price:</td><td>$<input type="text" name="upgrade8_price" value="<? echo $offer['upgrade8_price']; ?>"></td></tr>
<tr><td>Headline ads to add:</td><td><input type="text" name="upgrade8_headline" value="<? echo $offer['upgrade8_headline']; ?>"> headline ads</td></tr>		 
<tr><td>Views per headline ad:</td><td><input type="text" name="upgrade8_views" value="<? echo $offer['upgrade8_views']; ?>"> views</td></tr>

<tr><td colspan=2 align=center><br><br><b>Upgrade 9</b></td></tr>
<tr><td>Text:</td><td><input type="text" name="upgrade9_text" value="<? echo dbget($offer['upgrade9_text']); ?>"></td></tr>
<tr><td>Price:</td><td>$<input type="text" name="upgrade9_price" value="<? echo $offer['upgrade9_price']; ?>"></td></tr>
<tr><td>PTC ads to add:</td><td><input type="text" name="upgrade9_ptc" value="<? echo $offer['upgrade9_ptc']; ?>"> ptc ads</td></tr>		 
<tr><td>Views per PTC ad:</td><td><input type="text" name="upgrade9_views" value="<? echo $offer['upgrade9_views']; ?>"> views</td></tr>

<tr><td colspan=2 align=center><br><br><b>Upgrade 10</b></td></tr>
<tr><td>Text:</td><td><input type="text" name="upgrade10_text" value="<? echo dbget($offer['upgrade10_text']); ?>"></td></tr>
<tr><td>Price:</td><td>$<input type="text" name="upgrade10_price" value="<? echo $offer['upgrade10_price']; ?>"></td></tr>
<tr><td>Cash Solos to add:</td><td><input type="text" name="upgrade10_cashsolos" value="<? echo $offer['upgrade10_cashsolos']; ?>"> cash solos<br><br></td></tr>		

<tr><td colspan="2" align="center"><input type="submit" value="Update All Settings"></td></tr>
</table>
</form>


<br><br>
<center><font color="red"><b>PLEASE NOTE:</font></b><br>If you set your login offer to show "Only Once", the login views must be reset after setting it back to "Always" or your members will never see the login offer again.<br><br>
<form method="POST"><input type="submit" name="reset" value="Reset Offerpage Login Views"></form>
<br><br>



<?
echo "</td></tr></table>";
}
else
echo "Unauthorised Access!";

include "../footer.php";

?>