2009年6月22日 星期一

[PHP]mysql_real_escape_string

get_magic_quotes_gpc();
GPC--get,post,cookie
如果伺服器替參數值都加上//回傳true

$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

用stripslashes()刪除slash
//----------------------------------------------------------------------
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
如果輸入值含用',"等使之跳脫以免影嚮sql query 或造成漏洞

沒有留言:

張貼留言