visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Languages :: PHP :: HTAccess login with PHP


By: PHP newbee U.S.A.  Date: 20/11/2002 00:00:00  English  Points: 50 Status: Answered
Quality : Excellent
This might be a dumb question but I can't find the answer. Is there a PHP script (or any other) that will allow people to login to an HTAccess protected area through the web browser window and not the pop-up login? Thanks!
By: VGR Date: 21/11/2002 07:00:00 English  Type : Answer
no and yes

no directly (because it's your choice to have used .htaccess as a method of rights' handling)

yes because you may use in stead standard HTTP Authentication via META-TAGS :

(in PHP) :


function authenticate() {
Header( "WWW-authenticate: basic realm='My Authentication System'");
Header( "HTTP/1.0 401 Unauthorized");
echo "You must enter a valid login ID and password to access this resource\n";
exit;
}

if(!isset($PHP_AUTH_USER)) { // || ($SeenBefore == 1 && !strcmp($OldAuth, $PHP_AUTH_USER)) ) {
authenticate();
}
else while (($PHP_AUTH_PW!="hardcoded_password1")and($PHP_AUTH_PW!="hardcoded_password2")) authenticate(); // pas besoin d'une base de données

By: monange Date: 21/11/2002 21:56:00 English  Type : Comment
yes and no: don't use .htaccess

- store the login password into a database
- create a form login / password.
- check from the database or plain text (database is really better)
- if yes put the session into the database. it allows you to expire the session when you wish

then you're logged.

Do register to be able to answer

EContact
browser fav
page generated in 371.127840 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page