This is a discussion on .htaccess popup within the Apache Web Server forums, part of the Web Server and Related Forums category; Hello all, I am using a PHP script to enter the Username and Password into the ..htaccess prompt without poping ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hello all,
I am using a PHP script to enter the Username and Password into the ..htaccess prompt without poping up the .htaccess panel from Apache. (see script below) If you enter the wrong Username and/or Password, the original login popup will appear. What I would like to have is that you will be redirected to the login screen and that you will see the message "Wrong Username and/or Password" Does anybody know how to modify this? Thanks, Dion ************************************************** *********** <?php $server = "www.tiendegaard.com/secure/users/start.html"; if(isset($HTTP_POST_VARS['username'])) { $username = $HTTP_POST_VARS['username']; } if(isset($HTTP_POST_VARS['password'])) { $password = $HTTP_POST_VARS['password']; } ?> <script> function redirect() { window.location.replace("http://<?=$username?>:<?=$password?>@<?=$server?>") ; } setTimeout("redirect();", 1000); </script> ************************************************** *********** |
|
|||
|
Tiendegaard <thiemd1@hotmail.com> wrote:
> Does anybody know how to modify this? I don't think it's possible, since it's the server that send out to the browser the 'authorization request', while your script is activated _before_ that is even requested. Davide -- | SHIFT TO THE LEFT! SHIFT TO THE RIGHT! POP UP, PUSH DOWN, BYTE, BYTE, | BYTE! | | |
|
|||
|
It is possible .
PHP should sent special headers and authorization windows will pop. After you can get username and password within some variables and you can process them (I don't know which headers, but you can search google for them). But I preffer plain forms. Why do you want to use ayhorization popup? "Davide Bianchi" <davideyeahsure@onlyforfun.net> wrote in message news:c1pr3m$1lemt7$1@ID-18487.news.uni-berlin.de... > Tiendegaard <thiemd1@hotmail.com> wrote: > > Does anybody know how to modify this? > > I don't think it's possible, since it's the server that send out > to the browser the 'authorization request', while your script is > activated _before_ that is even requested. > > Davide > > > -- > | SHIFT TO THE LEFT! SHIFT TO THE RIGHT! POP UP, PUSH DOWN, BYTE, BYTE, > | BYTE! > | > | |
|
|||
|
"Tiendegaard" <thiemd1@hotmail.com> wrote in message news:c1pq0a$fp6$1@news2.tilbu1.nb.home.nl... > window.location.replace("http://<?=$username?>:<?=$password?>@<?=$server?>") That is an awful way to do this, not to mention the fact that it wont work in Internet Explorer anymore. You might want to look at mod_auth_cookie (http://modules.apache.org/search.php?id=3) for a better alternative. If you wanted to make sure that you didn't get a popup, you could make sure that the password is correct before you use it. If you used something like mod_auth_msql you could use PHP and MySQL to check the password yourself before you redirected your users. Other than that there isn't much you can do, unless you want to remove Apache's own authentication, and replace it with something done entirely in PHP. Richard. |