Jump to content

PHP Simple


phaedo5

Recommended Posts

Ok, this sort of seems simple, but it's giving me difficulty.

 

I have a statement like this:

 

if(preg_match('/whatever/', gethostbyaddr($_SERVER['REMOTE_ADDR'])) {

    $variable = true;

}

 

if(!$variable) {

  then do something

}

 

Is this not acceptable code?  It seems to work, sometimes.  Every once in a while a domain of 'whatver.com' will slip through and trigger my if statement.  It seems to work quite a bit though.  So I'm confused. 

 

I just want to know if I'm doing something that is 'not best practice' or if I'm even completely wrong. 

Any help would be great. 

Sorry it's sort of newb material.

 

 

Link to comment
https://forums.phpfreaks.com/topic/115466-php-simple/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.