<?php
session_start();
$adsessionid = 'cashsolos'.$_GET['adid'];
if($_SESSION['adclickid'] == $adsessionid){
	$_SESSION['adclickid'] = 'done';
}
include "config.php";

?>
<html>



<?
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>

<?
if (($_POST[x])&&(substr($_SESSION[igif], 16) === $_SESSION['afloat'])){
	// posted
	$x = $_POST[x];

	// decode, strip string and round numbers
	$a = base64_decode($_SESSION['afloat']);
	$b = 0 + $a;
	$a = explode(" ", $a);
	$a = $a[3];
	$bb = round($b);
	$aa = round($a);

	// x coords
	$gc = explode(" ", '0 19 40 60 82 104 79 100 121 142 163 185');

	// check if correct number has been clicked
	$ac = $aa + 6;
	$rightclick = false;
	if ($bb <= $aa){ $ac = $bb + 1; }
	$mess = "You clicked the wrong image.";
	// if correct number clicked success
	if (($x >= $gc[$ac-1]) && ($x <= $gc[$ac])){
		$rightclick = true;
	}
	$userid = $_GET['userid'];
	$adid = $_GET['adid'];
	$seed = $_GET['seed'];

	$query1 = "select * from cashclicks 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 cash for this link";
	}  //end if ($numrows1 ==1)
	else {
		if($rightclick == false){
			echo $mess;
			echo "<br><a href=\"cashsolos.php?userid=$userid&seed=$seed&id=$adid\" target=\"_top\">Click here</a> to reload it";
		}else{
			$query2 = "insert into cashclicks set userid='".dbput($userid)."', number='".dbput($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('cashsolo');

			if ($memtype == "PRO") {

				$query4 = "update members set commission=commission+".$procashsoloearn." where userid='".dbput($userid)."'";
				$result4 = mysql_query ($query4)
				or die ("Query failed");
				if ($ppool=="1") {
					$points = '1000';
					pointspool($points);
				}
				if ($mpool=="1") {
					moneypool($procashsoloearn);
				}

				echo "<font color=blue><b>$procashsoloearn</b></font> cash has been added to your commissions account!";
			}
			elseif ($memtype == "JV Member") {

				$query5 = "update members set commission=commission+".$jvcashsoloearn." where userid='".dbput($userid)."'";
				$result5 = mysql_query ($query5)
				or die ("Query failed");
				if ($ppool=="1") {
					$points = '1000';
					pointspool($points);
				}
				if ($mpool=="1") {
					moneypool($jvcashsoloearn);
				}
				echo "<font color=blue><b>$jvcashsoloearn</b></font> cash has been added to your commissions account!";
			} else {

				$query6 = "update members set commission=commission+".$superjvcashsoloearn." where userid='".dbput($userid)."'";
				$result6 = mysql_query ($query6)
				or die ("Query 6 failed");
				if ($ppool=="1") {
					$points = '1000';
					pointspool($points);
				}
				if ($mpool=="1") {
					moneypool($superjvcashsoloearn);
				}
				echo "<font color=blue><b>$superjvcashsoloearn</b></font> cash has been added to your commissions account!";
			}
		}
	}
}else{
	echo "<font color=red><b>Invalid Access</b>";
}

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

</body>
</html>
