本文整理汇总了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;
}
示例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();
}