寻求帮助关于网站后台建设:为什么验证码错误也能登陆后台
程序员文章站
2022-05-13 19:18:55
...
header ( "Content-type: text/html; charset=gb2312" );
class chkinput{
var $name;
var $pwd;
function chkinput($x,$y)
{
$this->name=$x;
$this->pwd=$y;
}
function checkinput()
{
include("../conn/conn.php");
$sql=mysql_query("select * from tb_admin where name='".$this->name."'",$conn);
$info=mysql_fetch_array($sql);
if($info==false)
{
echo "";
exit;
}
else
{
if($info[pwd]==$this->pwd)
{
if($number==$_SESSION['code'])
{
header("location:index.php");}
else
{
echo "";
exit;}
}
else
{
echo "";
exit;
}
}
}
}
$obj=new chkinput(trim($_POST[name]),trim($_POST[pwd]));
$obj->checkinput();
?>
class chkinput{
var $name;
var $pwd;
function chkinput($x,$y)
{
$this->name=$x;
$this->pwd=$y;
}
function checkinput()
{
include("../conn/conn.php");
$sql=mysql_query("select * from tb_admin where name='".$this->name."'",$conn);
$info=mysql_fetch_array($sql);
if($info==false)
{
echo "";
exit;
}
else
{
if($info[pwd]==$this->pwd)
{
if($number==$_SESSION['code'])
{
header("location:index.php");}
else
{
echo "";
exit;}
}
else
{
echo "";
exit;
}
}
}
}
$obj=new chkinput(trim($_POST[name]),trim($_POST[pwd]));
$obj->checkinput();
?>
回复讨论(解决方案)
$number==$_SESSION['code'];
断点调试输出验证码
如果你的$_SESSION['code']是验证码,那$number是什么,如果是验证码为什么不用POST传递过来
我想判断输入的验证码是否与图片上的验证码是否一致,$_SESSION['code']是图片的验证码,number是我文本框命名的验证码,应该如何修改?