本文实例讲述了PHP实现的登录页面信息提示功能。分享给大家供大家参考,具体如下:
login.php:
Insert title here帐号:
密码:
echo "
";
//通过 error 值,确定提示信息
if(!empty($_GET['error'])){
$error=$_GET['error'];
If($error==1){
Echo "您输入的账号或密码错误!";
}elseif ($error==2){
Echo "您输入的账号或密码正确!";
}
}
?>
check_login.php:
header("Content-type: text/html; charset=utf-8");
session_start(); //初始化session变量
$username = $_POST['name']; //接收表单提交的用户名
$password=md5($_POST['pwd']); //接收表单提交的密码
class chkinput //定义类
{
var $name;
var $pwd;
function chkinput($x,$y) //定义一个方法