首页 >后端开发 >php教程 > 用thinkphp写的用户登录界面,但是历次都说用户名或者密码不正确,求解

用thinkphp写的用户登录界面,但是历次都说用户名或者密码不正确,求解

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原创
2016-06-13 12:40:401019浏览

用thinkphp写的用户登录界面,但是每次都说用户名或者密码不正确,求解?

<?php<br />
session_start();<br />
header('Content-Type:text/html; charset=utf-8');<br />
class AdminAction extends Action{<br />
      public function index(){<br />
	  if(isset($_POST['username'])){<br />
	        if(isset($_POST['username'])&&isset($_POST['password'])){<br />
			    $db=M();<br />
				$select=$db->query("select * from developers where username=".$POST['username']." and password=".$_POST['password']."");<br />
				if($select){<br />
				    $_SESSION['admin']=$_POST['username'];<br />
					$this->redirect('Index/index','',2,'用户'.$_POST['username'].'登录成功!');<br />
                 }else{<br />
					$this->redirect('Index/index','',2,'用户名或者密码不正确');<br />
					}<br />
				}else{<br />
				    $this->redirect('Index/index','',2,'用户名或密码不能为空!');<br />
					}<br />
					}<br />
					$this->display();<br />
					}<br />
	}<br />
	?>

我不填提示我用户名或者密码不正确,我填正确了也提示我用户名或者密码不正确,不知道哪的问题,求解答。

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn