<?php
session_start();
header('Content-Type:text/html; charset=utf-8');
class AdminAction extends Action{
public function index(){
if(isset($_POST['username'])){
if(isset($_POST['username'])&&isset($_POST['password'])){
$db=M();
$select=$db->query("select * from developers where username=".$POST['username']." and password=".$_POST['password']."");
if($select){
$_SESSION['admin']=$_POST['username'];
$this->redirect('Index/index','',2,'用户'.$_POST['username'].'登录成功!');
}else{
$this->redirect('Index/index','',2,'用户名或者密码不正确');
}
}else{
$this->redirect('Index/index','',2,'用户名或密码不能为空!');
}
}
$this->display();
}
}
?>
这是AdminAction代码,不知道怎么回事,不管输入什么或者不输人它都提示用户名或者密码不正确,为什么呢?哪的问题?
session_start();
header('Content-Type:text/html; charset=utf-8');
class AdminAction extends Action{
public function index(){
if(isset($_POST['username'])){
if(isset($_POST['username'])&&isset($_POST['password'])){
$db=M();
$select=$db->query("select * from developers where username=".$POST['username']." and password=".$_POST['password']."");
if($select){
$_SESSION['admin']=$_POST['username'];
$this->redirect('Index/index','',2,'用户'.$_POST['username'].'登录成功!');
}else{
$this->redirect('Index/index','',2,'用户名或者密码不正确');
}
}else{
$this->redirect('Index/index','',2,'用户名或密码不能为空!');
}
}
$this->display();
}
}
?>
这是AdminAction代码,不知道怎么回事,不管输入什么或者不输人它都提示用户名或者密码不正确,为什么呢?哪的问题?
解决方案 »
- 关于图片在服务器存储的问题
- 请教关于网页收藏功能的问题
- 求教!用PHP实现测试上传和下载的速度
- 请教个关于正则匹配的问题~
- 关于session和cookie
- 谁能看懂这个代码怎么形成的
- 关于Template循环问题比如<table><tr><td>{mycontent}</td></tr></table>非常感谢
- 求助各位PHP中文本框问题。在线等待!~
- 形如 index.php/explore-page/colors/pink-color 的地址栏 应该怎么理解?
- 这段代码中echo怎么不执行呢,高手给支个招
- 新手分享-数据查询结果按字段排序函数代码
- PHP 表单上传总是“upload NOT successful”
表单里的name属性有没有写错
表单里的name属性有没有写错
当然不可能写错了怎么会犯那么低级的错误...
表单里的name属性有没有写错
当然不可能写错了怎么会犯那么低级的错误...你的password没有MD5?
首先password md5了。数据库里也md5了。直接打印也还是没有username。密码能打印出来,就是username打印不出来
发现问题了没
username='".$_POST['username']."'
我晕,你发现了居然不指出来,他们也没发现,坑爹啊,直到现在才明白....
应该是$select=$db->query("select * from developers where username=".$_POST['username']." and password=".$_POST['password']."");
我晕,你发现了居然不指出来,他们也没发现,坑爹啊,直到现在才明白....
应该是$select=$db->query("select * from developers where username=".$_POST['username']." and password=".$_POST['password']."");
username='".$_POST['username']."'这种地方都要加上单引号