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

Link to comment
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.