...

View Full Version : Domain Name/URL extract



Zeeshan Arshad
09-24-2005, 09:49 PM
Hello Dear Friends,

I'm facing a problem with PHP programming to complete my email application.

I want visitors to be restricted to use my email form via various locations.

i.e, I want to ALLOW some predefined URL (saved in database)

* www.abc.com
* www.xyz.com

$refer = $_SERVER['SERVER_NAME'];

it doesn't solve the problem.

can anybody please let me know the exact code or snippet to be used for such purpose?

Thanks & Best Regards

bcarl314
09-25-2005, 03:11 AM
Try something like this...



$validURIs = array("www.xyz.com","www.abc.com"); //you could populate this with a database query

if(in_array($_SERVER['HTTP_REFERER'],$validURIs)) {
//it's valid
}
else {
//it's invalid
}


I may have the arguments backward in the in_array() function (I can never remember that stuff - www.php.net is your friend). ;)

missing-score
09-25-2005, 03:27 AM
You are like me, I could never remember until I forced myself... Yes though, you do have them the right way round :)... i can recite that page of the php.net manual now lol :P...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum