Example #1
0
 /**
  *
  * @do my data
  *
  * @access public 
  * @author Nick
  * @copyright rockhippo
  * @param -
  * @return -
  *
  */
 public function mydataAction()
 {
     global $G_X;
     $user = XSession::Get("TA_user");
     $userModel = new PSys_UserModel();
     if ($this->ispost) {
         $where = array();
         $where['user_id'] = $user['id'];
         $data = array();
         $data['nick'] = reqstr("nick", "");
         $data['age'] = reqstr("age", "");
         $data['phone'] = reqstr("phone", "");
         $data['address'] = reqstr("address", "");
         $data['photo'] = reqstr("photo", "");
         $return = $userModel->UpdateOne($data, $where, "ta_user_information");
         if ($return) {
             $this->jump("Edit success.", "success", "/index/mydata", 1);
         } else {
             $this->jump("Edit failed.", "errors", "/index/mydata", 1);
         }
         exit;
     }
     $where = array();
     $where['id'] = $user['id'];
     $data = $userModel->GetOne($where, "*", "view_user");
     $timestamp = time();
     $timestamp_token = md5($G_X['upload']['unique_salt'] . $timestamp);
     $this->smarty->assign("timestamp", $timestamp);
     $this->smarty->assign("timestamp_token", $timestamp_token);
     $this->smarty->assign("data", $data);
     $this->forward = "mydata";
 }
Example #2
0
 /**
  *
  * @do 删除菜单
  *
  * @access public 
  * @author Nick
  * @copyright rockhippo
  * @param -
  * @return -
  *
  */
 public function deleteAction()
 {
     $id = reqnum("id", 0);
     if ($id == 0) {
         $this->jump('The user id is error.', 'errors', '/user/index');
         exit;
     }
     if ($id == 1) {
         $this->jump('Admin can not be delete.', 'errors', '/user/index');
         exit;
     }
     //删除
     $PSys_UserModel = new PSys_UserModel();
     $return = $PSys_UserModel->DeleteUser($id);
     if ($return) {
         $this->operateLogs(1);
         $this->jump('Delete success.', 'success', '/user/index');
     } else {
         $this->operateLogs(0);
         $this->jump('Delete failed.', 'errors', '/user/index');
     }
     exit;
 }