如题所述
<html>
<body bgcolor="pink">
<h2> 请登陆 <h2>
<?php
include("conn.php");<!-- conn是打开存储用户名密码的数据库并连接的文件 -->
if(isset($_POST['submit'])){
$number=$_POST['number'];
$password=$_POST['password'];
$sql=mysql_query("select number from zhuce where number='".$number."'",$conn);
$sql1=mysql_query("select password from zhuce where password='".$password."'",$conn);
$cz=mysql_fetch_array($sql);
$cz1=mysql_fetch_array($sql1);
if($cz && $cz1){
echo "<script>window.location.href='shouye.php'</script>";
}
else if((login.username.value=="")&&(login.password.value==""))
{
echo "<script>alert('进入管理员界面');window.location.href='admin.php'</script>";
}
else
{
echo "<script>alert('密码错误,重新输入');window.location.href='denglu.php'</script>";
}
}
?>
<body bgcolor="pink">
<h2> 请登陆 <h2>
<?php
include("conn.php");<!-- conn是打开存储用户名密码的数据库并连接的文件 -->
if(isset($_POST['submit'])){
$number=$_POST['number'];
$password=$_POST['password'];
$sql=mysql_query("select number from zhuce where number='".$number."'",$conn);
$sql1=mysql_query("select password from zhuce where password='".$password."'",$conn);
$cz=mysql_fetch_array($sql);
$cz1=mysql_fetch_array($sql1);
if($cz && $cz1){
echo "<script>window.location.href='shouye.php'</script>";
}
else if((login.username.value=="")&&(login.password.value==""))
{
echo "<script>alert('进入管理员界面');window.location.href='admin.php'</script>";
}
else
{
echo "<script>alert('密码错误,重新输入');window.location.href='denglu.php'</script>";
}
}
?>
温馨提示:答案为网友推荐,仅供参考
第1个回答 2012-03-12
if判断,如果是管理员,跳转到哪个页面,如果是普通用户跳转到另一个页面!
第2个回答 2012-03-12
这样的功能针对需求需自己设计,PHP里没法设置!