Prosper202 : php if statement to filter click

monchi954

New member
Dec 29, 2008
108
2
0
Is it possible to add a php if statement to filter click

My problem is that I send the same traffic to another LP with another offer via email the same day, and the filter says its not a real click since its duplicate,

an this traffic for some reason records it self like 4-5 times for one click so I still want the filter to work.

is there an easy way for the filter to only filter by OFFER / LP variable ?

I am sure someone else had to come across this obstacle any suggestions ?
 


on 202-config/functions-tracking202.php

line 1298 - class filter

PHP:
class FILTER {
    
    function startFilter($click_id, $ip_id, $ip_address, $user_id) {
         
        //we only do the other checks, if the first ones have failed.
        //we will return the variable filter, if the $filter returns TRUE, when the click is inserted and recorded we will insert the new click already inserted,
        //what was lagign this query is before it would insert a click, then scan it and then update the click, the updating later on was lagging, now we will just insert and it will not stop the clicks from being redirected becuase of a slow update.
            
        //check the user
        $filter = FILTER::checkUserIP($click_id, $ip_id, $user_id);
        if ($filter == false) {
            
            //check the netrange  
            $filter = FILTER::checkNetrange($click_id, $ip_address);
            if ($filter == false) {  
            
                $filter = FILTER::checkLastIps($user_id, $ip_id);
                
                /*
                //check the configurations   
                $filter = FILTER::checkIPTiming($click_id, $ip_id, $user_id, $click_time, 1, 150); if ($filter == false) { 
                $filter = FILTER::checkIPTiming($click_id, $ip_id, $user_id, $click_time, 20, 3600); if ($filter == false) {  
                $filter = FILTER::checkIPTiming($click_id, $ip_id, $user_id, $click_time, 50, 86400); if ($filter == false) {  
                $filter = FILTER::checkIPTiming($click_id, $ip_id, $user_id, $click_time, 100, 2629743); if ($filter == false) {  
                $filter = FILTER::checkIPTiming($click_id, $ip_id, $user_id, $click_time, 1000, 7889231); if ($filter == false) {  
                }}}}}
                */
            }
        }
        
        if ($filter == true) { 
            return 1;    
        } else { 
            return 0;    
        }
    }
    
    function checkUserIP($click_id, $ip_id, $user_id) {
     
        $mysql['ip_id'] = mysql_real_escape_string($ip_id);      
        $mysql['user_id'] = mysql_real_escape_string($user_id);    
        
        $count_sql = "SELECT    COUNT(*) 
                      FROM      202_users 
                      WHERE     user_id='".$mysql['user_id']."' 
                      AND       user_last_login_ip_id='".$mysql['ip_id']."'";
        $count_result = _mysql_query($count_sql) ; //($count_sql);
    
        //if the click_id's ip address, is the same ip adddress of the click_id's owner's last logged in ip, filter this.  This means if the ip hit on the page was the same as the owner of the click affiliate program, we want to filter out the clicks by the owner when he/she  is trying to test 
        if (mysql_result($count_result,0,0) > 0) { 
            
            return true;  
        }
        return false;    
    }
    
