Re: HTTP AUTH SOLUTION

From: Date: Tue, 15 Jan 2002 10:53:08 +0000
Subject: Re: HTTP AUTH SOLUTION
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-997@lists.php.net to get a copy of this message
Try php-general@lists.php.net instead. --- Bharath <bharath_b_lohray@yahoo.com> wrote: > Here is a solution I developed for the HTTP AUTHENTICATION on that > buggy > Internet Explorer. > I want some feedbacks, improvements, Comments... > > > Bharath > (B. h. Loh.) > bharath_b_lohray (at) yahoo.com > > > > Please correspond via email for my convinience and > also on the News Group for the benifit of the Php Developers... > > > =================== START OF SOURCE CODE > [lohauthsol.php]=================== > <?php > //Username and password verification function > //takes (username,password) returns TRUE/FALSE > function verify($un,$pw) > { > //Verify against a database etc.... > if > ((($un=="bharath")&&($pw=="password1"))||(($un=="tom_dick_harrypotter")&&($p > w=="password2"))) > { > $ok=TRUE; > } > else > { > $ok=FALSE; > } > return $ok; > } > > //Procedure to display a standard error if login > //fails > function er($err) > { > echo "<html><head><title>$err</title></head><body > bgcolor=\"#FFFFFF\" > text=\"#000000\"><p><font face=\"Courier New, Courier, > Terminal\" > size=\"3\"><font > size=\"5\">$err</font><br><br>Could not log you in. > <a > href=\"lohauthsol.php\">TRY > AGAIN</a></font></p></body></html>"; > } > > //Procedure to ask username and password by > //HTTP AUTHENTICATION > function ask() > { > header("WWW-Authenticate: Basic realm=\"1024x1024.net > Administration\""); > header("HTTP/1.0 401"); > er("Unauthorized"); > exit; > } > > //BEGIN MAIN PROGRAMME > if ((!isset($PHP_AUTH_USER))||(!verify($PHP_AUTH_USER,$PHP_AUTH_PW))) > { > ask(); > } > else > { > echo "OK"; > exit; > } > ?> > =================== END OF SOURCE CODE =================== > > > > -- > PHP-GTK General Mailing List (http://gtk.php.net/) > To unsubscribe, e-mail: php-gtk-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-gtk-general-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net > __________________________________________________ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/

« previous php.gtk.general (#997) next »