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

php 安全

如何不使用prepared statment,而是用过滤的方法避免SQL注入呢?
一般来说mysql自带的过滤函数是比较可靠的。mysql_real_escape_string()
但是这个函数在某些字符集中有问题,比如GBK。如果你用UTF8那没关系。
在PHP里设置数据库的字符集不应该用:mysql_query("SET NAMES UTF8");
而应该用:mysql_set_charset()
这样mysql_real_escape_string()在处理GBK编码的时候就不会出问题了。
mysql_real_escape_string() not safe when SET NAMES is used
use mysql_set_charset() instead.
Note: This is the preferred way to change the charset. Using mysql_query() to execute SET NAMES .. is not recommended.
SET NAMES is usually used to switch the encoding from what is default to what the application needs. This is done in a way that mysql_real_escape_string doesn’t know about this. This means if you switch to some multi byte encoding that allows backslash as 2nd 3rd 4th… byte you run into trouble, because mysql_real_escape_string doesn’t escape correctly. UTF-8 is safe…
Safe way to change encoding is mysql_set_charset, but that is only available in new PHP versions


相关文档:

blog源码整理:php+mysql博客程序25种

Blog系统作为大家最常接触的互联网东东,在站长群体中几乎人手一博,从知名门户的博客频道,到网络营销专家博客,网民对博客的关注度在不断提高并深化。目前网上免费的blog系统太杂,在此整理PHP版的Blog介绍如下:
1、wordpress:http://www.wordpress.org 功能也很全面,应该是支持blog的首选。它有最强的模版功能,已经 ......

PHP实现文件的读和写功能

进行文件的读和写,先打开一个文件,然后开始读或者写文件,最后再关系这个文件资源。
如,文件的读操作:
<?php
$file = fopen('your file path','r');
while(!feof($file)){ //当没有读取到文件结尾,继续循环读取操作
$line = fgets($file); //读取到一行的内容
echo $line.'<br/>';
}
fclose($file) ......

用VIM做PHP开发环境



老廖曾经在PHPER杂志上发表过一篇文章叫做用VIM做PHP开发环境,在里面详细介绍了用VIM做php开发需要做的准备,这篇文章就结合一些资料和我自己的一些经验来介绍下用VIM做C/C++开发需要做的事情,相对来说要比做php开发方便些。
前提条件是当然是你已经下载了VIM,如果没有的话请先到官方网站下载最新版本,地址是:http:/ ......

安装php的时候没有mysql支持的后续安装

引用http://www.icnote.com/Mysql-php-connector/
 由于公司的服务器开始只是用于java的支持,装了apache,mysql,php,但是php的安装没有对mysql进行支持,今天对他进行了扩展,记录如下。
      首先,安装mysql和php的连接扩展,需要以下包。可以在http://rpmfind.net/
找到,根 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号