怎么解决这个问题:Notice: Undefined index: out in C:\xampp\htdocs\t_bbs\login.php on line 3
<?phpinclude("conn.php");If($_GET['out']){setcookie("cookie","out");echo"<scriptlangu...
<?php
include("conn.php");
If($_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>
<center><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></center>
<?php }else{ ?>
<a href='?out=login'>退出</a>
<?php } ?>
<?php
session_start();
$coon_ ="localhost";
$name_ ="root";
$password_="";
$error_ = "无法连接数据库1,请重来";
$conn=mysql_connect($coon_,$name_,$password_) or die($error_);
mysql_select_db("abc")
or die($error_);
mysql_query("SET NAMES 'gbk'");//解决汉字
$row = mysql_fetch_assoc(mysql_query(" SELECT pass,qx,sex FROM users where name = '$username' and pass = '$pass'"));
$dl_mima=$row[pass];$dl_qx=$row[qx];$dl_sex=$row[sex];
if($dl_mima=="")
{
echo "<script>alert(\"您输入的用户名或者密码错误,请重新输入!\")</script>";
echo "<form id=\"form2\" name=\"form2\" method=\"post\" action=\"\">
<table width=\"452\" height=\"148\" border=\"1\" align=\"center\">
<tr>
<td><p>
<font color=red>用户名:</font>
<input name=\"username\" type=\"text\" id=\"username\" />
</p>
<p>
<font color=red>密 码:</font>
<input name=\"pass\" type=\"password\" id=\"pass\" />
</p>
<p>
<input type=\"submit\" name=\"Submit\" value=\"提交\" />
</p></td>
</tr>
</table>
</form>
";
}
else
{
$_SESSION['yhm']=$username;
$_SESSION['qx']=$dl_qx;
$_SESSION['sex']=$dl_sex;
echo "<script>alert('成功登陆')</script>";
echo "<script>window.location.href='index.php';</script>";
}
?> 展开
include("conn.php");
If($_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>
<center><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></center>
<?php }else{ ?>
<a href='?out=login'>退出</a>
<?php } ?>
<?php
session_start();
$coon_ ="localhost";
$name_ ="root";
$password_="";
$error_ = "无法连接数据库1,请重来";
$conn=mysql_connect($coon_,$name_,$password_) or die($error_);
mysql_select_db("abc")
or die($error_);
mysql_query("SET NAMES 'gbk'");//解决汉字
$row = mysql_fetch_assoc(mysql_query(" SELECT pass,qx,sex FROM users where name = '$username' and pass = '$pass'"));
$dl_mima=$row[pass];$dl_qx=$row[qx];$dl_sex=$row[sex];
if($dl_mima=="")
{
echo "<script>alert(\"您输入的用户名或者密码错误,请重新输入!\")</script>";
echo "<form id=\"form2\" name=\"form2\" method=\"post\" action=\"\">
<table width=\"452\" height=\"148\" border=\"1\" align=\"center\">
<tr>
<td><p>
<font color=red>用户名:</font>
<input name=\"username\" type=\"text\" id=\"username\" />
</p>
<p>
<font color=red>密 码:</font>
<input name=\"pass\" type=\"password\" id=\"pass\" />
</p>
<p>
<input type=\"submit\" name=\"Submit\" value=\"提交\" />
</p></td>
</tr>
</table>
</form>
";
}
else
{
$_SESSION['yhm']=$username;
$_SESSION['qx']=$dl_qx;
$_SESSION['sex']=$dl_sex;
echo "<script>alert('成功登陆')</script>";
echo "<script>window.location.href='index.php';</script>";
}
?> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询