PHP - авторизация по типу htpasswd

Материал из Wiki - Iphoster - the best ever hosting and support. 2005 - 2024
Перейти к:навигация, поиск
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.


<?php
 if ( ($PHP_AUTH_USER != "USER") || ($PHP_AUTH_PW != "PASS")) {
 Header("WWW-Authenticate: Basic realm="Admin"");
 Header("HTTP/1.0 401 Unauthorized");
 echo("<HTML>n<HEAD>n<TITLE>Restricted Zone!</TITLE>n</HEAD>nn<BODY>nn<center><font size = 20 color=red><b>Access denied!</b></font></center><br><br><br>nnnnnn</BODY>n</HTML>");
 }
 else {