php中mysql_real_escape_string+sprintf防止sql注入
来源:互联网 发布:java中的多态 编辑:程序博客网 时间:2024/06/04 18:04
function verify_key($db, $key) { $clientIp = $_SERVER["REMOTE_ADDR"]; $sql = sprintf("select * from myweb_key where keydata = '%s'",mysql_real_escape_string($key)); $query = $db->mysql_query($sql); if ($query) { # code... if ($db->column_num_rows($query) > 0) { $result = $db->mysql_getdata($query); if ( $result['keydata'] == $key && $clientIp == $result['ip']) { # code... $array = ['status'=>'True', 'data'=>'the key is current']; $array_to_json = json_encode($array); return $array_to_json; } elseif ($clientIp != $result['ip']) { $array = ['status'=>'False', 'data'=>'you address ip is not current in database ,must key with ip current, then you scan seach the block ip']; $array_to_json = json_encode($array); return $array_to_json; } } else { $array = ['status'=>'False', 'data'=>'the key is not found in column']; $array_to_json = json_encode($array); return $array_to_json; } } }
0 0
- php中mysql_real_escape_string+sprintf防止sql注入
- PHP中防止SQL注入
- 151 php SQL注入的例子 & mysql_real_escape_string
- 防止PHP中SQL注入实现代码
- PHP中如何防止SQL注入
- php中防止SQL注入的方法
- php中防止sql注入攻击
- php中防止SQL注入的方法
- PHP中该怎样防止SQL注入?
- PHP中该怎样防止SQL注入?
- php中防止SQL注入的方法
- PHP中该怎样防止SQL注入
- PHP中该怎样防止SQL注入?
- PHP中该怎样防止SQL注入
- 如何在PHP中防止SQL注入?
- php中防止SQL注入的方法
- php中防止SQL注入的方法
- PHP中防止SQL注入的方法
- C语言——循环缓冲区
- Codeforces Round #260 (Div. 1) B. A Lot of Games Trie + 博弈
- maven 新建web项目
- Android系统Recovery工作原理之使用update.zip升级过程分析(一)---update.zip包的制作
- Android中ListView(gridview)的item中有button等子点击控件时不能响应点击事件的原因
- php中mysql_real_escape_string+sprintf防止sql注入
- 如何验证远程服务器上文件是否存在
- 欧拉函数题集
- Android :关于小数相加出现很多位的 BigDecimal 也会有时不靠谱原因
- 如何取得nginx做反向代理时的真实IP?
- C++友元
- Java很容易出错的一些问题
- Java parseInt()和parseFloat()的用法
- vpnservice 详解