php实例 简单的用户验证代码

发布时间:2020-01-31编辑:脚本学堂
分享一个简单的php用户验证代码,适合初学的朋友参考,主要学习$_post传递数据及isset检测变量的方法。

php简单用户验证代码,如下:

<html>
<head>
<title>用户验证-www.jb200.com</title>
</head>
<body>
<?php
if (isset($_POST["user"]) && isset($_POST["pass"]) &&
  strtolower($_POST["user"]) == "shelley" && $_POST["pass"]
  == "deadline") {
?>
Welcome!
<?php
} else {
?>
请登录:
<form method="post">
用户名: <input type="text" name="user" /><br />
密码: <input type="password" name="pass" /><br />
<input type="submit" name="验证用户登录" />
</form>
<?php
}
?>
</body>
</html>