易截截图软件、单文件、免安装、纯绿色、仅160KB

php 字符串安全过滤 全攻略

<?php
if (!get_magic_quotes_gpc()) {
add_slashes($_GET);
add_slashes($_POST);
add_slashes($_COOKIE);
}

function add_slashes($string) {
if (is_array($string)) {
foreach ($string as $key => $value) {
$string[$key] = add_slashes($value);
}
} else {
$string = addslashes($string);
}
return $string;
}
//php防注入函数,字符过滤函数
//解码
function htmldecode($str)
{
if(empty($str)) return;
if($str=="") return $str;
$str=str_replace("select","select",$str);
$str=str_replace("join","join",$str);
$str=str_replace("union","union",$str);
$str=str_replace("where","where",$str);
$str=str_replace("insert","insert",$str);
$str=str_replace("delete","delete",$str);
$str=str_replace("update","update",$str);
$str=str_replace("like","like",$str);
$str=str_replace("drop","drop",$str);
$str=str_replace("create","create",$str);
$str=str_replace("modify","modify",$str);
$str=str_replace("rename","rename",$str);
$str=str_replace("alter","alter",$str);
$str=str_replace("cas","cast",$str);
$str=str_replace("&","&",$str);
$str=str_replace(">",">",$str);
$str=str_replace("<","<",$str);
$str=str_replace(" ",chr(32),$str);
$str=str_replace(" ",chr(9),$str);
// $str=str_replace("    ",chr(9),$str);
$str=str_replace("&",chr(34),$str);
$str=str_replace("'",chr(39),$str);
$str=str_replace("<br />",chr(13),$str);
$str=str_replace("''","'",$str);
return $str;
}
//编码
function htmlencode($str)
{
if(empty($str)) return;
if($str=="") return $str;
$str=trim($str);
$str=str_replace("&","&",$str);
$str=str_replac


相关文档:

php写的大整数的乘法

/*************十进制大整数相乘****************/
    /*********
     * $A,$B均为字符串
     */
    function multipication ($A,$B){
        $sResult = "";
       ......

linux下apache+php安装常见问题


linux下apache+php安装常见问题
configure: error: Unable to find libgd.(a|so)
如果使用的是ubuntu或debian就很简单了,直接sudo apt-get install apache2 libapache2-mod-php5 php5 php5-gd 就基本上搞定,但是用源代码安装还是很麻烦~
wget http://www.boutell.com/gd/http/gd-2.0.11.tar.gz
tar zxvf gd-2.0.11 ......

开始学习PHP开发以及网络工程

1.定位,明确方向。
2.定位后就去尝试。不要再谈能不能做。
以上是好友给我的建议,很中肯。
第一点,我需要确定自己今后发展的方向,不能再像现在这样什么都去学,结果什么都一无所成。
第二点,制定计划后就应该马上着手去执行,遇到挫折时不要急着说,我熬夜了多久多久,还是没学会啊,而是静心分析,然后对症下药, ......

使用PHP来操作Cassandra

使用Thrift来让PHP操作Cassandra无疑是一个首选方案,但是配置和操作比较麻烦。
我们可以使用一个php的模块phpcassa来操作Cassandra。
我们先插入一些数据:
下载phpcassa:http://github.com/downloads/hoan/phpcassa/phpcassa-0.1.zip
解压缩,放到项目的include目录下。
写一个php文件,内容如下:
 
  ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号