jon2s Posted November 8, 2007 Share Posted November 8, 2007 Looking for a solution to this and hopefully someone has a good idea. On my server I have a file that is used to be included on someone else's website. What I am wanting to do is limit the access of which domains can include that file. I have tried to get the host, referer and such, but I cannot get it to return the correct information. Any ideas or did I not explain it very well? Thanks! Jon Link to comment https://forums.phpfreaks.com/topic/76575-limiting-access-to-include-a-file-from-my-server/ Share on other sites More sharing options...
jon2s Posted November 10, 2007 Author Share Posted November 10, 2007 Any ideas? Anyone? The basic idea is I have a file that I want people to be able to include on their own site, but I want to limit it to specific domains. I think that I could do this with .htaccess, but I'd prefer to do it via PHP so I can query the DB to decide if they can see it and if not display a more friendly error message. Link to comment https://forums.phpfreaks.com/topic/76575-limiting-access-to-include-a-file-from-my-server/#findComment-388358 Share on other sites More sharing options...
PHP_PhREEEk Posted November 10, 2007 Share Posted November 10, 2007 Every domain has an IP, or two, or more... these IP's are static, otherwise they wouldn't stay on the web for long. Use .htaccess and allow only those approved IP's. You certainly could do it with PHP too. Stick all of the authorized IP's into an array, then compare incoming IP with in_array. Allow or deny. PhREEEk Link to comment https://forums.phpfreaks.com/topic/76575-limiting-access-to-include-a-file-from-my-server/#findComment-388376 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.