Jump to content

Limiting access to include a file from my server...


jon2s

Recommended Posts

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

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.

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.