<?php
$user='admin';
$pass='123456';
if($_POST['user']==$user){
if($_POST['pass']==$pass){
echo '登陆成功!';
}else{
echo '密码错误!';
}
}else{
echo '账号错误!';
}
?>
<?php
//初始化session
session_start();
include ('../include/init.php');
include ('../include/Mysql.class.php');
/*
* 接受表单
*/
$user = $_POST['admin_username'];
$pwd = $_POST['admin_password'];
$checkcode = $_POST['checkcode'];
/*
* 连接数据库
*/
$mysql = new Mysql();
$sql = "select admin_password from admin where admin_username='$user'";
if ($row=$mysql->getrow($sql)) {
if ($row['admin_password']==md5($pwd)&&$checkcode==$_SESSION["checkcode"]){
if ($checkcode!=$_SESSION["checkcode"]){
header("Location:Login.php?error=3");
exit();
}else{
//登陆成功,在跳转之前把session信息保存
$_SESSION["admin"] = "true";
header("Location:MySuper_administrator.php");
}else {
header("Location:Login.php?error=2");
exit();
}
}else{
header("Location:Login.php?error=1");
exit();
}
}
/*
* 释放资源!
* 关闭数据库连接!
*/
$mysql->onresult();
$mysql->close();
?>
<?php
$pass=12345;
if($pass==12345)
echo '密码正确';
else
echo '密码错误';