会员注册的时候密码md5加密存到数据库了,现在会员登录要md5密码之后去数据库查询应该怎么写?我获取表单md5后去数据库查询为什么不一样了,我的代码是
class AdminAction extends Action{
function index(){
if(isset($_POST['username'])){
if(isset($_POST['username'])&&isset($_POST['password'])){
$secure_code = C('SECURE_CODE');
$userpassword=md5($secure_code.md5($_POST["password"]));
$db=M();
$select=$db->query("select * from developers where username=".$_POST['username']." and password=".$userpassword."");
echo $db->getLastSql();exit;应该怎么写呢?
class AdminAction extends Action{
function index(){
if(isset($_POST['username'])){
if(isset($_POST['username'])&&isset($_POST['password'])){
$secure_code = C('SECURE_CODE');
$userpassword=md5($secure_code.md5($_POST["password"]));
$db=M();
$select=$db->query("select * from developers where username=".$_POST['username']." and password=".$userpassword."");
echo $db->getLastSql();exit;应该怎么写呢?
这个是把原来的密码加上什么东西了吧,在验证的时候你也加上不就完了
2:既然打印出最后一条语句了,把那个密码的MD5用眼睛去和数据库里加密的对比一下,是否一致?