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

海城   ·   发表于 2018-07-18 10:23:02   ·   CTF&WP专版

<!doctype html>
<html>
    <head>
        <meta charset="UTF-8"/>
        <title> 3.5 </title>    
    </head>
    <body>
        <p>用户登陆</p>
        <form action="http://www.xxxxxxxx.com/xxx.php"  method=get>
            <table border="1">
                <tr>
                    <td align="left">name:</td>
                    <td align="left"><input type="text" name= "name"></td>
                <tr>
                    <td align="left">password:</td>
                    <td align="left"><input type="password" name ="password1"></td>
            </table>

            <input type ="checkbox" name="auto" >自动登陆<br/>
            <input type ="submit" value="登陆" />
        </form>
    </body>    
</html>

<?php
$conn=mysqli_connect("localhost","hello","hello")
if(!$conn)
    {
    die('Could not connect '. mysql_eorr());
    }

mysql_select_db("mydb",$conn);
$result=mysqli_query($conn,"SELECT * FROM user WHERE username='$name' and password='password'");
if($result==false)
    echo "账号或者密码错误";
else
    echo "登陆成功";
mysql_close($conn);    
?>


打赏我,让我更有动力~

1 条回复   |  直到 2018-7-18 | 1423 次浏览

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

每行php语句结束必须使用分号。

mysqli系列函数和mysql系列函数不得混用。

在PHP代码中未获取表单数据。

评论列表

  • 加载数据中...

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

© 2016 - 2024 掌控者 All Rights Reserved.