php4ever Posted July 30, 2007 Share Posted July 30, 2007 I know I found it in these forums but I have looked for hours with no luck. I had a small PHP snippet that I could add to my application that would limit its working to the domain I put in the variable. I'll be if I can't find it in these forums. Could someone point it out if you happen to know where it is? I plan to put it in the header of a template and encrypt the header so it can be used to demo it only on a particular URL or domain. I hope that clarifies which one I was after. Link to comment https://forums.phpfreaks.com/topic/62501-url-restrict-restrict-to-domain-php/ Share on other sites More sharing options...
cooldude832 Posted July 30, 2007 Share Posted July 30, 2007 check out the $_SERVER Superglobal array I think one of them refers to the absolute url (and domain) which you can say <?php $good_domains = array("me.com","you.net"); if(!in_array($_SERVER['SERVER_NAME'],$good_domains)){ echo "Don't steal my work!"; } else{ //Display header output } ?> I think it might be $_SERVER['SERVER_NAME']; Try that then on a different server try to fopen it or give me the url and i can try it for you. Link to comment https://forums.phpfreaks.com/topic/62501-url-restrict-restrict-to-domain-php/#findComment-311092 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.