3.5、后端开发基础PHP - PHP简介及PHP基本函数(下)【作业】 - Locked

你看不见我啊   ·   发表于 2018-7-1   ·   CTF&WP专版

<!DOCTYPE HTML>

<html>

<body>

<title>Track安全社区</title>

<form action='a.php'  name='loginform' methon='post'><br>

用户名:<input type='text' name='username'><br>

密码:<input type='text' name='password'><br>

<input type='submit' value='登录'>

</form>

</body>

</html>


<!DOCTYPE html>

<html>

<body>

<?php

$servername = "localhost";

$username = "root";

$password = "root";

$dbname = "mysql";


$conn = new mysqli($servername, $username, $password, $dbname);


if ($conn->connect_error) {

    die("连接失败: " . $conn->connect_error);

}

$user_name=$_POST['username'];//获取用户名和密码

$password=$_POST['password'];

$sql = "SELECT username,password FROM name where username='"."$user_name"."' and password='"."$password"."'";

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

if(mysqli_num_rows($result) > 0) {

    echo "登录成功";

} else {

    echo "查询失败";

}

mysqli_close($conn);

?>

</body>

</html>


打赏我,让我更有动力~

1 Reply   |  Until 2018-7-1 | 714 View

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

通过。

评论列表

  • 加载数据中...

编写评论内容
LoginCan Publish Content
返回顶部

掌控者 © 2016. All Rights Reserved. 掌控者

Powered by 掌控者 Version 2.1.3