• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP UserDAO类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中UserDAO的典型用法代码示例。如果您正苦于以下问题:PHP UserDAO类的具体用法?PHP UserDAO怎么用?PHP UserDAO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了UserDAO类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: insertBestelling

 public function insertBestelling($id, $keuze)
 {
     $userDAO = new UserDAO();
     $id = $userDAO->getByUserId($id);
     $bestregDAO = new BestregDAO();
     $bestel = $BestregDAO->insertBestreg($keuze);
 }
开发者ID:kristof-maurissen,项目名称:Broodjeszaak,代码行数:7,代码来源:BestregService.php


示例2: executeChange

function executeChange($currUser, $userid, $newrole)
{
    if ($newrole !== "1" && $newrole !== "2" && $newrole !== "3" && $newrole !== "4") {
        return "Invalid status!";
    }
    $userDAO = new UserDAO();
    $userChan = $userDAO->getUserByID($userid);
    $userCurr = $userDAO->getUserByID($currUser);
    //get current session user
    if ($userCurr->getRole()->getRoleID() !== "1" && $userCurr->getRole()->getRoleID() !== "2") {
        return "You have no right to change user status!";
    }
    if ($userChan === null) {
        //database
        return "Could not find this user!";
    }
    if ($userChan->getRole()->getRoleID() === $newrole) {
        //type
        return "Old status is equal to new status, don't need to change!";
    }
    if ($userCurr->getRole()->getRoleID() === "2") {
        if ($newrole === "1" || $newrole === "2") {
            return "You have no right to set an advanced user.";
        }
    }
    $roleDAO = new RoleDAO();
    $newroleObj = $roleDAO->getRoleByID($newrole);
    $userChan->setRole($newroleObj);
    $userDAO->updateUser($userChan);
    return true;
}
开发者ID:hstonec,项目名称:discussion,代码行数:31,代码来源:ajax_change_role.php


示例3: execChangeProfile

function execChangeProfile($firstname, $lastname, $sex, $departmentID)
{
    if (!isValidName($firstname) || !isValidName($lastname)) {
        return "Please enter valid names!";
    }
    if (!isValidID($departmentID)) {
        return "Invalid department id!";
    }
    $departDAO = new DepartmentDAO();
    $depart = $departDAO->getDepartmentByID($departmentID);
    if ($depart === null) {
        return "Could not find the depart!";
    }
    $userDAO = new UserDAO();
    $user = $userDAO->getUserByID($_SESSION["userID"]);
    $user->setDepartment($depart);
    if ($user->getFirstName() != $firstname) {
        $user->setFirstName($firstname);
    }
    if ($user->getLastName() != $lastname) {
        $user->setLastName($lastname);
    }
    if ($user->getGender() != $sex) {
        $user->setGender($sex);
    }
    if (isset($_FILES["uploadphoto"])) {
        $ans = uploadPhoto($user, $_FILES["uploadphoto"]);
        if ($ans !== true) {
            return $ans;
        }
    }
    $userDAO->updateUser($user);
    return true;
}
开发者ID:hstonec,项目名称:discussion,代码行数:34,代码来源:ajax_change_profile.php


示例4: execute

 function execute()
 {
     $user = json_decode($_GET['user']);
     $dao = new UserDAO();
     $user->id = $dao->create($user);
     echo json_encode($user);
 }
开发者ID:nazarmsx,项目名称:Simple-Blog,代码行数:7,代码来源:databaseoperations.php


示例5: executeChange

function executeChange($userID, $recordID, $newRecordStatus)
{
    if ($newRecordStatus !== "1" && $newRecordStatus !== "2" && $newRecordStatus !== "3") {
        return "Invalid status!";
    }
    $userDAO = new UserDAO();
    $user = $userDAO->getUserByID($userID);
    $recordDAO = new RecordDAO();
    $record = $recordDAO->getRecordByID($recordID);
    if ($record === null) {
        return "Could not find this record!";
    }
    if ($record->getDisplayStatus() === $newRecordStatus) {
        return "Old status is equal to new status, don't need to change!";
    }
    if ($user->getRole()->getRoleID() === "3") {
        if ($record->getUser()->getUserID() !== $userID) {
            return "You have no right to change group status!";
        }
        if ($newStatus === "3") {
            return "You have no right to delete this record!";
        }
    }
    if ($newRecordStatus !== "3") {
        $record->setDisplayStatus($newRecordStatus);
        $recordDAO->updateRecord($record);
        // Do not have updateRecord function
    } else {
        $recordDAO->deleteRecord($record);
        //Do not have this function
    }
    return true;
}
开发者ID:hstonec,项目名称:discussion,代码行数:33,代码来源:ajax_change_record_status.php


示例6: verify

