Jump to content


This topic is now archived and is closed to further replies.


Need help with PHP Auth script

Recommended Posts

Ok so ive been having issues making this script work on my website you can try it yourself..

here is how it works. User goes to website clicks a link and the script runs..

the user/pass box comes up and it won't take what it should.

here is the script I downloaded ( I didn't make it) :

* Simple Page Protect                          Version 1.0                    *
* Copyright 2000 Frederic TYNDIUK (FTLS)      All Rights Reserved.            *
* E-Mail: tyndiuk@ftls.org                    Script License: GPL            *
* Created  02/28/2000                          Last Modified 02/28/2000        *
* Scripts Archive at:                          http://www.ftls.org/php/        *
// Necessary Variables:

$LOGIN = "ftls";
$PASSWORD = "demo";
// En: login /password
// Fr: login / mots de passe

// End  Necessary Variables section

function error ($error_message) {
echo $error_message."<BR>";

if ( (!isset($PHP_AUTH_USER)) || ! (($PHP_AUTH_USER == $LOGIN) && ( $PHP_AUTH_PW == $PASSWORD )) ) {
header("WWW-Authenticate: Basic entrer=\"Form2txt admin\"");
header("HTTP/1.0 401 Unauthorized");
error("Unauthorized access...");

<!-- Add code of your web page here -->
<HTML><HEAD><TITLE>Your protected page</TITLE></HEAD>
<BODY BGCOLOR="white">
<BR><BR><P ALIGN="Center"><FONT FACE="Arial, helvetica" SIZE="+2" COLOR="#336699"><STRONG><EM>Your protected page</EM></STRONG></FONT></P><BR>


<FONT FACE="Arial" SIZE=-2>
<EM>&copy Copyright 2000 <A HREF="http://www.ftls.org/">FTLS</A> (Tyndiuk Fr&eacute;d&eacute;ric). All rights reserved.
<BR>FTLS's PHP Scripts Archive : <A HREF="http://www.ftls.org/php/">http://www.ftls.org/php/</A></EM></FONT>

Share this post

Link to post
Share on other sites
The use of variables like $PHP_AUTH_USER requires that register_globals be on. Keep it off for security reasons and use $_SERVER['PHP_AUTH_USER'] instead.

See this manual page for more details:

Since you didn't write the script, this topic has been moved to the third party area.

Share this post

Link to post
Share on other sites


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.