sql注入及防止SQL注入
来源:互联网 发布:java开发简历项目描述 编辑:程序博客网 时间:2024/06/04 01:31
<?php
header('content-type:text/html;charset=utf-8');
$dsn = "mysql:host=127.0.0.1;dbname=username";
$db = new PDO($dsn,'root','');
$username=shiyan;
$pwd=000;
//未设置预处理之前
$sel="select * from user where username='$username' and pwd='$pwd'";
$count=$db->query($sel);
$arrs = $count->fetchAll();
print_r($arrs);
//进行预处理之后
$sql="select * from user where username = ? and pwd = ?";
$stmt = $db->prepare($sql);
$exeres = $stmt->execute(array($username, $pwd));
if ($exeres) {
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
print_r($row);
}
}
?>
header('content-type:text/html;charset=utf-8');
$dsn = "mysql:host=127.0.0.1;dbname=username";
$db = new PDO($dsn,'root','');
$username=shiyan;
$pwd=000;
//未设置预处理之前
$sel="select * from user where username='$username' and pwd='$pwd'";
$count=$db->query($sel);
$arrs = $count->fetchAll();
print_r($arrs);
//进行预处理之后
$sql="select * from user where username = ? and pwd = ?";
$stmt = $db->prepare($sql);
$exeres = $stmt->execute(array($username, $pwd));
if ($exeres) {
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
print_r($row);
}
}
?>
1 0
- sql注入及防止SQL注入
- sql注入及防止SQL注入
- 防止sql注入
- asp 防止SQL注入
- sql注入防止办法
- sql注入防止办法
- 怎么防止[SQL注入
- 如何防止SQL注入
- 防止sql注入
- SQL注入防止攻击
- 防止sql注入攻击
- 防止SQL注入
- 如何防止SQL注入
- 防止SQL注入
- 防止SQL注入攻击
- 防止sql注入
- 防止SQL注入攻击
- 网站防止SQL注入
- 航电 2041 超级楼梯
- CocoaPods 安装 使用
- C++复习4.笔试复习
- Android开发中使用fastJSON将json格式的数据快速解析生成实体类并附上实体类生成器
- 基于jenkins 打tag,基于tag构建,版本管理
- sql注入及防止SQL注入
- JAVA——Properties中如何将流中的数据存储到集合中
- Spring MVC 页面渲染( render view )
- HDU 1671 Phone List (字典树)
- .net中ddd设计模式之domainServices与redis构建redisServices的讨论
- 普通二叉树转二叉链表(孩子兄弟表示法)
- 文件上传限制
- python不使用type(obj) is **来判断变量的类型
- shell实现ftp命令示例