Home  >  Article  >  Backend Development  >  md5加密有关问题

md5加密有关问题

WBOY
WBOYOriginal
2016-06-13 13:42:101111browse

md5加密问题
 include("config.php");
 include("conn.php");

 if($_POST['submit']){

  $sql="insert into user (uid,m_id,username,password) " .
  "values ('','','$_POST[username]','md5($_POST[password].all_ps)')";
  mysql_query($sql);
 echo "";

 }

?>




 



  用户名:

  密码:
 


 


 


点击“注册”按钮后数据库中password字段的内容并没有被MD5加密,例如我密码输入“123",数据库里的内容就是
md5(123.all_ps),求教怎么回事啊。(all_ps是个常量)

------解决方案--------------------
'md5($_POST[password].all_ps)'
PHP只会处理字符串中的变量,也就是$_POST['password']. 你最好先把结果写入一个变量
------解决方案--------------------
修改你的SQL

$sql = "insert into user (uid,m_id,username,password) " . "values ('','','{$_POST['username']}','" . md5 ( $_POST ['password'] ) . all_ps . "')";
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