note 31977 modified in features.http-auth by vrana

From: Date: Tue, 17 Aug 2004 13:55:56 +0000
Subject: note 31977 modified in features.http-auth by vrana
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79910@lists.php.net to get a copy of this message
my solution to use SSL for password encryption, because the password is sent to web server as plain text. insert the following code snipet into the top of secure page. <?php if (!isset($_SERVER['HTTPS'] || $_SERVER['HTTPS']!="on") { header("Location: https://$_SERVER[SERVER_NAME]". $_SERVER['REQUEST_URI']); exit; } if (!isset($_SERVER['PHP_AUTH_USER'] || authenticate()) { header('WWW-Authenticate: Basic realm="secure"'); header('HTTP/1.0 401 Unauthorized'); echo 'Authorization Required.'; exit; } ?> first, redirect to the same URI but SSL-enabled page. then, do authentication. --was-- my solution to use SSL for password encryption, because the password is sent to web server as plain text. insert the following code snipet into the top of secure page. if (!isset($_SERVER['HTTPS'] || $_SERVER['HTTPS']!="on") { header("Location: https://$_SERVER['SERVER_NAME']". $_SERVER['REQUEST_URI']); exit; } if (!isset($_SERVER['PHP_AUTH_USER'] || authenticate()) { header('WWW-Authenticate: Basic realm="secure"'); header('HTTP/1.0 401 Unauthorized'); echo 'Authorization Required.'; exit; } first, redirect to the same URI but SSL-enabled page. then, do authentication. http://php.net/manual/en/features.http-auth.php

« previous php.notes (#79910) next »