You are here: Re: How to set the username/password when using http authentication? « PHP Language « IT news, forums, messages
Re: How to set the username/password when using http authentication?

Posted by Rik on 03/08/07 00:18

Els <els.aNOSPAM@tiscali.nl> wrote:
>> So, literally:
>> ini_set('display_errors',true);
>> error_reporting(E_ALL)
>
> only then with a ';' after (E_ALL), right?

indeed :P

> But where would that supposed to be shown if I fill out a username and=

> password in the popup? If I press submit, the same popup just comes up=

> again, no new page is shown.

Temporarily only send the headers if there is not username/password set,=
=

not it they're not set or they do not match.

>>> For now, I'll have to dismiss this mission as too complicated for me=
..
>>> Thanks again for your help, but I'll have to find different ways to =
go
>>> about what I need to accomplish.
>>
>> Well, working within other unknown code as a beginner can be very, ve=
ry
>> tricky. If you still feel like it, you might want to try it in a =

>> seperate
>> file first. Just have 1 preset username & password, check if you can =
get
>> that to work, and only then try to expand & add it in Joomla.
>
> But how/where do I preset a username & password?
> (yes I'm a total noob :-) )


Use one preset username & password in a file:
<?php
$username =3D 'username';
$password =3D 'password';
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm=3D"My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Text to send if user hits Cancel button';
exit;
} else {
if($_SERVER['PHP_AUTH_USER'] !=3D $username)
echo 'Username incorrect:'.$_SERVER['PHP_AUTH_USER'].', =

expected:'.$username;
if($_SERVER['PHP_AUTH_PW'] !=3D $password)
echo 'Username incorrect:'.$_SERVER['PHP_AUTH_PW'].', =

expected:'.$password;
}
?>

Take it from there, add the md5 in later, then try it in Joomla, the try=
=

to use the database.
-- =

Rik Wasmus
Posted on Usenet, not any forum you might see this in.
Ask Smart Questions: http://tinyurl.com/anel

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация