php 判斷訪問(wèn)網(wǎng)址,PHP禁止通過(guò)服務(wù)器IP訪問(wèn)
PHP代碼
- <?php
- $a=$_SERVER['HTTP_HOST'];
- if ($a<>'hou-g.com') //在這輸入IP地址
- {
- echo $a;}
- else
- {
- echo""
- . "<html>"
- . ""
- . "<head>"
- . "<meta HTTP-EQUIV=\"Content-Type\" Content=\"text/html; charset=gb2312
- \">"
- . ""
- . ""
- . "<title ID=titletext>YISKY科技提示您,網(wǎng)站正在建設(shè)中!!</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\">建設(shè)中</h1>"
- . ""
- . "<P ID=Comment2><!--Probable causes:<--><P ID=\"errordesc\"><font
- style=\"font:9pt/12pt 宋體; color:black\">"
- . " 您想要查看的站點(diǎn)當(dāng)前沒(méi)有默認(rèn)頁(yè)??赡苷趯?duì)它進(jìn)行升級(jí)和配置操作。"
- . "<P ID=term1>請(qǐng)稍后再訪問(wèn)此站點(diǎn)。如果您仍然遇到問(wèn)題,請(qǐng)與網(wǎng)站的管理員聯(lián)系
- 。"
- . ""
- . "<hr size=1 color=\"blue\">"
- . ""
- . "<P ID=message1>如果您是網(wǎng)站的管理員,并且認(rèn)為您是由于錯(cuò)誤才收到此消息,
- 請(qǐng)參閱 IIS 幫助中的"啟用和禁用動(dòng)態(tài)內(nèi)容"。"
- . ""
- . "<h5 ID=head1>要訪問(wèn) IIS 幫助</h5>"
- . "<ol>"
- . "<li ID=bullet1>單擊<b>開(kāi)始</b>,然后單擊<b>運(yùn)行</b>。"
- . "<li ID=bullet2>在<b>打開(kāi)</b>文本框中,鍵入 <b>inetmgr</b>。將出現(xiàn) IIS 管
- 理器。"
- . "<li ID=bullet3>從<b>幫助</b>菜單,單擊<b>幫助主題</b>。"
- . "<li ID=bullet4>單擊<b>Internet 信息服務(wù)</b>。</ol>"
- . "</td>"
- . "</tr>"
- . "</table>"
- . ""
- . "</body>"
- . "</html>"
- ."";
- }
- ?>