// BEGIN SEND to ClickThrusPHPBay database $recordurl = 'http://www.qct.fht001.net/RecordPHPBayClicks.php'; $QCTUsername = 'freetech'; $QCTPassword = 'jmc496871'; if ( isset($_SERVER['HTTP_HOST']) ) { $thehost = strtolower(str_replace('http://','',$_SERVER['HTTP_HOST'])); $thehost = str_replace('www.','',$thehost); } else { $thehost = ''; } $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''; $useragent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; $thedbreferer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; if(isset($ktv["title"])) { $thecountry = isset($rover["abbr"]) ? $rover["abbr"] : ''; $theitemtitle = isset($ktv["title"]) ? $ktv["title"] : ''; $fields = array( 'Site'=>urlencode($thehost), 'CampID'=>urlencode($ktv["pid"]), 'CustomID'=>urlencode($ktv["cid"]), 'ItemNum'=>urlencode($ktv["item"]), 'IP'=>urlencode($ip), 'Referer'=>urlencode($thedbreferer), 'UserAgent'=>urlencode($useragent), 'theurl'=>urlencode($url), 'thecountry'=>urlencode($thecountry), 'theitemtitle'=>urlencode($theitemtitle), ); } else { $thecountry = $pb_request["country"]; $theitemtitle = $pb_request["title"]; $fields = array( 'Site'=>urlencode($thehost), 'CampID'=>urlencode($pb_request["campaignid"]), 'CustomID'=>urlencode($pb_request["customid"]), 'ItemNum'=>urlencode($pb_request["item"]), 'IP'=>urlencode($ip), 'Referer'=>urlencode($thedbreferer), 'UserAgent'=>urlencode($useragent), 'theurl'=>urlencode($url), 'thecountry'=>urlencode($thecountry), 'theitemtitle'=>urlencode($theitemtitle), ); } $fields_string = array(); foreach($fields as $key=>$value) { $fields_string[] = $key.'='.$value; } $fields_string = implode('&',$fields_string); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$recordurl); if ( strlen($QCTUsername) > 0 && strlen($QCTPassword) > 0 ) { curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_USERPWD, "$QCTUsername:$QCTPassword"); } curl_setopt($ch,CURLOPT_POST,count($fields)); curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string); $result = curl_exec($ch); curl_close($ch); // END SEND to ClickThrusPHPBay database