Home  >  Article  >  Backend Development  >  PHP user password modification code

PHP user password modification code

WBOY
WBOYOriginal
2016-07-25 09:04:041949browse
  1. @session_start();
  2. require_once("../inc/ring_admin.php");
  3. require_once("../../inc/connect.php");
  4. require_once ("../../admin/inc/function.php");
  5. ring_login();
  6. $pwd = get_value('pwd','post');
  7. $pwd2 = get_value('pwd2','post ');
  8. $pwd3 = get_value('pwd3','post');
  9. $sql = "select * from gx_member where m_pwd='".md5($pwd)."' and m_name='".$_SESSION[ 'uid']."'";
  10. if( $pwd2!=$pwd3 || strlen( $pwd2)<6 || strlen( $pwd2)>12 ){
  11. alert('Two input new The password is incorrect, please re-enter!','');
  12. }else{
  13. if(mysql_num_rows( mysql_query($sql) ) ){
  14. $sql="Update gx_member set m_pwd='".md5($pwd2). "' where m_name='".$_SESSION['uid']."'";
  15. mysql_query($sql) or die(mysql_error());
  16. alert('Password changed successfully!','');
  17. } else{
  18. alert('The old password is incorrect, please re-enter!','');
  19. }
  20. }
  21. ?>
Copy code


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