PHP Classes

Octets check question

Recommend this page to a friend!

      DNSBL  >  All threads  >  Octets check question  >  (Un) Subscribe thread alerts  
Subject:Octets check question
Summary:Checking the array of octets for IP ranges
Messages:3
Author:Moore
Date:2011-06-23 02:50:17
Update:2013-11-12 18:26:26
 

  1. Octets check question   Reply   Report abuse  
Picture of Moore Moore - 2011-06-23 02:50:17
Hi Alexey, thanks for the great class.

Just one question about checking the octets of the IP addresses.

When testing for the 192.168 and 169.254 ranges, I noticed that it only checks the 1st octet ($octets[0]) for both the first and second octet of the IP address.

if($octets[0] == '192' && $octets[0] == '168') return false;
if($octets[0] == '169' && $octets[0] == '254') return false;

Should it be checking for the second octet ($octets[1]) like this instead ?

if($octets[0] == '192' && $octets[1] == '168') return false;
if($octets[0] == '169' && $octets[1] == '254') return false;



  2. Re: Octets   Reply   Report abuse  
Picture of Moore Moore - 2011-07-07 01:13:12 - In reply to message 1 from Moore

On line 58-59 of DNSBL.php

if($octets[0] == '192' && $octets[0] == '168')
if($octets[0] == '169' && $octets[0] == '254')

or :

if($octets[0] == '192' && $octets[1] == '168')
if($octets[0] == '169' && $octets[1] == '254')

yes or no ?

  3. Re: Octets check question   Reply   Report abuse  
Picture of Moore Moore - 2013-11-12 18:26:26 - In reply to message 1 from Moore
Ok so you just don't care if your code has bugs... ??