Home > Backend Development > PHP Tutorial > sql注入失败

sql注入失败

WBOY
Release: 2016-06-13 13:10:28
Original
1054 people have browsed it

高手进 sql注入失败!
自己写的登陆,测试sql注入,在数据库测试可以,但在这老是失败,求指教!
login.php

HTML code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->



<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>登陆界面-SQl注入测试</title>



Copy after login
用户名:
密  码:


loginCl.php
PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
<?php $username = $_REQUEST['username'];
$password = $_REQUEST['password'];


$conn=mysql_connect('localhost','root','315824');
if(!$conn){
    echo "数据库连接失败".mysql_error();
}

mysql_select_db('test',$conn);

$sql="select * from users where username='$username' and password='$password'";

$res=mysql_query($sql,$conn);

if( mysql_num_rows($res) != 0 ){
    header("location:manageCenter.php");
}else{
    echo "用户名或密码错误,<a href='login.php'>重新登陆";

}


?>

Copy after login


manageCenter.php
HTML code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->



<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>管理中心</title>



欢迎管理员,管理中心!



Copy after login


在数据库用万能密码注入 Select * from users where username='sean' and password='cuwumima' or 1='1';
可以成功,但是在登陆密码输cuwumima' or 1='1 不能成功! loginCl.php接收到的password变成这样了cuwumima\' or 1=\'1 请问怎样解决!先谢谢啦!


------解决方案--------------------
magic_quotes_gpc检查一下,看看是不是被设置成on了!
------解决方案--------------------
探讨
magic_quotes_gpc和magic_quotes_runtime,这两个函数在php.ini设置为ON试试。。。。。

------解决方案--------------------
让那个坏人ci1699 教你...
------解决方案--------------------
那就是说明你没关掉环境过滤。。
phpinfo() 看php.ini的路径看有没有改对地方。

配置是 magic_quotes_gpc 

get_magic_quotes_gpc()这是php函数
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template