userAction.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. class userClassAction extends apiAction
  3. {
  4. public function editpassAction()
  5. {
  6. if(getconfig('systype')=='demo')$this->showreturn('演示上不要修改');
  7. $id = $this->adminid;
  8. $oldpass = $this->post('passoldPost');
  9. $pasword = $this->post('passwordPost');
  10. $msg = '';
  11. if($this->isempt($pasword))$msg ='新密码不能为空';
  12. if($msg == ''){
  13. $oldpassa = $this->db->getmou($this->T('admin'),"`pass`","`id`='$id'");
  14. if($oldpassa != md5($oldpass))$msg ='旧密码不正确';
  15. if($msg==''){
  16. if($oldpassa == md5($pasword))$msg ='新旧密码不能相同';
  17. }
  18. }
  19. if($msg == ''){
  20. if(!$this->db->record($this->T('admin'), "`pass`='".md5($pasword)."',`editpass`=`editpass`+1", "`id`='$id'"))$msg = $this->db->error();
  21. }
  22. if($msg==''){
  23. $this->showreturn('success');
  24. }else{
  25. $this->showreturn('',$msg, 201);
  26. }
  27. }
  28. //修改头像
  29. public function editfaceAction()
  30. {
  31. $fid = (int)$this->post('fid');
  32. $dbs = m('admin');
  33. $face= $dbs->changeface($this->adminid, $fid);
  34. if($face)$face = $dbs->getface($face);
  35. $this->showreturn($face);
  36. }
  37. //设置极光推送的regid
  38. public function setjpushidAction()
  39. {
  40. $id = $this->get('id');
  41. m('login')->update("`ip`='$id'", "`token`='$this->token' and `uid`='$this->adminid'");
  42. $this->showreturn('ok');
  43. }
  44. }
粤ICP备19079148号