authen.php

来自「《php程序设计》的配套源码 《php程序设计》的配套源码 《php程序」· PHP 代码 · 共 14 行

PHP
14
字号
<?php
 $auth_ok = 0;
 $user = $_SERVER ['PHP_AUTH_USER'];
 $pass = $_SERVER ['PHP_AUTH_PW'];
 if (isset($user)&&isset($pass)&&$user === strrev($pass)) {
   $auth_ok = 1;
 }
 if (!$auth_ok) {
   header('WWW-Authenticate:Basic realm="Top Secret Files"');
   header('HTTP/1.0 401 Unauthorized');
   // anything else printed here is only seen if the client hits "Cancel"
 }
?>
<!--your password-protected document goes here -->

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?