It is currently Thu Mar 28, 2024 11:37 am


All times are UTC


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: authentication
PostPosted: Tue Jan 31, 2006 3:07 pm 
Noobie
Noobie

Joined: Wed May 25, 2005 9:19 am
Posts: 13
Dear all,
I want to use this script at webpal.info. The popup coms up but I always go to Authentication failed. The login and password are fake just for testing I use my name. The login never passes.

Code:
<?
    //-- login
    if ($_SERVER["PHP_AUTH_USER"] != "erik" || $_SERVER["PHP_AUTH_PW"] != "smit")
    {

        header("WWW-Authenticate: Basic realm=\"Enter username and password to proceed\"");   
        header("HTTP/1.0 401 Unauthorized");
         
        echo "<h1>Authentication failed</h1>You have no rights for this page.";
    }     
    else
    {
        echo "This is what you see when the login and password are correct. ";
    }
?>


Thanks for helping. I have a free account at webspace. Does this code fail because it is not supported? Is this a good way to protect (if it worsk)?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 22, 2006 9:52 pm 
Noobie
Noobie

Joined: Wed Mar 22, 2006 5:37 pm
Posts: 4
whoops, since i can't delete this...
I'm not too sure what's happening... It doesn't seem to get the headers right, cause it's also adding the echo's into the header. Are you sure they're right?
Anywho, it doesn't work without the headers, so you must need them.

If it all fails, perhaps using a Log In form and just passing the username and password across with POST will work?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 23, 2006 8:10 pm 
http://forum.100webspace.com/viewtopic.php?t=3487

^ This may be of some interest to you (Scroll down and try out the code update)


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ]  Moderators: fhmagic, KJ, Moderators, Support Team

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
100WebSpace © 2011