mypass.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. class mypass_c extends Control
  3. {
  4. function __construct()
  5. {
  6. parent::Control();
  7. $this->load_model("admin");
  8. }
  9. function mypass_c()
  10. {
  11. $this->__construct();
  12. }
  13. function index_f()
  14. {
  15. $this->tpl->display("mypass.html");
  16. }
  17. function setok_f()
  18. {
  19. $oldpass = $this->trans_lib->safe("oldpass");
  20. $newpass = $this->trans_lib->safe("newpass");
  21. $chkpass = $this->trans_lib->safe("chkpass");
  22. if(!$oldpass || !$newpass || !$chkpass)
  23. {
  24. error("所有加星号的文本框均必须填写!",site_url("mypass"));
  25. }
  26. if($newpass != $chkpass)
  27. {
  28. error("两次输入的新密码不一致!",site_url("mypass"));
  29. }
  30. $rs = $this->admin_m->get_one($_SESSION["admin_id"]);
  31. if($rs["pass"] != sys_md5($oldpass))
  32. {
  33. error("旧密码输入不正确!",site_url("mypass"));
  34. }
  35. $this->admin_m->update_pass($newpass,$_SESSION["admin_id"]);
  36. $rs["pass"] = sys_md5($newpass);
  37. $_SESSION[SYS_CHECKED_SESSION_ID] = sys_md5($rs);
  38. error("密码修改成功,请下次登录后使用新密码登录!",site_url("mypass"));
  39. }
  40. }
  41. ?>