<?php
session_start ();
include "config.php";
$adsessionid = 'adminclicks' . $_GET ['adid'];
if ($_SESSION ['adclickid'] != $adsessionid) {
	echo "<font size='2' face='$fonttype' color='red'><p><b><center>Only one ad at a time please..</p></b></font><center>";
	exit ();
}
?>
<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 adminclicks 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 adminclicks set userid='" . dbput($userid) . "', number='" . dbput($seed) . "', adid='" . dbput($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 = dbget($userrecord ["memtype"]);
	
	if ($memtype == "PRO") {
		$earn = $adminproclickearn;
		assignpoints ( $userrecord ['referid'], $earn );
	
	} elseif ($memtype == "JV Member") {
		
		$earn = $adminjvclickearn;
		assignpoints ( $userrecord ['referid'], $earn );
	
	} 

	elseif ($memtype == "SUPER JV") {
		
		$earn = $adminsuperjvclickearn;
		assignpoints ( $userrecord ['referid'], $earn );
	
	}
	
	$queryaddpoints = "update members set points=points+" . $earn . " where userid='" . dbput($userid) . "'";
	$resultaddpoints = mysql_query ( $queryaddpoints );
	if ($ppool == "1") {
		pointspool ( $earn );
	}
	if ($mpool == "1") {
		moneypool ( $earn );
	}
	
	echo "<font color=BLACK>You have earned <font color=BLUE><b>$earn</b></font> points.</font>&nbsp;&nbsp;";

}

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

</body>
</html>