    function checkNetrange($click_id, $ip_address) {
    
        $ip_address = ip2long($ip_address);
        
        //check each netrange
        /*google1 */ if (($ip_address >= 1208926208) and ($ip_address <= 1208942591)) { return true;  }
        /*MSN */ if (($ip_address >= 1093926912) and ($ip_address <= 1094189055)) { return true;  }
        /*google2 */ if (($ip_address >= 3512041472) and ($ip_address <= 3512074239)) { return true;  }
        /*Yahoo */ if (($ip_address >= 3640418304) and ($ip_address <= 3640426495)) { return true;  }
        /*google3 */ if (($ip_address >= 1123631104) and ($ip_address <= 1123639295)) { return true;  }
        /*level 3 communications */ if (($ip_address >= 1094189056) and ($ip_address <= 1094451199)) { return true;  }
        /*yahoo2 */ if (($ip_address >= 3515031552) and ($ip_address <= 3515039743)) { return true;  }
        /*Yahoo3 */ if (($ip_address >= 3633393664) and ($ip_address <= 3633397759)) { return true;  }
        /*Google5 */ if (($ip_address >= 1089052672) and ($ip_address <= 1089060863)) { return true;  }
        /*Yahoo */ if (($ip_address >= 1209925632) and ($ip_address <= 1209991167)) { return true;  }
        /*Yahoo */ if (($ip_address >= 1241907200) and ($ip_address <= 1241972735)) { return true;  }
        /*Performance Systems International Inc. */ if (($ip_address >= 637534208) and ($ip_address <= 654311423)) { return true;  }
        /*Microsoft */ if (($ip_address >= 3475898368) and ($ip_address <= 3475963903)) { return true;  }
        /*googleNew */ if (($ip_address >= -782925824) and ($ip_address <= -782893057)) { return true;  }
        
        //if it was none of theses, return false
        return false;           
    }  
    
    //this will filter out a click if it the IP WAS RECORDED, for a particular user within the last 24 hours, if it existed before, filter out this click.
    function checkLastIps($user_id, $ip_id) {

        $mysql['user_id'] = mysql_real_escape_string($user_id);
        $mysql['ip_id'] = mysql_real_escape_string($ip_id);
        
        $check_sql = "SELECT COUNT(*) AS count FROM 202_last_ips WHERE user_id='".$mysql['user_id']."' AND ip_id='".$mysql['ip_id']."'";
        $check_result = _mysql_query($check_sql) ; //($check_sql);
        $check_row = mysql_fetch_assoc($check_result);
        $count = $check_row['count'];
         
        if ($count > 0) {
            //if this ip has been seen within the last 24 hours, filter it out. 
            return true;
        } else {
            
            //else if this ip has not been recorded, record it now
            $mysql['time'] = time();
            $insert_sql = "INSERT INTO 202_last_ips SET user_id='".$mysql['user_id']."', ip_id='".$mysql['ip_id']."', time='".$mysql['time']."'";
            $insert_result = _mysql_query($insert_sql) ; //($insert_sql);
            return false;    
        }
        
    }
 
PHP:
class FILTER {
    
    function startFilter($click_id, $ip_id, $ip_address, $user_id) {
         
        //we only do the other checks, if the first ones have failed.
        //we will return the variable filter, if the $filter returns TRUE, when the click is inserted and recorded we will insert the new click already inserted,
        //what was lagign this query is before it would insert a click, then scan it and then update the click, the updating later on was lagging, now we will just insert and it will not stop the clicks from being redirected becuase of a slow update.
            
        //check the user
        $filter = FILTER::checkUserIP($click_id, $ip_id, $user_id);
        if ($filter == false) {
            
            //check the netrange  
            $filter = FILTER::checkNetrange($click_id, $ip_address);
            if ($filter == false) {  
            
                $filter = FILTER::checkLastIps($user_id, $ip_id);
                
                /*
                //check the configurations   
                $filter = FILTER::checkIPTiming($click_id, $ip_id, $user_id, $click_time, 1, 150); if ($filter == false) { 
                $filter = FILTER::checkIPTiming($click_id, $ip_id, $user_id, $click_time, 20, 3600); if ($filter == false) {  
                $filter = FILTER::checkIPTiming($click_id, $ip_id, $user_id, $click_time, 50, 86400); if ($filter == false) {  
                $filter = FILTER::checkIPTiming($click_id, $ip_id, $user_id, $click_time, 100, 2629743); if ($filter == false) {  
                $filter = FILTER::checkIPTiming($click_id, $ip_id, $user_id, $click_time, 1000, 7889231); if ($filter == false) {  
                }}}}}
                */
            }
        }
        
        if ($filter == true) { 
            return 1;    
        } else { 
            return 0;    
        }
    }
    
