易截截图软件、单文件、免安装、纯绿色、仅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


相关文档:

windows安装apache+php+mysql的一些记录

apache安装,mysql安装,php5直接解压,均放在D:\www下。
目录结构为:
D:\www\apache2
D:\www\mysql
D:\www\php5
将php5\php.ini-dist复制为php.ini,把需要用到的组件将前面的;去掉。

extension=php_mysql.dll
extension=php_gd2.dll
在apache2的conf/httpd.conf文件中加
LoadFile D:/www/php5/php5ts.dll
......

apache mysql php安装

1.apache的安装
apache本来是想用编译安装的,但是其devel需要依赖一些其他的包,安装起来太麻烦,所以决定使用本地yum源安装;在rhel5u3上,直接 yum install httpd
     yum install httpd-devel
这样会有httpd-devel的一些依赖包一并安装了;
rpm安装的httpd有如下几个重要的目录:
1)/etc/ht ......

php字符串函数的大全

PHP字符串函数大全
AddSlashes: 字符串加入斜线。
bin2hex: 二进位转成十六进位。
Chop: 去除连续空白。
Chr: 返回序数值的字符。
chunk_split: 将字符串分成小段。
convert_cyr_string: 转换古斯拉夫字符串成其它字符串。
crypt: 将字符串用 DES 编码加密。
echo: 输出字符串。
explode: 切开字符串。
flush: 清 ......

PHP 常量 dirname(__file__)

PHP 常量 dirname(__file__) 学习
2008年09月02日 星期二 15:42
PHP 常量 dirname(__file__)
__FILE__ :被称为PHP魔术常量 ,返回当前执行PHP脚本的完整路径和文件名,包含一个绝对路径
1)dirname(__FILE__) 函数返回的是脚本所在在的路径。   
比如文件 b.php 包含如下内容:     ......

PHP5在Linux下安装


Linux下安装PHP5的主要步骤:
1.下载php5;地址:http://cn.php.net/downloads.php
2.解压软件包后进入该目录
(转者注:
可能会需要先解压php-5.*.tar.bz2 ,先执行bzip2 -d php-5.*tar.bz2

tar -xvf php-5.*.tar.gz
cd php-5.*
3.php安装mysql的模块的一些准备工作
ln -s /usr/local/mysql/lib/mysql /usr/l ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号