当前位置: 首页>>代码示例>>PHP>>正文


PHP SessionUtils类代码示例

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


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

示例1: checkLogin

 public function checkLogin($usr = '', $pass = '')
 {
     /*inicialmente validaremos contra datos preestablecidos que podrían venir por ejemplo, de una base de datos*/
     if ($usr == self::$user && $pass == self::$password) {
         self::$loggedin = true;
         self::$arrUsuario['user'] = self::$user;
         $_SESSION['auth_user'] = self::$user;
         $_SESSION['auth_pass'] = self::$password;
         parent::set("auth_user", self::$user);
         parent::set("auth_pass", self::$password);
         return true;
     } else {
         self::$arrUsuario = array();
         self::$loggedin = false;
         return false;
     }
     $auth = new SessionUtils();
     if ($auth->checkLogin('test', 'test')) {
         echo "ok";
         print_r($_SESSION);
         print_r($_COOKIE);
     } else {
         echo "fail";
     }
 }
开发者ID:karinaEsto94,项目名称:proyectoEjemplo,代码行数:25,代码来源:SessionUtils.php

示例2: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->deleteAllUsers();
     $this->createNewUsers();
     SessionUtils::saveSessionObject('user', $this->usersArray['admin']);
 }
开发者ID:rakesh-mohanta,项目名称:icehrm,代码行数:7,代码来源:TestTemplate.php

