PHP第二课【作业提交】【J】 - 已锁定

a52013141217   ·   发表于 2018-07-13 18:23:33   ·   CTF&WP专版

文件名:new.html


<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title>QQ空间</title>

</head>

<body background="E:\wm\安全\练习\timg.jpg">

     <img src="E:\wm\安全\练习\qzone.png"/>

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

        账号密码登陆<br />

        <input type="text" name="user">

        <br />

        <input type="password" name="password">

        <br />

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

     </form>

     </body>

</html>



文件名:ccc.php

<?php

header("Content-Type: text/html;charset=utf-8");

$username=$_POST['user'];

$password=$_POST['password'];

$con = mysql_connect("localhost:3306","root","root");

if (!$con)

  {

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

  }

  

mysql_select_db("testdb", $con);

$result = mysql_query("SELECT * FROM user1 where username='$username' and password='$password'");

if(mysql_num_rows($result) < 1){

    echo '登陆失败';

}else{

    echo '登陆成功';

}

mysql_close($con);

?>






打赏我,让我更有动力~

1 条回复   |  直到 2018-7-14 | 1277 次浏览

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

通过,金币奖励已发放。

建议使用mysqli系列函数或PDO对象。

评论列表

  • 加载数据中...

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

© 2016 - 2024 掌控者 All Rights Reserved.