php 判斷訪問網址,PHP禁止通過服務器IP訪問
PHP代碼
- <?php
 - $a=$_SERVER['HTTP_HOST'];
 - if ($a<>'www.k3107.com') //在這輸入IP地址
 - {
 - echo $a;}
 - else
 - {
 - echo""
 - . "<html>"
 - . ""
 - . "<head>"
 - . "<meta HTTP-EQUIV=\"Content-Type\" Content=\"text/html; charset=gb2312
 - \">"
 - . ""
 - . ""
 - . "<title ID=titletext>YISKY科技提示您,網站正在建設中??!</title>"
 - . "</head>"
 - . ""
 - . "<body bgcolor=white>"
 - . "<table>"
 - . "<tr>"
 - . "<td ID=tableProps width=70 valign=top align=center>"
 - . "<img ID=pagerrorImg src=\"pagerror.gif\" width=36 height=48>"
 - . "<td ID=tablePropsWidth width=400>"
 - . ""
 - . "<h1 ID=errortype style=\"font:14pt/16pt 宋體, verdana; color:#4e4e4e\">"
 - . "<P ID=Comment1><!--Problem--><P ID=\"errorText\">建設中</h1>"
 - . ""
 - . "<P ID=Comment2><!--Probable causes:<--><P ID=\"errordesc\"><font
 - style=\"font:9pt/12pt 宋體; color:black\">"
 - . " 您想要查看的站點當前沒有默認頁??赡苷趯λM行升級和配置操作。"
 - . "<P ID=term1>請稍后再訪問此站點。如果您仍然遇到問題,請與網站的管理員聯(lián)系
 - 。"
 - . ""
 - . "<hr size=1 color=\"blue\">"
 - . ""
 - . "<P ID=message1>如果您是網站的管理員,并且認為您是由于錯誤才收到此消息,
 - 請參閱 IIS 幫助中的"啟用和禁用動態(tài)內容"。"
 - . ""
 - . "<h5 ID=head1>要訪問 IIS 幫助</h5>"
 - . "<ol>"
 - . "<li ID=bullet1>單擊<b>開始</b>,然后單擊<b>運行</b>。"
 - . "<li ID=bullet2>在<b>打開</b>文本框中,鍵入 <b>inetmgr</b>。將出現(xiàn) IIS 管
 - 理器。"
 - . "<li ID=bullet3>從<b>幫助</b>菜單,單擊<b>幫助主題</b>。"
 - . "<li ID=bullet4>單擊<b>Internet 信息服務</b>。</ol>"
 - . "</td>"
 - . "</tr>"
 - . "</table>"
 - . ""
 - . "</body>"
 - . "</html>"
 - ."";
 - }
 - ?>
 

