这代码为什么提示我id未定义~~求PHP大神
<metahttp-equiv="Content-Type"content="text/html;charset=UTF-8"/><?phpinclude("conn.p...
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<?php
include("conn.php");
if(isset($_GET['out'])){
setcookie("cookie", "out");
echo "<script language=\"javascript\">location.href='login.php';</script>";
}
if($_POST['id']=='admin'){
$pw=md5($_POST["pw"]);
if($pw=='e1bfd762321e409cee4ac0b6e841963c'){
setcookie("cookie", "ok");
echo "<script language=\"javascript\">location.href='login.php';</script>";
}
}
include("head.php");
if($_COOKIE['cookie']!='ok'){
?>
<SCRIPT language=javascript>
function Checklogin()
{
if (myform.id.value=="")
{
alert("请填写登录名");
myform.id.focus();
return false;
}
if (myform.pw.value=="")
{
alert("密码不能为空");
myform.pw.focus();
return false;
}
}
</SCRIPT>
<form action="" method="post" name="myform" onsubmit="return Checklogin();">
ID:<input type="text" name="id" /><br>
PW:<input type="password" name="pw" /> <input type="submit" name="submit" value="登陆"/>
</form>
<?php
}else{
?>
<a href='?out=login'>退出</a>
<?php
}
?> 展开
<?php
include("conn.php");
if(isset($_GET['out'])){
setcookie("cookie", "out");
echo "<script language=\"javascript\">location.href='login.php';</script>";
}
if($_POST['id']=='admin'){
$pw=md5($_POST["pw"]);
if($pw=='e1bfd762321e409cee4ac0b6e841963c'){
setcookie("cookie", "ok");
echo "<script language=\"javascript\">location.href='login.php';</script>";
}
}
include("head.php");
if($_COOKIE['cookie']!='ok'){
?>
<SCRIPT language=javascript>
function Checklogin()
{
if (myform.id.value=="")
{
alert("请填写登录名");
myform.id.focus();
return false;
}
if (myform.pw.value=="")
{
alert("密码不能为空");
myform.pw.focus();
return false;
}
}
</SCRIPT>
<form action="" method="post" name="myform" onsubmit="return Checklogin();">
ID:<input type="text" name="id" /><br>
PW:<input type="password" name="pw" /> <input type="submit" name="submit" value="登陆"/>
</form>
<?php
}else{
?>
<a href='?out=login'>退出</a>
<?php
}
?> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询