<?
session_start();
include "../config.php";
$adsessionid = 'ptcadclick'.$_GET['id'];
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;	
}

$id = $_GET['id'];

$query = "select * from ptcads where id = '".dbput($id)."' LIMIT 1";
$result = mysql_query ($query)
           		or die ("Query failed");
$numrows = @ mysql_num_rows($result);
?>
<html>
<body background="../images/Back-4.gif">

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

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

<?
}
?>

<center>
<?
if ($numrows == 1) {

    $query1 = "select * from ptcadviews where userid='".$userid."' and tlid=".$id;
    $result1 = mysql_query ($query1)
            		or die ("Query failed");
	$numrows1 = @ mysql_num_rows($result1);

    if ($numrows1 == 0) {
                   
				if ($memtype=="PRO") {
					$earn = $proptcearn;
				}
				elseif ($memtype=="JV Member"){
					$earn = $jvptcearn;
				}
				elseif ($memtype=="SUPER JV"){
				$earn = $superjvptcearn;
				}					
				

		      $query2 = "insert into ptcadviews set userid='".$userid."', tlid=".$id;
		      $result2 = mysql_query ($query2) or die ("Query failed");
			  
			  
				  
	  
			  $query4 = "update members set commission=commission+".$earn." where userid='".$userid."'";
              $result4 = mysql_query ($query4) or die ("Query failed");
                        if ($ppool=="1") {
                                            $points = '1000';
                                            pointspool($points);
                                                 }
                                if ($mpool=="1") {
                                            moneypool($earn);
                                                 }
			add_adclick('ptc');	
				
				echo "You have earned <font color=blue><b>$earn</b></font> cash commissions";
			
			} else echo "You have already received cash for this ad";
			
		
	} else echo "Invalid link";
	
	
?>
<br>

<?

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

</body>
</html>