RE: [PHP] Problems with pattern matching

From: Date: Sat, 21 Apr 2001 02:16:25 +0000
Subject: RE: [PHP] Problems with pattern matching
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-49629@lists.php.net to get a copy of this message
i got the echo of "AOHell user" to appear with this... i'd look at what remote addr returns and check and see if that works with your regexp....... jack $hostname = "www.aol.com"; if (eregi(".*\.aol\.com.*", $hostname)) { echo $hostname; echo "AOHell user"; } else { echo $hostname; echo "Not on AOHell"; } -----Original Message----- From: Alec Smith [mailto:alec@shadowstar.net] Sent: Friday, April 20, 2001 9:15 PM To: php-general@lists.php.net Subject: [PHP] Problems with pattern matching I'm attempting to get something like the following to match anything from aol.com so that I can handle AOL users differently than users from other ISPs: $hostname = gethostbyaddr($REMOTE_ADDR); if (eregi(".*\.aol\.com.*", $hostname)) { echo $hostname; echo "AOHell user"; } else { echo $hostname; echo "Not on AOHell"; } However, the else condition is always the one which is always executed. Any ideas why? I'll admit to being somewhat weak when it comes to regular expressions. Thanks, Alec -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#49629) next »