php下作业提交 辰星 感谢大佬桐镜!!! - Locked

猫绾   ·   发表于 2018-9-5   ·   公开课学院

<!doctype html>

<html>

<head>

<meta charset = "utf-8"/>

<title>登录测试</title>

</head>

<body>

<form action="practice.php" method="POST">

账号:<input type = "text" name='u'><br/>

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

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

</form>

</body>

</html>




//php文件

<?php

    $user=($_POST['u']);

$pass=($_POST['p']);

$con=mysqli_connect('127.0.0.1','root','root','test');

mysqli_query($con,"set names 'utf8'");

$sql="select * from testtable WHERE(username=$user)AND(password='$pass')";

$re=mysqli_query($con,$sql);

$rs=mysqli_fetch_array($re);

    if(!$re){

echo "what?";

}

if(!empty($rs)){

echo "ok";

}else{

echo "no";

}

mysqli_close($con);

?>


打赏我,让我更有动力~

1 Reply   |  Until 2018-9-6 | 421 View

Track-方丈
发表于 2018-9-6

通过,金币奖励已发放。

评论列表

  • 加载数据中...

编写评论内容
LoginCan Publish Content

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

Powered by 掌控者 Version 2.1.3