3.5【dumbcrow】作业提交 - 已锁定

dumbcrow   ·   发表于 2018-07-25 17:35:54   ·   CTF&WP专版

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8"> 

<title>用户登录</title>

</head>

<body>

<p>用户登录</p>

<form action="yhdl.php" name="loginform" method="post">

账号:<input type="test" name="account"><br/>

密码:<input type="password" name="password"><br/>

<input type="submit" value="登陆">

</form>

</body>

</html>



<?php

header("content-type:text/html;charset=utf-8");

$servername="127.0.0.1";

$account="root";

$password="root";

$dbname="yhdl";

$conn=mysqli_connect("$servername","$account","$password","$dbname");

if ( !$conn )

{

echo("连接失败");

}

$account=$_POST["account"];

$password=$_POST["password"];

$sql="select id from yhdl_table where account=$account and password=$password";

$result=mysqli_query($conn,"$sql");

if ($result)

{

echo"登陆成功";

}else

{

echo"账号或密码错误";

};

mysqli_close($conn)

?>


打赏我,让我更有动力~

2 条回复   |  直到 2018-7-27 | 1322 次浏览

Track-方丈
发表于 2018-7-25

SQL语句中,字符串两端必须添加单引号。

最后一行代码结束未加分号。

评论列表

  • 加载数据中...

编写评论内容

Track-方丈
发表于 2018-7-27

金币奖励已发放。

评论列表

  • 加载数据中...

编写评论内容
登录后才可发表内容
返回顶部 投诉反馈

© 2016 - 2024 掌控者 All Rights Reserved.