<?php

session_start ();

include "../config.php";
include "../header.php";
include "../style.php";

if (isset ( $_SESSION ["ulogin"] )) { // members only stuff!


	include ("navigation.php");
	include ("../banners2.php");
	echo "<font size=2 face='$fonttype' color='$fontcolour'><p><center>";
	echo "<br><H2><center><img src='images/ti-trade.png'></H2>";

	$procommission = 0;
	$jvcommission = 0;
	$superjvcommission = 0;

	if ($item == "banner") {

		if ($points >= $bannerpointprice) {

			mysql_query ( "INSERT INTO `banners` ( `id` , `name` , `bannerurl` , `targeturl` , `userid` , `status` , `shown` , `clicks` , `max` , `added` )VALUES (NULL , '', '', '', '" . $userid . "', '0', '0', '0', '1000', '0')" );
			mysql_query ( "UPDATE members SET points=points-" . $bannerpointprice . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id', '" . $userid . "','Conversion for a banner','" . time () . "','-$bannerpointprice points')" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing a Banner ad. <a href=\"addbanners.php\">Click here</a> to set it up.</font></p>";

		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}

	}
	if ($item == "button") {

		if ($points >= $buttonpointprice) {

			mysql_query ( "INSERT INTO `buttons` ( `id` , `name` , `bannerurl` , `targeturl` , `userid` , `status` , `shown` , `clicks` , `max` , `added` )VALUES (NULL , '', '', '', '" . $userid . "', '0', '0', '0', '1000', '0')" );
			mysql_query ( "UPDATE members SET points=points-" . $buttonpointprice . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id', '" . $userid . "','Conversion for a button banner ad','" . time () . "','-$buttonpointprice points')" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing a Button Banner ad. <a href=\"addbuttons.php\">Click here</a> to set it up.</font></p>";

		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}

	} elseif ($item == "hotlink1") {

		if ($points >= $hotlinkpointprice1) {

			mysql_query ( "insert into hotlinks (userid,max,purchase) values('$userid','5000','" . time () . "')" );
			mysql_query ( "UPDATE members SET points=points-" . $hotlinkpointprice1 . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id','" . $userid . "','Conversion for an hotlink','" . time () . "','-$hotlinkpointprice1 points')" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing an Hotlink. <a href=\"addhotlink.php\">Click here</a> to set it up.</font></p>";
		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}

	} elseif ($item == "hotlink2") {

		if ($points >= $hotlinkpointprice2) {

			mysql_query ( "insert into hotlinks (userid,max,purchase) values('$userid','10000','" . time () . "')" );
			mysql_query ( "UPDATE members SET points=points-" . $hotlinkpointprice2 . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id','" . $userid . "','Conversion for an hotlink','" . time () . "','-$hotlinkpointprice2 points')" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing an Hotlink. <a href=\"addhotlink.php\">Click here</a> to set it up.</font></p>";
		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}

	} elseif ($item == "hotlink3") {

		if ($points >= $hotlinkpointprice3) {

			mysql_query ( "insert into hotlinks (userid,max,purchase) values('$userid','20000','" . time () . "')" );
			mysql_query ( "UPDATE members SET points=points-" . $hotlinkpointprice3 . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id','" . $userid . "','Conversion for an hotlink','" . time () . "','-$hotlinkpointprice3 points')" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing an Hotlink. <a href=\"addhotlink.php\">Click here</a> to set it up.</font></p>";
		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}

	} elseif ($item == "tlink1") {

		if ($points >= $tlinkpoints1) {

			mysql_query ( "insert into tlinks (userid,paid) values('$userid','50')" );
			mysql_query ( "UPDATE members SET points=points-" . $tlinkpoints1 . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id', '" . $userid . "','Conversion for a traffic link','" . time () . "','-$tlinkpoints1 points')" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing a Traffic Link. <a href=\"addtlinks.php\">Click here</a> to set it up.</font></p>";

		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}

	}

	elseif ($item == "tlink2") {

		if ($points >= $tlinkpoints2) {

			mysql_query ( "insert into tlinks (userid,paid) values('$userid','100')" );
			mysql_query ( "UPDATE members SET points=points-" . $tlinkpoints2 . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id', '" . $userid . "','Conversion for a traffic link','" . time () . "','-$tlinkpoints2 points')" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing a Traffic Link. <a href=\"addtlinks.php\">Click here</a> to set it up.</font></p>";

		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}

	}

	elseif ($item == "tlink3") {

		if ($points >= $tlinkpoints3) {

			mysql_query ( "insert into tlinks (userid,paid) values('$userid','200')" );
			mysql_query ( "UPDATE members SET points=points-" . $tlinkpoints3 . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id', '" . $userid . "','Conversion for a traffic link','" . time () . "','-$tlinkpoints3 points')" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing a Traffic Link. <a href=\"addtlinks.php\">Click here</a> to set it up.</font></p>";

		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}
	} elseif ($item == "cashsolo") {

		if ($points >= $cashsoloprice2) {

			mysql_query ( "INSERT INTO `cashsolos` (`id` ,`userid` ,`approved` ,`subject` ,`adbody` ,`sent` ,`added`) VALUES (NULL , '" . $userid . "', '0', '', '', '0', '0')" );
			mysql_query ( "UPDATE members SET points=points-" . $cashsoloprice2 . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id','" . $userid . "','Conversion for a Cash Solo','" . time () . "','-$cashsoloprice2 points')" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing a Cash Solo ad. <a href=\"addcashsolos.php\">Click here</a> to set it up.</font></p>";

		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}

	} elseif ($item == "hpcsolo") {

		if ($points >= $hpcsoloprice2) {

			mysql_query ( "INSERT INTO `hpcsolos` (`id` ,`userid` ,`approved` ,`subject` ,`adbody` ,`sent` ,`added`) VALUES (NULL , '" . $userid . "', '0', '', '', '0', '0')" );
			mysql_query ( "UPDATE members SET points=points-" . $hpcsoloprice2 . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id','" . $userid . "','Conversion for a High Priority Cash Solo','" . time () . "','-$hpcsoloprice2 points')" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing a High Priority Cash Solo ad. <a href=\"addhpcsolos.php\">Click here</a> to set it up.</font></p>";

		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}

	} elseif ($item == "ptc1") {

		if ($points >= $ptc1points) {

			mysql_query ( "insert into ptcads (userid,paid) values('$userid','50')" );
			mysql_query ( "UPDATE members SET points=points-" . $ptc1points . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id', '" . $userid . "','Conversion for a ptc 50 link','" . time () . "','-$ptc1points points')" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing a PTC Link ad. <a href=\"addptclinks.php\">Click here</a> to set it up.</font></p>";

		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}

	}

	elseif ($item == "ptc2") {

		if ($points >= $ptc2points) {

			mysql_query ( "insert into ptcads (userid,paid) values('$userid','100')" );
			mysql_query ( "UPDATE members SET points=points-" . $ptc2points . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id', '" . $userid . "','Conversion for a ptc 100 link','" . time () . "','-$ptc2points points')" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing a PTC Link. <a href=\"addptclinks.php\">Click here</a> to set it up.</font></p>";

		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}

	}

	elseif ($item == "ptc3") {

		if ($points >= $ptc3points) {

			mysql_query ( "insert into ptcads (userid,paid) values('$userid','200')" );
			mysql_query ( "UPDATE members SET points=points-" . $ptc3points . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id', '" . $userid . "','Conversion for a ptc 200 link','" . time () . "','-$ptc3points points')" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing a PTC Link. <a href=\"addptclinks.php\">Click here</a> to set it up.</font></p>";

		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}

	} elseif ($item == "headline1") {

		if ($points >= $headlineprice1points) {

			mysql_query ( "insert into headlineads (userid,max) values('$userid','5000')" );
			mysql_query ( "UPDATE members SET points=points-" . $headlineprice1points . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id','" . $userid . "','Conversion for an HeadlineAd','" . time () . "','-$headlineprice1points points')" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing a Headline Ad. <a href=\"addheadline.php\">Click here</a> to set it up.</font></p>";
		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}

	} elseif ($item == "headline2") {

		if ($points >= $headlineprice2points) {

			mysql_query ( "insert into headlineads (userid,max) values('$userid','10000')" );
			mysql_query ( "UPDATE members SET points=points-" . $headlineprice2points . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id','" . $userid . "','Conversion for an HeadlineAd','" . time () . "','-$headlineprice2points points')" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing a Headline Ad. <a href=\"addheadline.php\">Click here</a> to set it up.</font></p>";
		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}

	} elseif ($item == "headline3") {

		if ($points >= $headlineprice3points) {

			mysql_query ( "insert into headlineads (userid,max) values('$userid','20000')" );
			mysql_query ( "UPDATE members SET points=points-" . $headlineprice3points . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id','" . $userid . "','Conversion for an HeadlineAd','" . time () . "','-$headlineprice3points points')" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing an Headline Ad. <a href=\"addheadline.php\">Click here</a> to set it up.</font></p>";
		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}

	} elseif ($item == "navtop") {

		if ($points >= $navtoppointprice) {

			mysql_query ( "INSERT INTO `topnav` ( `userid` , `date`) VALUES ('" . $userid . "', '" . time () . "')" );
			mysql_query ( "UPDATE members SET points=points-" . $navtoppointprice . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id', '" . $userid . "','Conversion for a top navigation link','" . time () . "','-$navtoppointprice points')" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing a Top Navigation Link. <a href=\"addtopnav.php\">Click here</a> to set it up.</font></p>";
		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}

	} elseif ($item == "botnav") {

		if ($points >= $navpricepoints) {

			mysql_query ( "INSERT INTO `botnav` ( `userid` , `date`) VALUES ('" . $userid . "', '" . time () . "')" );
			mysql_query ( "UPDATE members SET points=points-" . $navpricepoints . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id', '" . $userid . "','Conversion for a bottom navigation link','" . time () . "','-$navpricepoints points')" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing a Bottom Navigation Link. <a href=\"addbotnav.php\">Click here</a> to set it up.</font></p>";
		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}

	} elseif ($item == "login") {

		if ($points >= $loginpricepoints) {

			mysql_query ( "insert into loginads (userid,max) values('$userid','1000')" );
			mysql_query ( "UPDATE members SET points=points-" . $loginpricepoints . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id', '" . $userid . "','Conversion for a login ad','" . time () . "','-$loginpricepoints points')" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing a Login ad. <a href=\"addlogin.php\">Click here</a> to set it up.</font></p>";
		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}

	} elseif ($item == "solo") {

		if ($points >= $solopointprice) {

			mysql_query ( "INSERT INTO `solos` (`id` ,`userid` ,`approved` ,`subject` ,`adbody` ,`sent` ,`added`) VALUES (NULL , '" . $userid . "', '0', '', '', '0', '0')" );
			mysql_query ( "UPDATE members SET points=points-" . $solopointprice . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id', '" . $userid . "','Conversion for a solo','" . time () . "','-$solopointprice points')" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing a Solo ad. <a href=\"addsolos.php\">Click here</a> to set it up.</font></p>";

		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}

	} elseif ($item == "hpsolo") {

		if ($points >= $hpsolopointprice) {

			mysql_query ( "INSERT INTO `hpsolos` (`id` ,`userid` ,`approved` ,`subject` ,`adbody` ,`sent` ,`added`) VALUES (NULL , '" . $userid . "', '0', '', '', '0', '0')" );
			mysql_query ( "UPDATE members SET points=points-" . $hpsolopointprice . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id', '" . $userid . "','Conversion for a High Priority Solo','" . time () . "','-$hpsolopointprice points')" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing a High Priority Solo ad. <a href=\"addhpsolos.php\">Click here</a> to set it up.</font></p>";

		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}

	} elseif ($item == "hheadlinead") {

		if ($points >= $hheadlineadpointprice) {

			mysql_query ( "insert into hheadlineads (userid,max,purchase) values('$userid','$hheadlineadmaxhits', NOW())" );
			mysql_query ( "update members set points=points-" . $hheadlineadpointprice . " WHERE userid = '" . $userid . "'" );
			mysql_query ( "INSERT INTO transactions VALUES ('id', '" . $userid . "','Conversion for a Hot Headline Ad','" . time () . "','-$hheadlineadpointprice points')" );
			echo "<p><font face=\"Tahoma\" size=\"2\">Thank you for purchasing a Hot Headline Ad. <a href=\"addhheadlinead.php\">Click here</a> to set it up.</font></p>";
		} else {
			echo "<p><font face=\"Tahoma\" size=\"2\">You don't have enough points</font></p>";
		}

	} elseif ($item == "hheaderad") {

		if ($points >= $hheaderadpointprice) {

			mysql_query ( "insert into hheaderads (userid,max,purchase) values('$userid','$hheaderadmaxhits', NOW())" );
			mysql_query ( "update members set points=points-" . $hheaderadpointprice . " WHERE userid = '" . $userid . "'" );
			mysql_query ( "INSERT INTO transactions VALUES ('id', '" . $userid . "','Conversion for a Hot Header Ad','" . time () . "','-$hheaderadpointprice points')" );
			echo "<p><font face=\"Tahoma\" size=\"2\">Thank you for purchasing a Hot Header Ad. <a href=\"addhheaderad.php\">Click here</a> to set it up.</font></p>";
		} else {
			echo "<p><font face=\"Tahoma\" size=\"2\">You don't have enough points</font></p>";
		}

	} elseif ($item == "saf") {

		if ($points >= $safpointprice) {

			mysql_query ( "insert into footerads (userid,paid) values('$userid','50')" );
			mysql_query ( "UPDATE members SET points=points-" . $safpointprice . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id','" . $userid . "','Conversion for a Solo Footer Ad','" . time () . "','-$safpointprice points')" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing a Solo Footer Ad. <a href=\"addfooterads.php\">Click here</a> to set it up.</font></p>";
		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}
	} elseif ($item == "sah") {

		if ($points >= $sahpointprice) {

			mysql_query ( "insert into headerads (userid,paid) values('$userid','50')" );
			mysql_query ( "UPDATE members SET points=points-" . $sahpointprice . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id','" . $userid . "','Conversion for a Solo Header Ad','" . time () . "','-$safpointprice points')" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing a Solo Header Ad. <a href=\"addheaderads.php\">Click here</a> to set it up.</font></p>";
		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}
	} elseif ($item == "fulllogin") {

		if ($points >= $fullloginprice2) {

			mysql_query ( "insert into fullloginads (userid,rented) values('$userid','" . $_GET ['rented'] . "')" );

			mysql_query ( "UPDATE members SET points=points-" . $fullloginprice2 . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id', '" . $userid . "','Conversion for a full page login ad','" . time () . "','-$fullloginprice2 points')" );

			echo "<p><font face=\"Tahoma\" size=\"2\">Thank you for purchasing a full page login ad. <a href=\"addfulllogins.php\">Click here</a> to set it up.</font></p>";

		} else {

			echo "<p><font face=\"Tahoma\" size=\"2\">You don't have enough points</font></p>";

		}
	}

	if ($item == "offer") {

		if ($points >= $sopointprice) {

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

			$offer = mysql_fetch_array ( $sql );

			$query = "select * from members where userid='" . $userid . "'";

			$result = mysql_query ( $query ) or

			die ( "Query failed" );

			$numrows = @ mysql_num_rows ( $result );

			$user = mysql_fetch_array ( $result );

			mysql_query ( "UPDATE members SET points=points-" . $sopointprice . " WHERE userid = '" . $userid . "'" );
			mysql_query ( "INSERT INTO transactions VALUES ('id','" . $userid . "','Conversion for Special Offer','" . time () . "','-$sopointprice points')" );

			if ($offer ['points'])
				mysql_query ( "UPDATE members SET points=points+" . $offer ['points'] . " WHERE userid='" . $userid . "'" );

			if ($offer ['banner_num'] and $offer ['banner_views']) {

				$count = $offer ['banner_num'];

				while ( $count > 0 ) {

					mysql_query ( "INSERT INTO `banners` ( `id` , `name` , `bannerurl` , `targeturl` , `userid` , `status` , `shown` , `clicks` , `max` , `added` )VALUES (NULL , '', '', '', '" . $userid . "', '0', '0', '0', '" . $offer ['banner_views'] . "', '0')" );

					$count --;

				}

			}

			if ($offer ['button_num'] and $offer ['button_views']) {

				$count = $offer ['button_num'];
				while ( $count > 0 ) {
					mysql_query ( "INSERT INTO `buttons` ( `id` , `name` , `bannerurl` , `targeturl` , `userid` , `status` , `shown` , `clicks` , `max` , `added` )VALUES (NULL , '', '', '', '" . $userid . "', '0', '0', '0', '" . $offer ['button_views'] . "', '0')" );
					$count --;
				}
			}

			if ($offer ['hotlink_num'] and $offer ['hotlink_views']) {

				$count = $offer ['hotlink_num'];
				while ( $count > 0 ) {
					mysql_query ( "INSERT INTO hotlinks (userid,max,purchase) values('$userid','" . $offer ['hotlink_views'] . "','" . time () . "')" );
					$count --;
				}
			}
			if ($offer ['headline_num'] and $offer ['headline_views']) {

				$count = $offer ['headline_num'];
				while ( $count > 0 ) {
					mysql_query ( "INSERT INTO headlineads (userid,max) values('$userid','" . $offer ['headline_views'] . "')" );
					$count --;
				}
			}
			if ($offer ['traffic_num'] and $offer ['traffic_views']) {

				$count = $offer ['traffic_num'];

				while ( $count > 0 ) {

					mysql_query ( "insert into tlinks (userid,paid) values('$userid','" . $offer ['traffic_views'] . "')" );

					$count --;

				}

			}

			if ($offer ['login_num'] and $offer ['login_views']) {

				$count = $offer ['login_num'];
				while ( $count > 0 ) {
					mysql_query ( "insert into loginads (userid,max) values('$userid','" . $offer ['login_views'] . "')" );
					$count --;
				}
			}

			if ($offer ['upgrade_jv']) {

				upgrade_jv ( $userid );

			}

			if ($offer ['upgrade_superjv']) {

				upgrade_superjv ( $userid );

			}
			if ($offer ['ptc_num'] and $offer ['ptc_views']) {

				$count = $offer ['ptc_num'];

				while ( $count > 0 ) {

					mysql_query ( "insert into ptcads (userid,paid) values('$userid','" . $offer ['ptc_views'] . "')" );

					$count --;

				}

			}

			if ($offer ['topnav_num']) {

				$count = $offer ['topnav_num'];
				while ( $count > 0 ) {
					mysql_query ( "INSERT INTO `topnav` (`userid` , `date`) VALUES ('" . $userid . "', '" . time () . "')" );

					$count --;
				}
			}

			if ($offer ['botnav_num']) {

				$count = $offer ['botnav_num'];
				while ( $count > 0 ) {
					mysql_query ( "INSERT INTO `botnav` (`userid` , `date`) VALUES ('" . $userid . "', '" . time () . "')" );

					$count --;
				}
			}
			if ($offer ['cashsolo_num']) {

				$count = $offer ['cashsolo_num'];

				while ( $count > 0 ) {

					mysql_query ( "INSERT INTO `cashsolos` (`id` ,`userid` ,`approved` ,`subject` ,`adbody` ,`sent` ,`added`) VALUES (NULL , '" . $userid . "', '0', '', '', '0', '0')" );

					$count --;

				}

			}
			if ($offer ['hpcsolo_num']) {

				$count = $offer ['hpcsolo_num'];

				while ( $count > 0 ) {

					mysql_query ( "INSERT INTO `hpcsolos` (`id` ,`userid` ,`approved` ,`subject` ,`adbody` ,`sent` ,`added`) VALUES (NULL , '" . $userid . "', '0', '', '', '0', '0')" );

					$count --;

				}

			}

			if ($offer ['ssolo_num']) {

				$count = $offer ['ssolo_num'];

				while ( $count > 0 ) {

					mysql_query ( "INSERT INTO supersolos (userid, site) values('$userid','treasure')" );

					$count --;

				}

			}
			if ($offer ['solo_num']) {

				$count = $offer ['solo_num'];

				while ( $count > 0 ) {

					mysql_query ( "INSERT INTO `solos` (`id` ,`userid` ,`approved` ,`subject` ,`adbody` ,`sent` ,`added`) VALUES (NULL , '" . $userid . "', '0', '', '', '0', '0')" );

					$count --;

				}
			}

			if ($offer ['hheadlinead_num'] and $offer ['hheadlinead_views']) {
				$count = $offer ['hheadlinead_num'];
				while ( $count > 0 ) {
					mysql_query ( "insert into hheadlineads (userid,max,purchase) values('$userid','" . $offer ['hheadlinead_views'] . "',NOW())" );
					$count --;
				}
			}
			if ($offer ['hheaderad_num'] and $offer ['hheaderad_views']) {
				$count = $offer ['hheaderad_num'];
				while ( $count > 0 ) {
					mysql_query ( "insert into hheaderads (userid,max,purchase) values('$userid','" . $offer ['hheaderad_views'] . "',NOW())" );
					$count --;
				}
			}
			if ($offer ['hpsolo_num']) {

				$count = $offer ['hpsolo_num'];

				while ( $count > 0 ) {

					mysql_query ( "INSERT INTO `hpsolos` (`id` ,`userid` ,`approved` ,`subject` ,`adbody` ,`sent` ,`added`) VALUES (NULL , '" . $userid . "', '0', '', '', '0', '0')" );

					$count --;

				}

			}

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing the Special Offer Package.</font></p>";

		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough commissions to purchase.</font></p>";
		}

	} elseif ($item == "upgrade_jv_exchange") {

		if ($points >= $jvpointprice) {

			$projvcom = 0;
			$jvjvcom = 0;
			$superjvjvcom = 0;
			upgrade_jv ( $userid );

			mysql_query ( "UPDATE members SET points=points-" . $jvpointprice . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id','" . $userid . "','Conversion for a JV Member upgrade','" . time () . "','-$jvpointprice points')" );

			mysql_query ( "UPDATE members SET upgrade_points=1 WHERE userid = '" . $userid . "'" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing a JV Member upgrade.</font></p>";
		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}

	} elseif ($item == "upgrade_superjv_exchange") {

		if ($points >= $superjvpricepointse) {

			$prosupercom = 0;
			$jvsupercom = 0;
			$superjv2supercom = 0;
			upgrade_jv ( $userid );

			mysql_query ( "UPDATE members SET points=points-" . $superjvpricepoints . " WHERE userid = '" . $userid . "'" );

			mysql_query ( "INSERT INTO transactions VALUES ('id','" . $userid . "','Conversion for a SUPER JV upgrade','" . time () . "','-$superjvpricepoints points')" );

			mysql_query ( "UPDATE members SET upgrade_points=1 WHERE userid = '" . $userid . "'" );

			echo "<p><font face=\"Tahoma\" size=\"3\">Thank you for purchasing a SUPER JV Member upgrade.</font></p>";
		} else {
			echo "<p><font face=\"Tahoma\" size=\"3\">You don't have enough points</font></p>";
		}

	}

	echo "<br><br><br>";

}

include "../footer.php";
mysql_close ( $dblink );
?>