Home > Backend Development > PHP Tutorial > Use php to automatically call flash_PHP tutorial on different servers

Use php to automatically call flash_PHP tutorial on different servers

WBOY
Release: 2016-07-21 16:05:55
Original
1415 people have browsed it

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...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template