function verify()
{
    if (isset($_GET["groupid"]) && isset($_GET["accept"])) {
        $groupID = $_GET["groupid"];
        if (!isValidID($groupID)) {
            return;
        }
        $groupDAO = new GroupDAO();
        $group = $groupDAO->getGroupByID($groupID);
        if ($group === null) {
            return;
        }
        $userDAO = new UserDAO();
        $user = $userDAO->getUserByID($_SESSION["userID"]);
        $gmDAO = new GroupMemberDAO();
        $gm = $gmDAO->getGroupMember($group, $user);
        if ($gm === null) {
            return;
        }
        $status = $gm->getAcceptStatus();
        if ($status == "1") {
            return;
        }
        if ($_GET["accept"] == "1") {
            $gm->setAcceptStatus("1");
            $gmDAO->updateGroupMember($gm);
        } elseif ($_GET["accept"] == "3") {
            $gmDAO->deleteGroupMember($gm);
        }
    }
}
开发者ID:hstonec,项目名称:discussion,代码行数:31,代码来源:accept.php


示例7: execEditGroup

function execEditGroup($userID, $groupID, $checkedUser)
{
    if (gettype($checkedUser) != "array") {
        return "Wrong type of group member!";
    }
    $checkedUser[] = $userID;
    $userDAO = new UserDAO();
    $user = $userDAO->getUserByID($userID);
    if (!isValidID($groupID)) {
        return "Invalid group ID!";
    }
    $groupDAO = new GroupDAO();
    $group = $groupDAO->getGroupByID($groupID);
    if ($group === null) {
        return "Group doesn't exist!";
    }
    if ($group->getOwner()->getUserID() !== $userID) {
        return "You are not the owner of this group!";
    }
    $gmDAO = new GroupMemberDAO();
    $gms = $gmDAO->getGroupMembersByGroup($group);
    foreach ($gms as $gm) {
        $alreadyUser = $gm->getUser();
        if (in_array($alreadyUser->getUserID(), $checkedUser)) {
            continue;
        }
        $gmDAO->deleteGroupMember($gm);
    }
    return true;
}
开发者ID:hstonec,项目名称:discussion,代码行数:30,代码来源:ajax_edit_group_member.php


示例8: testIsUserInDB

 function testIsUserInDB()
 {
     $conn = $this->db->getConnection();
     $udao = new UserDAO($this->logger, $this->db);
     $this->assertTrue($udao->isUserInDB(930061));
     $this->assertTrue(!$udao->isUserInDB(9.345465465465006E+16));
     $this->db->closeConnection($conn);
 }
开发者ID:nickthornley,项目名称:thinktank,代码行数:8,代码来源:userdao_test.php


示例9: uploadFile

function uploadFile($userID, $groupID, $file)
{
    $userDAO = new UserDAO();
    $user = $userDAO->getUserByID($userID);
    if ($user->getRole()->getRoleID() == "4") {
        return "This user was forbidden to upload file!";
    }
    if (!isValidID($groupID)) {
        return "Group id is not valid!";
    }
    $groupDAO = new GroupDAO();
    $group = $groupDAO->getGroupByID($groupID);
    if ($group === null) {
        return "Can not find this group!";
    }
    if ($group->getActivateStatus() === "2") {
        return "Group is not activated!";
    }
    $groupMemberDAO = new GroupMemberDAO();
    $groupMember = $groupMemberDAO->getGroupMember($group, $user);
    if ($groupMember === null) {
        return "User didn't belong to this group!";
    }
    if (gettype($file["error"]) == "array") {
        return "Only accept one file!";
    }
    $res = isValidUploadFile($file["error"]);
    if ($res !== true) {
        return $res;
    }
    $fileType = -1;
    $res = isValidImage($file["name"]);
    if ($res === true) {
        $fileType = "2";
    }
    $res = isValidFile($file["name"]);
    if ($res === true) {
        $fileType = "3";
    }
    if ($fileType === -1) {
        return "Only accepts jpeg/jpg/gif/png/zip file!";
    }
    $record = new Record($group, $user, $fileType, "temp", "1");
    $recordDAO = new RecordDAO();
    $recordDAO->insertRecord($record);
    $fileDir = "upload/";
    $filePath = $fileDir . $record->getRecordID() . "_" . $file["name"];
    $record->setContent($filePath);
    $recordDAO->updateRecord($record);
    if (file_exists($filePath)) {
        unlink($filePath);
    }
    if (!move_uploaded_file($file['tmp_name'], $filePath)) {
        return "Fail to move file, please contact administrator!";
    }
    return true;
}
开发者ID:hstonec,项目名称:discussion,代码行数:57,代码来源:ajax_upload_file.php


示例10: validate

 public function validate($messageManager)
 {
     $field = $this->form->getField($this->fieldName);
     $fieldValue = $field->getValue();
     $userDAO = new UserDAO();
     $userRecord = $userDAO->getRecordById($this->userId);
     if ($userRecord['userPassword'] != $fieldValue) {
         $messageManager->addMessage('invalidPassword', array($this->fieldName => $field->getCaption()));
     }
 }
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:10,代码来源:UserValidatorCurrentPassword.class.php


