flash与php结合实现IP及归属地查询
数据库是 纯真数据库 格式为 UTF-8 txt格式
php文件是UTF-8编码
demo : http://dreamnight.gicp.net/zendphp/IP/connect.swf
flash端:
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.events.ProgressEvent;
//import flash.text.TextFormat
//flash.system.System.useCodePage=true;//
var myIP:String;
var myPlace:String;
var loader:URLLoader= new URLLoader();
var id=getTimer();
var url:String = " http://dreamnight.gicp.net/zendphp/IP/ipTest.php";
var urlRequest:URLRequest = new URLRequest(url+"?id="+id);
loader.dataFormat=URLLoaderDataFormat.VARIABLES;
loader.load(urlRequest);
loader.addEventListener(Event.COMPLETE,handle);
loader.addEventListener(ProgressEvent.PROGRESS,onProgress);
//var format:TextFormat= new TextFormat();
//format.font="宋体";
//showText.defaultTextFormat=format;
function handle(e:Event):void{
trace("加载完成");
var phpData:*=e.target.data;
trace(phpData);
myIP=String(phpData.ip);
trace(myIP);
myPlace=String(phpData.area);
trace(myPlace);
showText.text="您所在的位置是"+myPlace+"\n您的IP地址是"+myIP;
//释放内存
loader.removeEventListener(Event.COMPLETE,handle);
loader.removeEventListener(ProgressEvent.PROGRESS,onProgress);
url="";
urlRequest=null;
loader=null;
}
function onProgress(e:ProgressEvent):void{
var percent:int=int(e.bytesLoaded*100/e.bytesTotal);
showText.text="已经加载"+percent+"%";
}
php端:路径是 : http://dreamnight.gicp.net/zendphp/IP/ipTest.php
<?php
//header("Content-Type:text/html;charset=gb2312");
//$getIP="111.176.149.35"; // 这里是自己随便写的一个ip 实际时你还要通过程序得到这个ip
$getIP="初始IP";
$getIP=getIP();
//得到当前目录
$PHP_SELF=$_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
$dir='http://'.$
相关文档:
对于需要累计执行的特效或对象,如tween,他是在给定的时间内不断运行,一旦在函数中定义tween 函数结束时,可能会回收了tween 造成tween不能跑完,定要注意,错误代码如下: 尤其是函数中定义的 package {
import flash.display.Sprite;
& ......
htmlspecialchars()
函数把一些预定义的字符转换为 HTML 实体。
ENT_COMPAT - 默认。仅编码双引号。
eg:" (双引号) 成为 "
implode()
函数把
数组元素组合为一个字 ......
一. 首先是PHP网页的编码
1. php文件本身的编码与网页的编码应匹配
a. 如果欲使用gb2312编码,那么php要输出头:header(“Content-Type: text/html; charset=gb2312"),静态页面添加<meta http-equiv="Cont ......
/*php 防注入函数
string $feifa 限制元素组成
如有非法字符跳转到上一页 返回 0 没有返回 1
*/
//使用方法
//$feifa=array("select","delete","from","update","create","destory","drop","alter" ......
本文适合CentOS。一步一步来,不要错。
先下载工具ssh shell,个人感觉这个比较好用,推荐给大家
http://docs.isvps.net/soft/SSHSecureShellClient-3.2.9.zip
然后是一些必要的软件包
nginx源码包: http://www.nginx.org/download/nginx-0.7.65.tar.gz
php源码包: http://cn.php.net/distributions/php-5.2.11.tar.gz ......