|
? include("common.php"); $link = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Could not connect: " . mysql_error()); mysql_select_db($dbname); $sSQL="select s_URL, n_UserID, n_ExpireViews, n_ExpireClicks, b_Paid from t_Banners where n_ID=".stripjunk($targetid); $results=mysql_query($sSQL); list($s_URL, $n_UserID, $n_ExpireViews, $n_ExpireClicks, $b_Paid)=mysql_fetch_row($results); if($b_Paid==1 && $n_ExpireClicks>0 && $n_ExpireViews==0) { $sSQL="update t_Banners set n_ExpireClicks=n_ExpireClicks-1 where n_ID=".stripjunk($targetid); mysql_query($sSQL); if ($n_ExpireClicks==1) { $sSQL="select * from t_Banners where n_UserID=".stripjunk($n_UserID)." and (b_Authorised>0 and b_Paid<>1) or (b_Paid=1 and (n_ExpireViews>0 or n_ExpireClicks>0))"; $results=mysql_query($sSQL); if(mysql_num_rows($results)==0) { $sSQL="update t_Users set b_Authedban=0 where n_ID=".stripjunk($n_UserID); mysql_query($sSQL); } } } $sSQL="update t_Banners set n_Clicks=n_Clicks+1 where n_ID=".stripjunk($targetid); mysql_query($sSQL); $sSQL="update t_Users set n_Clicks=n_Clicks+1 where n_ID=".stripjunk($hostid); mysql_query($sSQL); mysql_close(); header("Location: ".stripjunk($s_URL)); ?>
|
|