OMG - Spam on my new site

Discussion in 'General Casino Affiliate Area' started by Danny, May 21, 2008.

  1.  
    Danny

    Danny Affiliate Guard Dog Member

    Messages:
    45
    Likes Received:
    0
    Joined:
    May 8, 2008
    My is not even index by google and I got so much spam already. I check my comment table and I saw that their ip_numbers (not ip_address) are 0s (zero).

    I used ip2long to convert the ip_address to ip_number {ip2long($_SERVER['REMOTE_ADDR'])}.

    How come their IPs are 0s?



    Code:
    Hi everyone. Great site. Hold on.
    cosmetics cosmetics cosmetics cosmetics cosmetics cosmetics cosmetics cosmetics 
    [url=http://cosmetics]cPanel®[/url][url=http://cosmetics]cPanel®[/url][url=http://cosmetics]cPanel®[/url][url=http://cosmetics]cPanel®[/url][url=http://cosmetics]cPanel®[/url][url=http://cosmetics]cPanel®[/url][url=http://cosmetics]cPanel®[/url][url=http://cosmetics]cPanel®[/url][url=http://cosmetics]cPanel®[/url][url=http://cosmetics]cPanel®[/url] 
    
     
    Last edited: May 21, 2008
  2.  
    Guard Dog

    Guard Dog Guard Dog Staff Member

    Messages:
    7,727
    Likes Received:
    1,152
    Joined:
    Dec 13, 2006
    I am not sure why you would want to convert the IP address to a long data type? Wouldn't you want to see it as xxx.xxx.xxx.xxx?

    Regardless, the following should work


    PHP:
    $referrer_ip getenv(REMOTE_ADDR); 
    $ip_address =ip2long($ip);
    Or, if you are on versions of php earlier than 5.0:

    PHP:
    $remote_ip getenv(REMOTE_ADDR); 
    $ip_extract explode (".",$remote_ip);
    $code=($ip_extract[0] * 16777216) + ($ip_extract[1] * 65536) + ($ip_extract[2] * 256) + ($ip_extract[3]);

    If you want to see it as xxx.xxx.xxx.xxx, then:

    PHP:
    $referrer_ip getenv(REMOTE_ADDR); 

    If you want to grab each octet of the IP address:

    PHP:
     $remote_ip getenv(REMOTE_ADDR); 
    $ip_extract explode (".",$remote_ip);


    $octet1 $ip_extract[0];
    $octet2 $ip_extract[2];
    $octet3 $ip_extract[3];
    $octet4 $ip_extract[4];

    I hope that helps :)
     
  3.  
    Danny

    Danny Affiliate Guard Dog Member

    Messages:
    45
    Likes Received:
    0
    Joined:
    May 8, 2008
    The reason I am using ip2long is because I implemented maxmind ip-country database on my system.

    maxmind using ip number instead of ip address. So I like to use ip number as well for the ease and robustness of comparison.

    There shouldn't be any problem as my server uses the latest version of PHP. But, I'll try your method.

    I also need to implement captcha to minimize the spamming. :)
     
  4.  
    Guard Dog

    Guard Dog Guard Dog Staff Member

    Messages:
    7,727
    Likes Received:
    1,152
    Joined:
    Dec 13, 2006

    I don't know why it wouldn't work, then... I would do an echo of the 'REMOTE_ADDR', then, to see if the problem starts there. There is a breakdown somewhere and it is either in the function or in the IP address itself.
     
  5.  
    Danny

    Danny Affiliate Guard Dog Member

    Messages:
    45
    Likes Received:
    0
    Joined:
    May 8, 2008
    Look, my ip address/number is shown correctly. I even try different IPs. I don't know why their ips doesn't shown!
     
  6.  
    Guard Dog

    Guard Dog Guard Dog Staff Member

    Messages:
    7,727
    Likes Received:
    1,152
    Joined:
    Dec 13, 2006
    Here's a little function I found that might help you out:

    PHP:
    function GetIP()
    {
       if (
    getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown"))
               
    $ip getenv("HTTP_CLIENT_IP");
           else if (
    getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown"))
               
    $ip getenv("HTTP_X_FORWARDED_FOR");
           else if (
    getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown"))
               
    $ip getenv("REMOTE_ADDR");
    else if (isset(
    $_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown"))
               
    $ip $_SERVER['REMOTE_ADDR'];
           else
               
    $ip "unknown";
       return(
    $ip);
    }
    Now use the GetIP() function to return the IP and then convert it to a long data type.
     
  7.  
    bonustreak

    bonustreak Administrator Staff Member

    Messages:
    3,887
    Likes Received:
    346
    Joined:
    Dec 15, 2006

Share This Page