<?php

include "config.php";

?>
<html>
<body background="images/Back-4.gif">


<?
if ($_GET ['url']) {
	?>
<div style="float: left; padding-top: 100px;"><a
	href="<?
	echo $_GET ['url'];
	?>" target="_top">Remove This Frame</a></div>

<div style="float: right; padding-top: 100px;"><a
	href="<?
	echo $_GET ['url'];
	?>" target="_top">Remove This Frame</a></div>

<?
}
?>


<center>

<?

$userid = $_GET ['userid'];
$adid = $_GET ['adid'];
$seed = $_GET ['seed'];

$query1 = "select * from clicks where userid='" . dbput($userid) . "' and number='" . dbput($seed)."'";
$result1 = mysql_query ( $query1 ) or die ( "Query failed" );
$numrows1 = @ mysql_num_rows ( $result1 );

if ($numrows1 == 1) {
	echo "You have already received credits for this link";
} //end if ($numrows1 ==1)
else {
	
	$query2 = "insert into clicks set userid='" . dbput($userid) . "', number=" . $seed . ", adid=" . $adid;
	$result2 = mysql_query ( $query2 ) or die ( "Query failed" );
	
	$query3 = "select * from members where userid='" . dbput($userid) . "'";
	$result3 = mysql_query ( $query3 ) or die ( "Query failed" );
	
	$userrecord = mysql_fetch_array ( $result3 );
	$memtype = $userrecord ["memtype"];
	
	add_adclick ( 'solo' );
	
	if ($memtype == "PRO") {
		assignpoints ( $userrecord ['referid'], $proclickearn );
		$query4 = "update members set points=points+" . $proclickearn . " where userid='" . dbput($userid) . "'";
		$result4 = mysql_query ( $query4 ) or die ( "Query failed" );
		if ($ppool == "1") {
			pointspool ( $proclickearn );
		}
		if ($mpool == "1") {
			moneypool ( $proclickearn );
		}
		echo "<font color=blue><b>$proclickearn</b></font> credits have been added to your account";
	} elseif ($memtype == "JV Member") {
		assignpoints ( $userrecord ['referid'], $jvclickearn );
		$query5 = "update members set points=points+" . $jvclickearn . " where userid='" . dbput($userid) . "'";
		$result5 = mysql_query ( $query5 ) or die ( "Query failed" );
		if ($ppool == "1") {
			pointspool ( $jvclickearn );
		}
		if ($mpool == "1") {
			moneypool ( $jvclickearnearn );
		}
		echo "<font color=blue><b>$jvclickearn</b></font> credits have been added to your account";
	} else {
		assignpoints ( $userrecord ['referid'], $superjvclickearn );
		$query6 = "update members set points=points+" . $superjvclickearn . " where userid='" . dbput($userid) . "'";
		$result6 = mysql_query ( $query6 ) or die ( "Query 6 failed" );
		if ($ppool == "1") {
			pointspool ( $superjvclickearn );
		}
		if ($mpool == "1") {
			moneypool ( $superjvclickearn );
		}
		echo "<font color=blue><b>$superjvclickearn</b></font> credits have been added to your account";
	}
}

?>
<br>
<?
include ("banners2.php");
mysql_close ( $dblink );
?>
</center>

</body>
</html>
