利用php来自动调用不同服务器上的flash
近期,学校校庆,做了一个flash动画的网站,但体积比较庞大。如果上传到学校的服务器,从公众信息网访问就比较慢,而放到教育网外从校园网访问就比较不流畅,还好,我们有php,解决了这一问题!
代码如下:
$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="长大校园网";
}else{
$url="http://webnow.oso.com.cn/cau.swf";
$word="公众信息网";
}
?>
简单提示:
$remote_addr=getenv("REMOTE_ADDR"); 是获得客户机的ip.
$realip=substr($remote_addr,0,9);获得ip的前9个字节,因为我们学校的ip地址是202.117.6*.*,所以,通过判断$realip与$testip的值的不同来确定$url的值,即flash的文件位置。
本程序的演示请见:http://www.caunet.com

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Atom editor mac version download
The most popular open source editor

SublimeText3 Linux new version
SublimeText3 Linux latest version

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),