阅读:2980回复:0
php通过http头让页面需要密码登录验证
[table=98%] [tr][td] php通过http头让页面需要密码登录验证
写法一、 <span class="Apple-style-span"style="font-family: Arial; font-size: 12px; line-height: 18px; ">[table=560] [tr] [td] <div id="blog_text" class="cnt"style="word-wrap: break-word; word-break: normal; visibility: visible !important; zoom: 1 !important; filter: none; overflow-x: hidden; overflow-y: hidden; position: static; "> if(!isset($_SERVER['PHP_AUTH_USER'])) { Header("WWW-Authenticate: Basic realm='pa'"); Header("HTTP/1.0 401 Unauthorized"); echo "请登录"; exit; } else { if ( !($_SERVER['PHP_AUTH_USER'] =="hahahaha" && $_SERVER['PHP_AUTH_PW']=="123456ptqwerty123") ) { header("location:".HOME."/index.php"); } } 写法二: <font class="Apple-style-span" color="#333333" face="Arial"><span class="Apple-style-span"style="line-height: normal;"> |
|