Re: PHP Authenticate, then allow file access (centos)



The way the site is configured now, the user access a certain part of
the webpage, and they get a pop-up prompting them for user/pw. I
really don't like popups so I want to get rid of it. My solution is to
have them login via form. The code I am using work and forwards them
to the appropriate page, but when they are forwarded the popup still
comes up. But they have already entered their authentication
information.

This is the code I'm using that I found online. I get it, but I don't
understand how to get the popup to stop coming up. So I pose my
question: How do I get the pop-up to stop coming up?

Check the authentication. If the authentication is correct, don't
*forward* them to the file, *send them the file*. From the user's point
of view, they click on a link or fill in a form, submit, and they get
the file (and if I've got the content-disposition header right, they
get prompted to save the file).

... check the authentication ... ;
if (...authentication is correct...) {
/* authentication succeeded */
header("Content-type: application/pdf");
header("Content-disposition: attachment; filename=\"secret_file.pdf\"");
header("Content-length: " . filesize("/path/outside/document/root/secret.pdf"));
$f = fopen("/path/outside/document/root/secret.pdf", "r");
fpassthru($f);
exit();
} else {
/* authentication failed */
header("Content-type: text/plain");
echo "Access denied.\n";
exit();
}

Note: a bunch of stuff in the header() calls depends on the type of
the
.



Relevant Pages

  • Re: PHP Authenticate, then allow file access (centos)
    ... and they get a pop-up prompting them for user/pw. ... But they have already entered their authentication ... understand how to get the popup to stop coming up. ...     else ...
    (comp.lang.php)
  • Re: PHP Authenticate, then allow file access (centos)
    ... and they get a pop-up prompting them for user/pw. ... But they have already entered their authentication ... understand how to get the popup to stop coming up. ... the file (and if I've got the content-disposition header right, ...
    (comp.lang.php)
  • Re: authentication dialog
    ... I found out that the browser SetSilent method, which I call to stop getting ... IE and Firefox popup ... Any idea what triggers this authentication ... >> activex control? ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • Disable NT Windows Login for asp.net
    ... I create an intranet web application using asp.net 2.0. ... I set the authentication mode="Windows" in the web.config, ... box will popup to ask the users for their username and password. ... then the NT Windows Login dialog box will not popup. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Mastercard Securecode
    ... The greeting is completely separate from the authentication ... contained in that browser window. ... It would be trivial for a merchant to display a popup that looked ... I suspect that if you actually allow the popup ...
    (uk.finance)