เจออยู่นานแล้วคิดว่าเก็บเอามาแปะบล๊อกไว้ดีกว่า เดี๋ยวจะลืมซะก่อน Function แหล่มๆ ไว้กัน SQL Injection นะครับ
GET Method
function mysqlesc($input){
$input = str_ireplace('\'', '', $input);
$input = str_ireplace('"', '', $input);
$input = str_ireplace('UNION', '', $input);
$input = str_ireplace('--', '', $input);
$input = str_ireplace('/**/', '', $input);
$input = str_ireplace('/*', '', $input);
$input = trim($input);
return $input;
}
POST Method
function mysqlesc($input){
$input = mysql_real_escape_string($input);
return $input;
}
Ref : http://santoshdudhade.blogspot.com/2011_11_01_archive.htmlบทความเพิ่มเติม
Ref : how to bypass function SQLi check ?

ไม่มีความคิดเห็น:
แสดงความคิดเห็น