web安全作业

内容:.

自己写一个登陆页面,并能实现对接数据库,判断用户名与密码是否正确。
练习sql-map-master的1-7关

test.php

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<H2>欢迎来到西安欧鹏</H2>
<body>
    <P>登录</P>
<form name="input" action="welcome.php" method="get">
    user:<input type="text" name="user">
    password:<input type="password" name="password">
    <input type="submit" value="登录">
</form>
</body>
</html>

welcome.php

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
</html>
<?php
$username=$_GET['user'];
$password=$_GET['password'];
if($username==NULL or $password==null)
{
    echo "用户名或密码不得为空";
}
else
{
    $conn=mysqli_connect('127.0.0.1','root','cangshu123@','test');
}
if(!$conn)
{
    die("连接失败:" .mysql_connect_error());
}
echo"数据库连接成功";
$sql="select users,password from test.users where users='$username' and password='$password'";
$result=mysqli_query($conn,$sql);
$row=mysqli_fetch_assoc($result);
if ($row)
{
    echo "登录成功,欢迎来到西安欧鹏.$username";
}
else
{
    echo "登录失败<a href='test.php'>重新登录";
}

 mysql部分:

先建立库test

 create database test;

再建立users表

mysql> create table users
    -> (
    -> users varchar(20),
    -> password varchar(30) not null
    -> )
    -> ;

再向users表插入数据

 insert into users (users,password) values('admin','123456');

最后再查询数据是否插入成功

测试

在url输入127.0.0.1/test.php

 发现密码正确

练习sql-map-master

第一关:

然后注入列数

在查询在那个库下

 再查询表

 第二关:

第三关:

 第四关:

 第五关

使用floor报错注入

 

第六关

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值