PHP PDO操作mysql不注意的话依然存在SQL注入

2015-12-15 0 792
PHP PDO操作mysql不注意的话依然存在SQL注入
<?php 
dbh = new PDO("mysql:host=localhost; dbname=demo", "user", "pass");
$dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); 
$dbh->exec("set names 'utf8'");
$sql="select * from test where name = ? and password = ?";
$stmt = $dbh->prepare($sql);
$exeres = $stmt->execute(array($name, $pass));

遇见资源网 php PHP PDO操作mysql不注意的话依然存在SQL注入 http://www.ox520.com/8064.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务