数码资讯
PHP防止SQL注入代码实例
Put the public calling file (such as conn database link file), filter the special string for all GET or POST data, so as to achieve simple and effecti
选购提示
关注价格、性能、续航、售后和真实使用场景,理性比较后再下单。
Put the public calling file (such as conn database link file), filter the special string for all GET or POST data, so as to achieve simple and effective SQL injection filtering.
复制代码代码如下所示:
功能inject_check($ sql_str){
返回eregi('select |插入|和|或|更新|删除| | / * * | | / | , / |联盟|为| load_file | outfile ',sql_str美元);
}
如果(inject_check($ _server { 'query_string ' })= = 1或inject_check(file_get_contents(PHP: / /输入))= = 1){
非法访问的警告!;
标题(位置:错误;
}
复制代码代码如下所示:
功能inject_check($ sql_str){
返回eregi('select |插入|和|或|更新|删除| | / * * | | / | , / |联盟|为| load_file | outfile ',sql_str美元);
}
如果(inject_check($ _server { 'query_string ' })= = 1或inject_check(file_get_contents(PHP: / /输入))= = 1){
非法访问的警告!;
标题(位置:错误;
}
声明:本文内容用于数码产品信息整理与选购参考,具体价格、库存、售后政策以官方渠道和电商页面实时信息为准。