以下是我的一个新闻系统的后台登录页面的源码。请教高手,为什么我输入密码后总是无法登录?密码是test

drc333 2004-02-02 05:36:17
下面是config.inc.php的源码
<?
//设置管理员密码
$config_password="test";


//程序所在目录
$config_url="http://bbs.njpengwei.com/enreach/enreach-ch/news";



// 数据库信息
$dbhost = "zl"; // 数据库主机名

$dbuser = "root"; // 数据库用户名

$dbpasswd =""; // 数据库密码

$dbname = "zl"; // 数据库名

$con=mysql_connect($dbhost,$dbuser,$dbpasswd);

mysql_select_db($dbname,$con);
?>

-------------------------------------------------------------------------
下面是enreach_login.php文件的源码,也就是后台登录管理的页面
<?
require("config.inc.php");
if($isadmin!="yes"){
if($password==$config_password){
setCookie('isadmin','yes',0,'/');
echo "<script>window.location.href=\"enreach_addnews.php\"</script>";
}

?>
<HTML>
<HEAD>
<TITLE>EnReach新闻系统</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<link href="css.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY BGCOLOR=#94C329 LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<!-- ImageReady Slices (未命名-1.tif) -->
<TABLE WIDTH=410 BORDER=0 align="center" CELLPADDING=0 CELLSPACING=0 id="blue_font">
<TR>
<TD> <IMG SRC="images/enreachnews_01.gif" WIDTH=410 HEIGHT=25 ALT=""></TD>
</TR>
<TR>
<TD height="88" align="center" background="images/enreachnews_02.gif">
<form action="enreach_login.php" name="loginform" method="post">
请输入密码登录:
<input name="password" type="text" id="password">
<INPUT name="提交" type="submit" style="height:20; font:9pt; BORDER-BOTTOM: #cccccc 1px groove; BORDER-RIGHT: #cccccc 1px groove; BACKGROUND-COLOR: #eeeeee" value="提交" >
</form>
</TD>
</TR>
<TR>
<TD> <IMG SRC="images/enreachnews_04.gif" WIDTH=410 HEIGHT=30 ALT=""></TD>
</TR>
</TABLE>
<!-- End ImageReady Slices -->
</BODY>
</HTML>
<?
}else
echo "<script>window.location.href=\"enreach_addnews.php\"</script>";
?>
...全文
77 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
多菜鸟 2004-02-03
  • 打赏
  • 举报
回复
在逻辑上好像有点儿错。
第一次进入该页面的时候,就会先定义$isadmin,验证密码就不再通过条件判断了。。
Cain 2004-02-02
  • 打赏
  • 举报
回复
if($isadmin!="yes"){

21,890

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