Recently, for the school anniversary, I made a flash animation website, but it was quite bulky. If it is uploaded to the school's server, it will be slower to access from the public information network, and if it is placed outside the education network, it will be less smooth to access from the campus network. Fortunately, we have PHP to solve this problem!
The code is as follows:
Celebrating School Anniversary $remote_addr=getenv("REMOTE_ADDR");
$testip="202.117.6";
$realip=substr ($remote_addr,0,9);
if($testip==$realip){
$url="http://202.117.68.12/~flyhawk/cau.swf";
$word ="Growing Up Campus Network";
}else{
$url="http://webnow.oso.com.cn/cau.swf";
$word="Public Information Network";
}
?>
🎜>$remote_addr=getenv("REMOTE_ADDR"); is to get the client's ip.
$realip=substr($remote_addr,0,9); is to get the first 9 bytes of the ip, because our school's ip address It is 202.117.6*.*, so the value of $url, that is, the file location of the flash, is determined by judging the difference between the values of $realip and $testip.
For a demonstration of this program, please visit: http://www.caunet.com
http://www.bkjia.com/PHPjc/315613.html
www.bkjia.com
truehttp: //www.bkjia.com/PHPjc/315613.htmlTechArticleRecently, for the school anniversary, I made a flash animation website, but the size is relatively large. If it is uploaded to the school's server, it will be slower to access from the public information network, and if it is uploaded to the school outside the education network...