Jump to content


Photo

Need help with PHP Auth script


  • Please log in to reply
1 reply to this topic

#1 th2pun1sh3r

th2pun1sh3r
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 09 July 2006 - 11:54 PM

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) :

<?php
/******************************************************************************\
* 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>";
exit;
}

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>

<BR><BR><BR><BR><BR><BR><BR><BR>

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

#2 toplay

toplay
  • Staff Alumni
  • Advanced Member
  • 973 posts

Posted 10 July 2006 - 01:51 AM

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:
http://us2.php.net/m...s.http-auth.php

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users