示例3: insertNewUserAddressVisited

 public function insertNewUserAddressVisited(\AddressDTO $addressDTO)
 {
     try {
         $this->userAutentication();
         $userLogged = SessionUtils::getUserLogged();
         $newAddress = array(":" . USERID => $userLogged->getUserId(), ":" . LONGITUDE => $addressDTO->getLongitude(), ":" . LATITUDE => $addressDTO->getLatitude(), ":" . TIMESTAMP => date(DATE_FORMAT));
         $newAddressId = $this->getDB()->insert(USER_ADDRESS_VISITED_TABLE, $newAddress);
         return $newAddressId;
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:sbadi,项目名称:shareatrip,代码行数:14,代码来源:AddressDAO.php

示例4: testSession

 public function testSession()
 {
     try {
         $userLogged = SessionUtils::getUserLogged();
         $username = $userLogged->getUserName();
         $sessionToken = SessionUtils::getSessionToken();
         $query = "select * from sat_user where USERNAME = {$username} and SESSION_TOKEN = {$sessionToken}";
         return $this->execQuery($query);
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:sbadi,项目名称:shareatrip,代码行数:14,代码来源:Database.php

示例5: deleteFriendModel

 function deleteFriendModel($friendId)
 {
     try {
         $responseDTO = new ResponseDTO(DELETE_FRIEND_FORM);
         $friendsDAO = new FriendsDAO();
         $oldFriend = $friendsDAO->deleteFriend($friendId);
         SessionUtils::deleteFriendInUserLoggedFriendList($friendId);
         $responseDTO->setResponseSucc("friend" . $friendId);
         return $responseDTO;
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         throw $authExp;
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:sbadi,项目名称:shareatrip,代码行数:17,代码来源:Friends_model.php

示例6: updateProfilePhoto

 public function updateProfilePhoto(\PhotoDTO $userProfilePhotoDTO)
 {
     $userLogged = SessionUtils::getUserLogged();
     $set = array(PROFILEPHOTO => $userProfilePhotoDTO->getPhotoId());
     $where = array(USERID => $userLogged->getUserId());
     try {
         $this->userAutentication();
         $userPhoto = $this->getDB()->update(USER_TABLE, $set, $where);
         DataModelUtils::notifyAction($userProfilePhotoDTO->getPhotoId() . SEPARATOR . $userProfilePhotoDTO->getPhotoUrl(), PROFILE_SETTINGS_PHOTO_FORM);
         return $userProfilePhotoDTO;
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         throw $authExp;
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:sbadi,项目名称:shareatrip,代码行数:18,代码来源:PhotoDAO.php

示例7: deleteAlbum

 public function deleteAlbum($albumId)
 {
     try {
         $model = $this->getModel();
         $deletedAlbum = $model->deleteAlbumModel($albumId);
         if (isset($_POST[JAVASCRIPT_ON]) && $_POST[JAVASCRIPT_ON] === "Y") {
             echo json_encode($deletedAlbum->jsonSerialize());
         } else {
             SessionUtils::setError($deletedAlbum);
             header("Location: " . URL . ALBUM_CONTROLLER);
             exit;
         }
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         parent::userNotLogged($authExp);
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:sbadi,项目名称:shareatrip,代码行数:20,代码来源:Album.php

示例8: uploadPhotoModel

 public static function uploadPhotoModel($uploadedPhoto, $albumId, $formType, $latitude = NULL, $longitude = NULL)
 {
     $responseDTO = new ResponseDTO($formType);
     try {
         $userLogged = SessionUtils::getUserLogged();
         $fileName = $uploadedPhoto["name"];
         $fileType = $uploadedPhoto["type"];
         $tmpFileName = $uploadedPhoto["tmp_name"];
         $rawImage = FileUtils::getRawImage($fileType, $tmpFileName);
         $fileName = FileUtils::getFileName($fileName, $userLogged->getUserId(), $albumId);
         $redimImage = FileUtils::getRedimensionedImage($tmpFileName, $rawImage);
         if (imagejpeg($redimImage, $fileName, 100)) {
             $photoDAO = new PhotoDAO();
             $newPhotoDTO = new PhotoDTO(NULL, $fileName, $latitude, $longitude);
             $newPhotoDTO = $photoDAO->insertNewPhoto($newPhotoDTO);
             if ($newPhotoDTO->getPhotoId() == 0) {
                 $responseDTO->setErrField(ERROR_RESPONSE, "Errore durante l'inserimento della foto [" . $newPhotoDTO->getPhotoUrl() . "]");
             } else {
                 $albumDAO = new AlbumDAO();
                 if (is_null($albumId)) {
                     $albumId = $albumDAO->getDefaultAlbumId($userLogged->getUserId());
                 }
                 if ($formType !== ADD_ALBUM_FORM) {
                     $photoInAlbumId = $albumDAO->insertNewUserPhotoAlbum($userLogged->getUserId(), $albumId, $newPhotoDTO->getPhotoId());
                 }
                 if (!is_null($latitude) && !is_null($longitude)) {
                     $uploadedAddress = FileUtils::saveAddressModel($latitude, $longitude, $formType);
                 }
                 return $newPhotoDTO;
             }
         } else {
             $responseDTO->setErrField(ERROR_RESPONSE, "Errore durante la copia del file sul server PHP");
         }
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $userAuth) {
         throw $userAuth;
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:sbadi,项目名称:shareatrip,代码行数:41,代码来源:FileUtils.php

示例9: userAutentication

 function userAutentication()
 {
     try {
         $userLogged = SessionUtils::getUserLogged();
         $sessionToken = SessionUtils::getSessionToken();
         if (!is_null($userLogged)) {
             $query = "select * from  sat_user where userid = " . $userLogged->getUserId() . " and SESSION_TOKEN = '" . $sessionToken . "'";
             $objectArray = $this->getDB()->execQuery($query);
             if (is_null($objectArray)) {
                 $myException = new UserNotAuthenticatedExceptionDTO(URL . LOGIN_CONTROLLER);
                 throw $myException;
             }
         }
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $userAuth) {
         throw $userAuth;
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:sbadi,项目名称:shareatrip,代码行数:21,代码来源:BaseDataAccess.php

示例10: forgotPassword

 public function forgotPassword()
 {
     try {
         $model = $this->getModel();
         $forgotPwdjax = NULL;
         if (isset($_GET["forgotPasswordForm"])) {
             $forgotPwdjax = json_decode($_GET["forgotPasswordForm"], true);
             $forgottenPwd = $model->forgotPasswordModel($forgotPwdjax);
             echo json_encode($forgottenPwd->jsonSerialize());
         } else {
             $forgottenPwd = $model->forgotPasswordModel($forgotPwdjax);
             SessionUtils::setError($forgottenPwd);
             header("Location:" . URL . FORGOT_PWD_CONTROLLER);
             exit;
         }
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:sbadi,项目名称:shareatrip,代码行数:21,代码来源:ForgotPwd.php

示例11: forgotPasswordModel

 public function forgotPasswordModel($forgotPasswordForm)
 {
     $formObjRaw = new FormDTO(FORGOT_PWD_FORM, $forgotPasswordForm);
     $responseDTO = new ResponseDTO(FORGOT_PWD_FORM);
     try {
         $formDataObj = $formObjRaw->getFormData();
         $validator = new FormValidator(FORGOT_PWD_FORM, $formDataObj);
         $validationError = $validator->checkAll();
         if (sizeof($validationError) == 0) {
             $userDAO = new UserDAO();
             $userDTO = $userDAO->getUserByEmail($formDataObj[FORGOT_PWD_FORM . EMAIL]);
             if (is_null($userDTO)) {
                 $responseDTO->setErrField(ERROR_RESPONSE, "Nessun user presente con questa mail");
             } else {
                 $newPassword = PasswordUtils::createRandomicPassword();
                 $userDTO->setPassword($newPassword);
                 $resultMail = DataModelUtils::sendMail($userDTO, FORGOT_PWD_FORM);
                 $hashedPwd = PasswordUtils::getPassword($newPassword);
                 $userDTO->setPassword($hashedPwd);
                 $result = $userDAO->updateUserPassword($userDTO);
                 if ($result != 1) {
                     $responseDTO->setErrField(ERROR_RESPONSE, "Problema nel cambio della password");
                 } else {
                     $responseDTO->setResponseSucc("Verra mandata una mail con una nuova password all'indirizzo " . $userDTO->getEmail());
                 }
             }
         } else {
             if (array_key_exists(EMAIL, $validationError)) {
                 $responseDTO->setErrField(EMAIL, $validationError[EMAIL]);
             }
             SessionUtils::setFormValue($formDataObj);
         }
         return $responseDTO;
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:sbadi,项目名称:shareatrip,代码行数:39,代码来源:ForgotPwd_model.php

示例12: getUnreadNotificationList

 public function getUnreadNotificationList($limit = NULL)
 {
     $userLogged = SessionUtils::getUserLogged();
     if (is_null($limit)) {
         $query = "select * from sat_notify where SUBJECT_ID = " . $userLogged->getUserId() . " and IS_READ = 0 order by sent_at desc ";
     } else {
         $query = "select * from sat_notify where SUBJECT_ID = " . $userLogged->getUserId() . " and IS_READ = 0 order by sent_at desc ";
     }
     try {
         $objectArray = $this->getDB()->execQuery($query);
         if (is_null($objectArray)) {
             return NULL;
         } else {
             $objectListDTO = DataModelUtils::getObjectList(NOTIFICATIONDTO, $objectArray);
             return $objectListDTO;
         }
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:sbadi,项目名称:shareatrip,代码行数:22,代码来源:NotificationDAO.php

示例13: confirmFriendshipModel

 public function confirmFriendshipModel($notificationId, $userForm)
 {
     $formObjRaw = new FormDTO(CONFIRM_FRIENDSHIP_FORM, $userForm);
     $formObjRaw->setSubElementId($notificationId);
     try {
         $formDataObj = $formObjRaw->getFormData();
         $friendDAO = new FriendsDAO();
         $result = $friendDAO->confirmFriendship($formDataObj[CONFIRM_FRIENDSHIP_FORM . FRIENDID]);
         $userDAO = new UserDAO();
         $friendDTO = $userDAO->getUserByUserId($formDataObj[CONFIRM_FRIENDSHIP_FORM . FRIENDID]);
         $friendDTO->setPassword(NULL);
         $notificationDAO = new NotificationDAO();
         $result = $notificationDAO->setNotificationAsRead($formDataObj[CONFIRM_FRIENDSHIP_FORM . NOTIFICATIONID]);
         SessionUtils::addFriendInUserLoggedFriendList($friendDTO, date(DATE_FORMAT));
         DataModelUtils::notifyAction($friendDTO->getUserId() . SEPARATOR . $friendDTO->getUserName(), CONFIRM_FRIENDSHIP_FORM);
         return $friendDTO;
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:sbadi,项目名称:shareatrip,代码行数:22,代码来源:Notification_model.php

示例14: getFriendsList

 public function getFriendsList($userProfile)
 {
     if (!SessionUtils::isAdmin()) {
         $query = "select ut.*, pt.*, tmp.FRIENDSSINCE \n                    from sat_user ut, sat_photo pt, ( \n                    select FRIENDID as USERID,FRIENDSSINCE \n                    from sat_user_friends \n                    where USERID = {$userProfile} \n                    UNION \n                    select USERID, FRIENDSSINCE \n                    from sat_user_friends \n                    where FRIENDID = {$userProfile} \n                    ) tmp \n                    where ut.profilephoto = pt.photoid and tmp.USERID = ut.USERID";
     } else {
         $query = "select distinct ut.*, pt.*, NULL AS FRIENDSSINCE from sat_user ut, sat_photo pt where ut.role <> 'ADMIN' and ut.profilephoto = pt.photoid ";
     }
     try {
         $this->userAutentication();
         $objectArray = $this->getDB()->execQuery($query);
         if (is_null($objectArray)) {
             return NULL;
         } else {
             $objectListDTO = DataModelUtils::getObjectList(FRIENDSDTO, $objectArray);
             return $objectListDTO;
         }
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:sbadi,项目名称:shareatrip,代码行数:22,代码来源:FriendsDAO.php

示例15: deleteUser

 public function deleteUser($userId)
 {
     try {
         $model = $this->getModel();
         $deletedUser = $model->deleteUserModel($userId);
         FileUtils::deleteAlbumDirOnServer($userId, NULL);
         if (isset($_POST[JAVASCRIPT_ON]) && $_POST[JAVASCRIPT_ON] === "Y") {
             echo json_encode($deletedUser->jsonSerialize());
         } else {
             $responseDTO = new ResponseDTO(DELETE_USER_FORM);
             $responseDTO->setResponseSucc("Utente eliminato con successo");
             SessionUtils::setError($responseDTO);
             header("Location: " . URL . USERLIST_CONTROLLER);
             exit;
         }
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         parent::userNotLogged($authExp);
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:sbadi,项目名称:shareatrip,代码行数:23,代码来源:UserList.php


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