faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

13 of 14 people (93%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

how can I redirect a user with wildcards like 213.* or hostname like *.isp.net

Feb 24th, 2008 00:15
dman, William Steve Applegate, joachim molund, http://www.ttnr.org


Use regular expressions, like this :
if (ereg("^213\..*", $REMOTE_ADDR)) {
	header("Location: http://redirectpage.tld/");
	exit;
}
if (ereg(".*\.isp\.net$", gethostbyaddr($REMOTE_ADDR))) {
	header("Location: http://redirectpage.tld/");
	exit;
}