    function checkUserIP($click_id, $ip_id, $user_id) {
     
        $mysql['ip_id'] = mysql_real_escape_string($ip_id);      
        $mysql['user_id'] = mysql_real_escape_string($user_id);    
        
        $count_sql = "SELECT    COUNT(*) 
                      FROM      202_users 
                      WHERE     user_id='".$mysql['user_id']."' 
                      AND       user_last_login_ip_id='".$mysql['ip_id']."'";
        $count_result = _mysql_query($count_sql) ; //($count_sql);
    
        //if the click_id's ip address, is the same ip adddress of the click_id's owner's last logged in ip, filter this.  This means if the ip hit on the page was the same as the owner of the click affiliate program, we want to filter out the clicks by the owner when he/she  is trying to test 
        if (mysql_result($count_result,0,0) > 0) { 
            
            return true;  
        }
        return false;    
    }
    
    function checkNetrange($click_id, $ip_address) {
    
        $ip_address = ip2long($ip_address);
        
        //check each netrange
        /*google1 */ if (($ip_address >= 1208926208) and ($ip_address <= 1208942591)) { return true;  }
        /*MSN */ if (($ip_address >= 1093926912) and ($ip_address <= 1094189055)) { return true;  }
        /*google2 */ if (($ip_address >= 3512041472) and ($ip_address <= 3512074239)) { return true;  }
        /*Yahoo */ if (($ip_address >= 3640418304) and ($ip_address <= 3640426495)) { return true;  }
        /*google3 */ if (($ip_address >= 1123631104) and ($ip_address <= 1123639295)) { return true;  }
        /*level 3 communications */ if (($ip_address >= 1094189056) and ($ip_address <= 1094451199)) { return true;  }
        /*yahoo2 */ if (($ip_address >= 3515031552) and ($ip_address <= 3515039743)) { return true;  }
        /*Yahoo3 */ if (($ip_address >= 3633393664) and ($ip_address <= 3633397759)) { return true;  }
        /*Google5 */ if (($ip_address >= 1089052672) and ($ip_address <= 1089060863)) { return true;  }
        /*Yahoo */ if (($ip_address >= 1209925632) and ($ip_address <= 1209991167)) { return true;  }
        /*Yahoo */ if (($ip_address >= 1241907200) and ($ip_address <= 1241972735)) { return true;  }
        /*Performance Systems International Inc. */ if (($ip_address >= 637534208) and ($ip_address <= 654311423)) { return true;  }
        /*Microsoft */ if (($ip_address >= 3475898368) and ($ip_address <= 3475963903)) { return true;  }
        /*googleNew */ if (($ip_address >= -782925824) and ($ip_address <= -782893057)) { return true;  }
        
        //if it was none of theses, return false
        return false;           
    }  
    
    //this will filter out a click if it the IP WAS RECORDED, for a particular user within the last 24 hours, if it existed before, filter out this click.
    function checkLastIps($user_id, $ip_id) {

        $mysql['user_id'] = mysql_real_escape_string($user_id);
        $mysql['ip_id'] = mysql_real_escape_string($ip_id);
        
        $check_sql = "SELECT COUNT(*) AS count FROM 202_last_ips WHERE user_id='".$mysql['user_id']."' AND ip_id='".$mysql['ip_id']."'";
        $check_result = _mysql_query($check_sql) ; //($check_sql);
        $check_row = mysql_fetch_assoc($check_result);
        $count = $check_row['count'];
         
/*
        if ($count > 0) {
            //if this ip has been seen within the last 24 hours, filter it out. 
            return true;
        } else {
*/            
            //else if this ip has not been recorded, record it now
            $mysql['time'] = time();
            $insert_sql = "INSERT INTO 202_last_ips SET user_id='".$mysql['user_id']."', ip_id='".$mysql['ip_id']."', time='".$mysql['time']."'";
            $insert_result = _mysql_query($insert_sql) ; //($insert_sql);
            return false;    
//        }
        
    }

try that
 
Thanks I been testing the code and now it did keep the clicks as real inbetween the two LP but now its not filtering if that click comes back to that same page, but when I try it with my IP address it does filter me.

Maybe because my IP was filtered before the change,