Home >Backend Development >PHP Tutorial >PHP simple code to prevent SQL injection
Put it in a common call file (such as the conn database link file) and filter all GET or POST data with special strings to achieve simple and effective SQL injection filtering. PHP beginners, welcome criticism and advice. Thank you! Function inject_check($sql_str) {
Return eregi('select|insert|and|or|update|delete|'|/*|*|../|./|union|into|load_file|outfile' , $sql_str); " exit;}
Copy code |