免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12
最近访问板块 发新帖
楼主: dscl521
打印 上一主题 下一主题

关于登录问题 [复制链接]

论坛徽章:
0
11 [报告]
发表于 2006-10-25 13:57 |只看该作者
看到了
只是修改后,还是输入任何用户名和密码都是在login.php的那页.

论坛徽章:
0
12 [报告]
发表于 2006-10-25 14:15 |只看该作者
<html><head><title>后台管理</title></head><body>
<?php
$user=trim($_POST['user']);
$user = addslashes($user);
$password=trim($_POST['password']);
if(isset($user) && strlen($user) > 0)
{
$lnk = mysql_connect("localhost", "root", "dscl521");
mysql_select_db("school",$lnk) or die ("不能连接到数据库!");
//判断用户名和密码是否在正确
/*注意这里*/
$strSql="select * from user where user='$user' and password='$password'";
$result=mysql_query($strSql);// or die("读取数据库出现错误!");
$num=mysql_num_rows($result);

if($num > 0)
{
header("location:mainad.php");
}
else
{
header("location:login.php");
}
}
?>
</body></html>

---------------------------------------

sql查询语句写法错误.

论坛徽章:
0
13 [报告]
发表于 2006-10-25 15:47 |只看该作者
谢谢圣骑士,程序已经好使了.

论坛徽章:
1
技术图书徽章
日期:2013-12-05 23:25:45
14 [报告]
发表于 2006-10-26 11:06 |只看该作者
咋不用PHPTools啊,ctrl+F3,就告诉你变量是否定一了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP