connect($DBHost, $DBDatabase, $DBUser, $DBPassword); include("./includes/functions.php"); require("./includes/globals.php"); include("./includes/sessions.php"); function error($error) { global $Db1, $settings; include("./source/clicking/error.php"); $Db1->sql_close(); exit; } if(!is_numeric($_GET['id']) && $s!="1") { logError("Ad ID specified not a number: $id"); error("Invalid ad ID. This incident has been logged."); } define("IN_CLICKING",true); $pretime = intval($_GET['pretime']); $id = intval($_GET['id']); $type = $_GET['type']; $v = $_GET['v']; $s = $_GET['s']; if($userid != "") {$uid=$_GET['userid'];} $url_variables= iif($sid, "sid=".$sid."&"). iif($sid2, "sid2=".$sid2."&"). iif($s, "s=$s&"). iif($type, "type=$type&"). iif($siduid, "siduid=".$siduid."&"); $adTables = array( "ptc"=>"ads", "ptre"=>"emails", "ptra"=>"ptrads", "ce"=>"xsites" ); $viewable = array( "entry"=>"entry", "timer"=>"timer", "verify"=>"verifyClick", "read"=>"read", "cheat"=>"cheat", "report"=>"report", "outside"=>"outside" ); if($type == "ptre") { $thismemberinfo = $Db1->query_first("SELECT * FROM user WHERE username='".mysql_real_escape_string($_GET["user"])."' LIMIT 1"); $username = $thismemberinfo[username]; $url_variables.="user={$username}&"; /* if(isset($_GET['user'])) { $username = $_GET['user']; }*/ } /*if(findclick($preclicked[clicks], $id) == 1) { $includes[content]= "You Have Already Clicked This Link Today"; }*/ /* // removed this query due to excessive load from cross-referencing $id = $Db1->querySingle("SELECT id FROM ".$adTables[$type]." WHERE NOT EXISTS (SELECT * FROM click_history WHERE click_history.type='{$type}' AND click_history.username='{$username}' AND click_history.ad_id=".$adTables[$type].".id) and credits>=1 and active='1' and (country='' or country='{$thismemberinfo[country]}') and (daily_limit>views_today or daily_limit=0) and (upgrade='0' ".($thismemberinfo[type]==1?" or upgrade='1'":"").") LIMIT 1 ","id"); */ $clickHistory = loadClickHistory($username, $type); $clickVerified = false; if($s == 1 && $v == "entry") { $id = false; $sql = $Db1->query("SELECT id FROM ".$adTables[$type]." WHERE credits>=1 and active='1' and (country='' or country='{$thismemberinfo[country]}') and (daily_limit>views_today or daily_limit=0) and (upgrade='0' ".($thismemberinfo[type]==1?" or upgrade='1'":"").") "); while($temp = $Db1->fetch_array($sql) and $id == false) { if(findclick($clickHistory, $temp['id']) != 1) { $id = $temp['id']; $clickVerified = true; } } if($id == false) { $Db1->sql_close(); header("Location: index.php?view=account&ac=earn&{$url_variables}"); exit; } } if(!$viewable[$v]) error("There was a problem loading files."); if(!isset($id)) error("There was a problem finding the ad!"); if(!$type) error("No ad type specified!"); include("./source/clicking/{$viewable[$v]}.php"); $Db1->sql_close(); ?>