einherjer Posted April 18, 2007 Share Posted April 18, 2007 Hello everyone, I was wondering if anyone could help me with the following problem: On a website, I will have several PDFs that I need to make available if user gives correct password or is in a given IP range. My first thought was to use .htaccess, but the host doesn't support that. they do support .htconfig and I didnt find any way of using that to resolve my needs. If there any walk around in this situation using PHP and MySQL? Quote Link to comment Share on other sites More sharing options...
btherl Posted April 18, 2007 Share Posted April 18, 2007 You can find the user's ip address in $_SERVER['REMOTE_ADDR']. If they are using a proxy server, this will be the address of the proxy server. For password authentication, you can implement this yourself in php, providing php is running as an apache module. Details are here: http://sg2.php.net/features.http-auth Quote Link to comment Share on other sites More sharing options...
btherl Posted April 18, 2007 Share Posted April 18, 2007 Oops, I forgot to mention - if you're using php to do the authentication, then your script will have to print out the file as well. The files can be kept somewhere that can't be accessed via the webserver. If you simple link to the file, then someone who knows the link can simply download it directly. Quote Link to comment Share on other sites More sharing options...
einherjer Posted April 18, 2007 Author Share Posted April 18, 2007 Thank you for your ideas, My main problem is hiding those PDF links from public. How can this be done? I don't see how the link you provided could help me. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.