$mysql['user_id'] = 1; //see if it has the cookie, do whatever we can to grab to grab SOMETHING to tie this lead to if ($_COOKIE['tracking202subid']) { $mysql['click_id'] = mysql_real_escape_string($_COOKIE['tracking202subid']); } else { //ok grab the last click from this ip_id $mysql['ip_address'] = mysql_real_escape_string($_SERVER['REMOTE_ADDR']); $daysago = time() - 2592000; // 30 days ago $click_sql1 = "\tSELECT \t202_clicks.click_id \n\t\t\t\t\tFROM \t\t202_clicks\n\t\t\t\t\tLEFT JOIN\t202_clicks_advance USING (click_id)\n\t\t\t\t\tLEFT JOIN \t202_ips USING (ip_id) \n\t\t\t\t\tWHERE \t202_ips.ip_address='" . $mysql['ip_address'] . "'\n\t\t\t\t\tAND\t\t202_clicks.user_id='" . $mysql['user_id'] . "' \n\t\t\t\t\tAND\t\t202_clicks.click_time >= '" . $daysago . "'\n\t\t\t\t\tORDER BY \t202_clicks.click_id DESC \n\t\t\t\t\tLIMIT \t\t1"; $click_result1 = mysql_query($click_sql1) or record_mysql_error($click_sql1); $click_row1 = mysql_fetch_assoc($click_result1); $mysql['click_id'] = mysql_real_escape_string($click_row1['click_id']); } if ($mysql['click_id']) { if ($_GET['amount']) { $mysql['click_payout'] = mysql_real_escape_string($_GET['amount']); } $click_sql = "\tUPDATE \t\t\t\t\t202_clicks \n\t\t\t\t\tSET \t\t\t\t\t\tclick_lead='1', \n\t\t\t\t\t\t\t\t\t\t\t\tclick_filtered='0' "; if ($mysql['click_payout']) { $click_sql .= " , \tclick_payout='" . $mysql['click_payout'] . "' "; } $click_sql .= "\tWHERE \tclick_id='" . $mysql['click_id'] . "' "; delay_sql($click_sql); $click_sql = "\tUPDATE \t\t\t\t\t202_clicks_spy \n\t\t\t\t\tSET \t\t\t\t\t\tclick_lead='1', \n\t\t\t\t\t\t\t\t\t\t\t\tclick_filtered='0' "; if ($mysql['click_payout']) { $click_sql .= " , \tclick_payout='" . $mysql['click_payout'] . "' "; } $click_sql .= "\tWHERE \tclick_id='" . $mysql['click_id'] . "' "; delay_sql($click_sql); }
$cloaking_on = true; $mysql['click_cloaking'] = 1; //if cloaking is on, add in a click_id_public, because we will be forwarding them to a cloaked /cl/xxxx link $click_id_public = rand(1, 9) . $click_id . rand(1, 9); $mysql['click_id_public'] = $db->real_escape_string($click_id_public); } else { $mysql['click_cloaking'] = 0; } if ($cloaking_on == true) { $cloaking_site_url = 'http://' . $_SERVER['SERVER_NAME'] . '/tracking202/redirect/lpc.php?lpip=' . $tracker_row['landing_page_id_public']; $click_cloaking_site_url_id = INDEXES::get_site_url_id($db, $cloaking_site_url); $mysql['click_cloaking_site_url_id'] = $db->real_escape_string($click_cloaking_site_url_id); } $redirect_site_url = rotateTrackerUrl($db, $tracker_row); $click_id = $_COOKIE['tracking202subid_a_' . $tracker_row['aff_campaign_id']]; $mysql['click_id'] = $db->real_escape_string($click_id); $mysql['click_out'] = 1; $update_sql = "\n\tUPDATE\n\t\t202_clicks_record\n\tSET\n\t\tclick_out='" . $mysql['click_out'] . "',\n\t\tclick_cloaking='" . $mysql['click_cloaking'] . "'\n\tWHERE\n\t\tclick_id='" . $mysql['click_id'] . "'"; delay_sql($db, $update_sql); $redirect_site_url = replaceTrackerPlaceholders($db, $redirect_site_url, $mysql['click_id']); $click_redirect_site_url_id = INDEXES::get_site_url_id($db, $redirect_site_url); $mysql['click_redirect_site_url_id'] = $db->real_escape_string($click_redirect_site_url_id); //get and prep extra stuff for pre-pop or data passing $urlvars = getPrePopVars($vars); if ($cloaking_on == true) { //if cloaked, redirect them to the cloaked site. header('location: ' . setPrePopVars($urlvars, $cloaking_site_url, true)); } else { header('location: ' . setPrePopVars($urlvars, $redirect_site_url, false)); } die;
if ($_COOKIE['tracking202subid']) { $mysql['click_id'] = $db->real_escape_string($_COOKIE['tracking202subid']); } else { //ok grab the last click from this ip_id $mysql['ip_address'] = $db->real_escape_string($_SERVER['REMOTE_ADDR']); $daysago = time() - 2592000; // 30 days ago $click_sql1 = "\tSELECT \t202_clicks.click_id \n\t\t\t\t\tFROM \t\t202_clicks\n\t\t\t\t\tLEFT JOIN\t202_clicks_advance USING (click_id)\n\t\t\t\t\tLEFT JOIN \t202_ips USING (ip_id) \n\t\t\t\t\tWHERE \t202_ips.ip_address='" . $mysql['ip_address'] . "'\n\t\t\t\t\tAND\t\t202_clicks.user_id='" . $mysql['user_id'] . "' \n\t\t\t\t\tAND\t\t202_clicks.click_time >= '" . $daysago . "'\n\t\t\t\t\tORDER BY \t202_clicks.click_id DESC \n\t\t\t\t\tLIMIT \t\t1"; $click_result1 = $db->query($click_sql1) or record_mysql_error($click_sql1); $click_row1 = $click_result1->fetch_assoc(); $mysql['click_id'] = $db->real_escape_string($click_row1['click_id']); } } if (is_numeric($mysql['click_id'])) { if ($_GET['amount'] && is_numeric($_GET['amount'])) { $mysql['use_pixel_payout'] = 1; $mysql['click_payout'] = $db->real_escape_string($_GET['amount']); } $click_sql = "\n\t\tUPDATE\n\t\t\t202_clicks \n\t\tSET\n\t\t\tclick_lead='1', \n\t\t\tclick_filtered='0'\n\t"; if ($mysql['use_pixel_payout'] == 1) { $click_sql .= "\n\t\t\t, click_payout='" . $mysql['click_payout'] . "'\n\t\t"; } $click_sql .= "\n\t\tWHERE\n\t\t\tclick_id='" . $mysql['click_id'] . "'\n\t"; delay_sql($db, $click_sql); $click_sql = "\n\t\tUPDATE\n\t\t\t202_clicks_spy \n\t\tSET\n\t\t\tclick_lead='1',\n\t\t\tclick_filtered='0'\n\t"; if ($mysql['use_pixel_payout'] == 1) { $click_sql .= "\n\t\t\t, click_payout='" . $mysql['click_payout'] . "'\n\t\t"; } $click_sql .= "\n\t\tWHERE\n\t\t\tclick_id='" . $mysql['click_id'] . "'\n\t"; delay_sql($db, $click_sql); }
// click_cloaking_site_url_id='".$mysql['click_cloaking_site_url_id']."', // click_redirect_site_url_id='".$mysql['click_redirect_site_url_id']."'"; $outbound_site_url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; $click_outbound_site_url_id = INDEXES::get_site_url_id($outbound_site_url); $mysql['click_outbound_site_url_id'] = mysql_real_escape_string($click_outbound_site_url_id); if ($cloaking_on == true) { $cloaking_site_url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; $click_cloaking_site_url_id = INDEXES::get_site_url_id($cloaking_site_url); $mysql['click_cloaking_site_url_id'] = mysql_real_escape_string($click_cloaking_site_url_id); } $url = rotateTrackerUrl($info_row); $redirect_site_url = $url . $info_row['click_id']; $click_redirect_site_url_id = INDEXES::get_site_url_id($redirect_site_url); $mysql['click_redirect_site_url_id'] = mysql_real_escape_string($click_redirect_site_url_id); $update_sql = "UPDATE \t202_clicks_site\n\t\t\t\tSET\t\t\tclick_outbound_site_url_id='" . $mysql['click_outbound_site_url_id'] . "',\n\t\t\t\t\t\t\tclick_cloaking_site_url_id='" . $mysql['click_cloaking_site_url_id'] . "',\n\t\t\t\t\t\t\tclick_redirect_site_url_id='" . $mysql['click_redirect_site_url_id'] . "'\n\t\t\t\tWHERE\t\tclick_id='" . $mysql['click_id'] . "'"; delay_sql($update_sql); //alright now the updates, //WE WANT TO DELAY THESES UPDATES, in a MYSQL DATBASES? Or else the UPDATES lag the server, the UPDATES have to wait until it locks to update the server //so what happens is if there not delayed, if someone is pulling MASSIVE queries on the website, it'll wait till they load before our update runs, //and that means if this update wasn't delayed it'd wait untill their queries were done on the site before moving forward. Massive slowness, so we update delays theses in cronjobs a at a lter time. //ADD TO CLICK SUMMARY TABLE? //update the click summary table if this is a 'real click' if ($info_row['click_filtered'] == 0) { $mysql['landing_page_id'] = mysql_real_escape_string($info_row['landing_page_id']); $mysql['user_id'] = mysql_real_escape_string($info_row['user_id']); //set timezone correctly $user_sql = "SELECT user_timezone FROM 202_users WHERE user_id='" . $mysql['user_id'] . "'"; $user_row = memcache_mysql_fetch_assoc($user_sql); AUTH::set_timezone($user_row['user_timezone']); $now = time(); $today_day = date('j', time());