PHP provides two simple methods to prevent SQL injection attacks and XSS attacks. Mysql_real_escape_string (). Therefore, if an SQL statement is written like this: select * fromcrwheresrc. $ userId; must be changed to $ scheme ($ userId) and all mysql_real_escape_string ()
Therefore, if an SQL statement is written like this: "select * from cdr where src =". $ userId; must be changed to $ userId = mysql_real_escape_string ($ userId)
All printed statements, such as echo and print, must be filtered using htmlentities () before printing. This prevents Xss. Note that htmlentities ($ name, ENT_NOQUOTES, GB2312) must be written in Chinese ).
Http://www.bkjia.com/PHPjc/321539.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/321539.htmlTechArticlemysql_real_escape_string () so the SQL statement is written like this: "select * from cdr where src = ". $ userId; both must be changed to $ userId = mysql_real_escape_string ($ userId...