Home >Backend Development >PHP Tutorial > thinkphp会员登录密码验证md5有关问题

thinkphp会员登录密码验证md5有关问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:40:11935browse

thinkphp会员登录密码验证md5问题。
会员注册的时候密码md5加密存到数据库了,现在会员登录要md5密码之后去数据库查询应该怎么写?我获取表单md5后去数据库查询为什么不一样了,我的代码是

class AdminAction extends Action{<br />
       function index(){<br />
	  if(isset($_POST['username'])){<br />
	        if(isset($_POST['username'])&&isset($_POST['password'])){<br />
			    $secure_code = C('SECURE_CODE');<br />
			    $userpassword=md5($secure_code.md5($_POST["password"]));<br />
			    $db=M();<br />
				$select=$db->query("select * from developers where username=".$_POST['username']." and password=".$userpassword."");<br />
				 echo $db->getLastSql();exit;


应该怎么写呢?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn