4.5后端开发基础PHP—Php简介及php基本函数-下 九五的作业

九五   ·   发表于 2018-07-27 21:04:23   ·   CTF&WP专版

<!doctype html>

<html>

<head>

<meta charest="utf-8"/>

  <title>登录表单</title>

</head>

<body>

<p>管理员登录</p>

<form action="haha.php" method="post">

<input type="heihei"name="username"/><br>

<input type="heihei"name="jpassword"/><br>

<input type="submit"name="提交">

</form>

</body>

</html>



<?php

head('content-type:1/html;charset=utf-8');

$username=$_post['username'];

$password=$_post['password'];

$conn=mysqli_connect("localhost","root","root","db_name");

if(!$con)

{

die('could not connect:'.mysql_error);

}

$result=mysqli_query($conn,"select"from user where

username='".mysql_real_escape_string($username)."')

$row=mysql_fetch_row($result);

if($row>0)

{

echo“登录成功”;

}

else

{

echo“用户密码不正确”;

}

mysqli_close($sonn);

?>


打赏我,让我更有动力~

1 Reply   |  Until 2018-7-29 | 886 View

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

表单的name要对应php中$_POST的键值。

评论列表

  • 加载数据中...

编写评论内容
LoginCan Publish Content
返回顶部 投诉反馈

© 2016 - 2022 掌控者 All Rights Reserved.