示例11: controlUser

 public function controlUser($userName, $password)
 {
     $dao = new UserDAO();
     $user = $dao->getByGebruikersnaam($userName);
     if (isset($user) && $user->getWachtwoord() == $password) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:kristof-maurissen,项目名称:login,代码行数:10,代码来源:UserService.php


示例12: testFetchInstanceUserInfo

 function testFetchInstanceUserInfo()
 {
     $tc = new TwitterCrawler($this->instance, $this->logger, $this->api, $this->db);
     $tc->fetchInstanceUserInfo();
     $udao = new UserDAO($this->db, $this->logger);
     $user = $udao->getDetails(36823);
     $this->assertTrue($user->id == 1);
     $this->assertTrue($user->user_id == 36823);
     $this->assertTrue($user->username == 'anildash');
     $this->assertTrue($user->found_in == 'Owner Status');
 }
开发者ID:ukd1,项目名称:thinktank,代码行数:11,代码来源:twittercrawler_test.php


示例13: validate

 public function validate($messageManager)
 {
     $field = $this->form->getField($this->fieldName);
     $fieldValue = $field->getValue();
     if ($fieldValue) {
         $dao = new UserDAO();
         if (!$dao->isActiveUser($fieldValue)) {
             $messageManager->addMessage('userDoesNotExist', array($this->fieldName => $field->getCaption()));
         }
     }
 }
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:11,代码来源:UserExistingEmailValidator.class.php


示例14: create

 function create()
 {
     $usr = new UserDAO();
     $usr->setName($_POST['name']);
     $usr->setAge($_POST['age']);
     $model = new UserModel();
     $res = $model->create($usr);
     if ($res == 1) {
         header("Location: " . SITE_URL . "/user/addnew/?e=1");
     }
 }
开发者ID:chamalC,项目名称:simple-mvc,代码行数:11,代码来源:user.php


示例15: __construct

 function __construct()
 {
     session_start();
     if (isset($_SESSION[AppConstants::SESSION_USER]) === false) {
         $_SESSION[AppConstants::SESSION_USER] = '';
         $_SESSION[AppConstants::SESSION_PASSWORD] = '';
     }
     $user = $_SESSION[AppConstants::SESSION_USER];
     $pass = $_SESSION[AppConstants::SESSION_PASSWORD];
     $userDao = new UserDAO();
     $this->_user_USR = $userDao->getUser($user, $pass);
 }
开发者ID:ithinkisam,项目名称:wishlist,代码行数:12,代码来源:session.class.php


示例16: call

 /**
  * Call
  */
 public function call()
 {
     $jsonObject = $this->app->request()->headers()->get('Authorization');
     $userAuth = json_decode($jsonObject);
     $userDAO = new UserDAO();
     if ($userAuth !== null && is_numeric($userAuth->id) && $userDAO->validateToken($userAuth->id, $userAuth->token)) {
         $this->app->authenticated = true;
     } else {
         $this->app->authenticated = false;
     }
     $this->next->call();
 }
开发者ID:kaelvofraga,项目名称:Pedal-to-Play-Server,代码行数:15,代码来源:TokenMiddleware.php


示例17: searchQuery

 public function searchQuery($queryTitle)
 {
     $dao = new QueryDAO();
     $queryId = $dao->getQueryIdByQueryTitle($queryTitle);
     if ($queryId != -1) {
         $this->result = $dao->getQueryById($queryId);
     } else {
         $this->result = -1;
     }
     $uid = getUID();
     $udao = new UserDAO();
     $this->result = ListQueriesController::filterQueries($this->result, $udao->selectUserById($uid));
 }
开发者ID:laiello,项目名称:qnet-ua2011,代码行数:13,代码来源:searchController.php


示例18: getUserInfoModel

 public function getUserInfoModel($userid)
 {
     try {
         $userDAO = new UserDAO();
         $personDTO = $userDAO->getUserInfo($userid);
         return $personDTO;
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         throw $authExp;
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:sbadi,项目名称:shareatrip,代码行数:14,代码来源:Home_model.php


示例19: validate

 public function validate($messageManager)
 {
     $userId = $this->form->getField('userId')->getValue();
     if (!empty($userId)) {
         $userDAO = new UserDAO();
         $user = $userDAO->getRecordById($userId);
         if (empty($user['id'])) {
             $messageManager->addMessage('errorInvalidUserId');
         }
         if ($user['userState'] != 'active') {
             $messageManager->addMessage('errorUserInactive');
         }
     }
 }
开发者ID:piotrPiechura,项目名称:3dPathProject,代码行数:14,代码来源:UserValidatorActiveUserId.class.php


示例20: getInstance

 /**
  * Returns unique instance of this DAO.
  * @return unique instance of this DAO.
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new UserDAO();
     }
     return self::$instance;
 }
开发者ID:mmr,项目名称:b1n,代码行数:11,代码来源:UserDAO.php



注:本文中的UserDAO类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP UserDB类代码示例发布时间:2022-05-23
下一篇:
PHP UserController类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap