當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Portfolio::getDatabase方法代碼示例

本文整理匯總了PHP中Portfolio::getDatabase方法的典型用法代碼示例。如果您正苦於以下問題:PHP Portfolio::getDatabase方法的具體用法?PHP Portfolio::getDatabase怎麽用?PHP Portfolio::getDatabase使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Portfolio的用法示例。


在下文中一共展示了Portfolio::getDatabase方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: modify

 /**
  * @param string $authCode7
  * @param string $username
  * @param string $password
  * @param string $passwordCurrent
  */
 public function modify($authCode7, $username, $password, $passwordCurrent)
 {
     $result = [];
     $result['code'] = 0;
     $result['msg'] = '';
     $user = $this->verifyAuthCode7($authCode7);
     if ($user === false) {
         $result['code'] = 1;
         $result['msg'] = 'Invalid authCode7';
         return $result;
     }
     $resultSet = $this->portfolio->getDatabase()->prepare('SELECT 1 FROM users WHERE id = :id AND password = :password')->setParameter('id', $user)->setParameter('password', $this->encryptPass($passwordCurrent))->executeQuery();
     if (!$resultSet->next()) {
         $result['code'] = 2;
         $result['msg'] = 'Uw huidige wachtwoord komt niet overeen.';
         return $result;
     }
     if (!empty($username) && strlen($username) >= 3) {
         $this->portfolio->getDatabase()->prepare('UPDATE users SET username = :username WHERE id = :id')->setParameter('username', $username)->setParameter('id', $user)->execute();
     }
     if (!empty($password) && strlen($password) >= 3) {
         $this->portfolio->getDatabase()->prepare('UPDATE users SET password = :password WHERE id = :id')->setParameter('password', $this->encryptPass($password))->setParameter('id', $user)->execute();
     }
     $result['code'] = 3;
     $result['msg'] = 'Uw gegevens zijn gewijzigd.';
     if (empty($username) && empty($password) && strlen($username) < 3 && strlen($password) < 3) {
         $result['code'] = 4;
         $result['msg'] = 'Er is niks gewijzigd.';
     }
     return $result;
 }
開發者ID:HetIsNiels,項目名稱:school-portfolio-website,代碼行數:37,代碼來源:UserManager.php

示例2: delete

 /**
  * @param int $page
  *
  * @return bool
  */
 public function delete($page)
 {
     return $this->portfolio->getDatabase()->prepare('UPDATE pages SET visible = 0 WHERE id = :page')->setParameter('page', $page)->execute();
 }
開發者ID:HetIsNiels,項目名稱:school-portfolio-website,代碼行數:9,代碼來源:PageManager.php


注:本文中的Portfolio::getDatabase方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。