Page 1 of 1

Disable LEAD export from Public IP

PostPosted: Mon Feb 25, 2013 5:16 am
by gmcust3
How to Disable LEAD export from Public IP ??

Re: Disable LEAD export from Public IP

PostPosted: Mon Feb 25, 2013 10:40 am
by williamconley
Which version of GoAutoCE did you install with? There are two versions available: CE 2.0 and CE 2.1.

list_download.php

Modify this file and place an if/else statement in the php code where the final download statement is and check to see if the IP is local before allowing the actual download to begin. :)

Re: Disable LEAD export from Public IP

PostPosted: Mon Feb 25, 2013 10:43 am
by gmcust3
Any Code Help ? :roll:

Re: Disable LEAD export from Public IP

PostPosted: Mon Feb 25, 2013 1:09 pm
by williamconley
Sure. Find the final export and post it and I'll generate an if statement for you :)

Re: Disable LEAD export from Public IP

PostPosted: Wed Feb 27, 2013 1:46 am
by gmcust3
Code: Select all
function ip_is_private($ip)
{
        $pri_addrs = array(
                          '10.0.0.0|10.255.255.255',
                          '172.16.0.0|172.31.255.255',
                          '192.168.0.0|192.168.255.255',
                          '169.254.0.0|169.254.255.255',
                          '127.0.0.0|127.255.255.255'
                         );

        $long_ip = ip2long($ip);
        if($long_ip != -1) {

            foreach($pri_addrs AS $pri_addr)
            {
                list($start, $end) = explode('|', $pri_addr);

                 // IF IS PRIVATE
                 if($long_ip >= ip2long($start) && $long_ip <= ip2long($end))
                 return (TRUE);
            }
    }

return (FALSE);
}


Code: Select all
if ( ip_is_private ( $ip_address1 ) )
{
    printf ( "%s is from a private address range\n", $ip_address1 );
}
else
{
    printf ( "%s is *NOT* from a private address range\n", $ip_address1 );
}



Above code will help ???

Re: Disable LEAD export from Public IP

PostPosted: Wed Feb 27, 2013 11:37 am
by williamconley
Excellent. Now we just need the location to use the function and we're on! :)

Re: Disable LEAD export from Public IP

PostPosted: Thu Feb 28, 2013 2:56 am
by gmcust3
Code: Select all
if ($lists_allowed < 1)
      {
      echo "You are not allowed to download this list: $list_id\n";
      exit;
      }


I see there are so many like these... Need to Put below lines just below above codes ?

Code: Select all

if ( ip_is_private IS NOT ( $ip_address1 ) )
{
   echo "You are not allowed to download this list: $list_id\n";
   exit;
}


Re: Disable LEAD export from Public IP

PostPosted: Thu Feb 28, 2013 10:14 am
by williamconley
In that case, you could find where "$lists_allowed" is defined, and add another method to make lists_allowed = 0. Then the lists allowed check above will work for you and you're done.

Re: Disable LEAD export from Public IP

PostPosted: Wed Mar 13, 2013 2:36 am
by gmcust3
I see two entries :

if ($lists_allowed < 1)
and
$lists_allowed =$row[0];

Re: Disable LEAD export from Public IP

PostPosted: Wed Mar 13, 2013 1:44 pm
by williamconley
instead of $lists_allowed =$row[0]; change it to $lists_allowed =0;

that will disable ALL ips. you'll need to modify it to detect local ips to allow them (or perhaps a specific IP and allow that one).

Re: Disable LEAD export from Public IP

PostPosted: Thu Mar 14, 2013 1:30 am
by gmcust3
:)

Back to square , How to "you'll need to modify it to detect local ips to allow them" ?

Re: Disable LEAD export from Public IP

PostPosted: Thu Mar 14, 2013 7:59 am
by williamconley
well that would depend on your local ip definition. look up the php code to grab the ip of the user, and compare the first X digits to a string with your local subnet on it ... if they match, leave this code alone. if they do not, however, force the lists allowed to "0".