Jump to content


using PHP to bypass .htaccess ?

  • Please log in to reply
1 reply to this topic

#1 rogerios

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 29 May 2006 - 06:46 PM


I have chosen to protect my website using .htaccess since I use a LeftFrame for navigation, and a MainFrame to load PDF Documents.

Now, I have three different sites, and, I need a 'User Manager' interface which allows the admin to control user access to any combination of these sites. I have actually used a global PHP login, which provides respective access to a PHP file with this line only:

header("Location: [a href=\"http://username:password@website_X");\" target=\"_blank\"]http://username:password@website_X");[/a]
* That would forward the user and somewhat secretly bypass the browser's request for a new password. Since IE now prohibits passwords within URLs by default, this can no longer be achieved...

The question is, how can I protect those PDF documents and authenticate via PHP, using a MySQL database to keep track of user details?

Does $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'] have anything to do with .htaccess? Could this be an alternative?

Thank you :)


#2 rogerios

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 31 May 2006 - 01:11 PM

To answer my own question (after more research).

This can be achieved with these lines:

$pdf = 'dummy.pdf';
header('Content-type: application/pdf');
//header('Content-Disposition: attachment; filename="'.$pdf.'"');

...just in case anyone else is searching on this topic :)

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users