当前位置: 首页>>代码示例>>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;未经允许,请勿转载。