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


PHP Db::querySingleOne方法代码示例

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


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

示例1: assignKey

 public function assignKey($userId, $keyId)
 {
     if (!($uidKey = Db::querySingleOne('SELECT `uid_key` FROM `lock_attempts` WHERE `id` = ?', [$keyId]))) {
         return ['s' => 'error', 'cs' => 'Nepovedlo se vybrat správný záznam přístupu', 'en' => 'Sorry, we were not able to take right access record'];
     }
     if (Db::queryModify('UPDATE `users` SET `uid_key` = ? WHERE id_user = ?', [$uidKey, $userId])) {
         return ['s' => 'success', 'cs' => 'Povedlo se přidat právo vstupu', 'en' => 'Access was successfully assigned'];
     } else {
         return ['s' => 'error', 'cs' => 'Nepovedlo se přidat práva ke vstupu k uživateli', 'en' => 'Access was not assigned to a member'];
     }
 }
开发者ID:ParalelniPolis,项目名称:TMS2,代码行数:11,代码来源:AssignLock.php

示例2: checkInputs

 public function checkInputs($newAdminId, $newAdminPlacesId)
 {
     if (!Db::querySingleOne('SELECT id_user FROM users WHERE id_user = ?', [$newAdminId])) {
         return ['s' => 'error', 'cs' => 'Uživatel nenalezen', 'en' => 'User not find'];
     }
     foreach ($newAdminPlacesId as $a) {
         if (!Db::querySingleOne('SELECT id FROM places WHERE id = ?', [$a])) {
             return ['s' => 'error', 'cs' => 'Place id ' . $a . ' nenalezeno', 'en' => 'Place with id ' . $a . ' is not find'];
         }
     }
     return ['s' => 'success'];
 }
开发者ID:vane00ssa,项目名称:TMS2,代码行数:12,代码来源:MakeAdmin.php

示例3: isKeyValid

    public function isKeyValid($key, $lockName)
    {
        $result = Db::querySingleOne('SELECT `uid_key` FROM `users`
			JOIN `tariffs` ON `tariffs`.`id_tariff` = `users`.`user_tariff`
			JOIN `places` ON `places`.`id` = `tariffs`.`place_id`
			JOIN `locks` ON `locks`.`id_place` = `places`.`id`
			WHERE `uid_key` = ? && `lock_name` = ?', [$key, $lockName]);
        if ($result) {
            return true;
        } else {
            return false;
        }
    }
开发者ID:ParalelniPolis,项目名称:TMS2,代码行数:13,代码来源:Locks.php

示例4: getPaymentFlag

 private function getPaymentFlag($userId)
 {
     $r = Db::querySingleOne('SELECT `status` FROM `payments`
                              WHERE `id_payer` = ? ORDER BY ?, ?, `status` DESC', [$userId, 'received', 'confirmed']);
     if ($r == 'received' || $r == 'confirmed') {
         return 'success';
     }
     if (empty($r)) {
         return 'unknown';
     } else {
         return 'error';
     }
 }
开发者ID:ParalelniPolis,项目名称:TMS2,代码行数:13,代码来源:CheckUsers.php

示例5: validateCsrfRequest

 public static function validateCsrfRequest($returnedToken)
 {
     $storedToken = Db::querySingleOne('SELECT `token` FROM `csrf`
                                        WHERE `user_id` = ? AND `active` = 1
                                        ORDER BY `id` DESC', [$_SESSION['id_user']]);
     //unactive all entries
     Db::queryModify('UPDATE `csrf` SET `active` = 0 WHERE `user_id` = ? AND `active` = 1', [$_SESSION['id_user']]);
     //add referer uri into hash to get stored value
     $returnedRefererToken = hash('sha512', $_SERVER['HTTP_REFERER'] . $returnedToken, false);
     if ($storedToken == $returnedRefererToken) {
         return true;
     } else {
         self::newTicket('warning', $_SESSION['id_user'], 'Possible CSRF attack (returned false on stored token ' . $storedToken);
         return false;
     }
 }
开发者ID:vane00ssa,项目名称:TMS2,代码行数:16,代码来源:Csrf.php

示例6: isLinkValid

 public function isLinkValid($validationLink)
 {
     if (empty($validationLink)) {
         return ['error', 'Aktivační klíč je prázdný'];
     }
     $link = Db::querySingleOne('SELECT `validation_string` FROM `restart_password`
                                 JOIN `users` ON `users`.`email` = `restart_password`.`email`
                                 WHERE `validation_string` = ?', [$validationLink]);
     //link is not in database
     if ($link[0] == null) {
         return ['s' => 'error', 'cs' => 'Link pro validaci není v databázi', 'en' => 'Link for validation is not in our database'];
     }
     $timeOfAttempt = date("Y-m-d H:i:s", time() - CHANGE_PASS_TIME_VALIDITY);
     $restart = Db::queryOne('SELECT `timestamp` FROM `restart_password`
                              WHERE `validation_string` = ? && `active` = ?', [$validationLink, 1]);
     if ($restart[0] == null) {
         return ['s' => 'error', 'cs' => 'Link už byl použit. <a href"' . ROOT . '/cs/GetLinkForNewPassword">Získat nový link pro změnu hesla?</a>', 'en' => 'Link is already used. <a href"' . ROOT . '/en/GetLinkForNewPassword">Get a new restart password link?</a>'];
     }
     if ($restart['timestamp'] < $timeOfAttempt) {
         return ['s' => 'error', 'cs' => 'Vypršela časová platnost linku. <a href"' . ROOT . '/cs/GetLinkForNewPassword">Získat nový link pro změnu hesla?</a>', 'en' => 'Link is timed up. <a href"' . ROOT . '/en/GetLinkForNewPassword">Get a new restart password link?</a>'];
     }
     return ['success'];
 }
开发者ID:vane00ssa,项目名称:TMS2,代码行数:23,代码来源:RestartPasswordByLink.php

示例7: getStatusOfPaymentFromExtraId

    public function getStatusOfPaymentFromExtraId($extraId)
    {
        return Db::querySingleOne('SELECT `status` FROM `payments`
 			JOIN `extras` ON `extras`.`payment_id` = `payments`.`id_payment`
			WHERE `id_extra` = ?', [$extraId]);
    }
开发者ID:ParalelniPolis,项目名称:TMS2,代码行数:6,代码来源:Extras.php

示例8: getPaymentStatus

    public function getPaymentStatus($paymentId)
    {
        return Db::querySingleOne('SELECT `status` FROM `payments` 
			WHERE id_payment = ?', [$paymentId]);
    }
开发者ID:ParalelniPolis,项目名称:TMS2,代码行数:5,代码来源:Bitcoinpay.php

示例9: getUserIdFromInvoiceId

 public function getUserIdFromInvoiceId($invoiceId)
 {
     return Db::querySingleOne('SELECT `id_payer` FROM `payments` WHERE `invoice_fakturoid_id` = ?', [$invoiceId]);
 }
开发者ID:vane00ssa,项目名称:TMS2,代码行数:4,代码来源:FakturoidWrapper.php

示例10: getPaymentIdFromFakturoidInvoiceId

 private function getPaymentIdFromFakturoidInvoiceId($fakturoidInvoiceId)
 {
     return Db::querySingleOne('SELECT `id_payment` FROM `payments` WHERE `invoice_fakturoid_id` = ?', [$fakturoidInvoiceId]);
 }
开发者ID:ParalelniPolis,项目名称:TMS2,代码行数:4,代码来源:Payments.php

示例11: makeNewPayments

 public function makeNewPayments($user, $tariff, $lang)
 {
     $active = $user['active'];
     if ($active) {
         $new = false;
         $userId = $user['id_user'];
         $dbStartDate = $user['invoicing_start_date'];
         $currentDate = date('Y-m-d');
         $startOfLastGeneratedMonth = Db::querySingleOne('
             SELECT `payment_first_date` FROM `payments`
             WHERE `id_payer` = ?
             ORDER BY `payment_first_date` DESC', [$userId]);
         if (empty($startOfLastGeneratedMonth)) {
             //add beginning for new user
             $startDate = $dbStartDate;
         } else {
             //or deside when if use last day of previous payment or newly begin set
             if (strtotime($startOfLastGeneratedMonth) >= strtotime($dbStartDate)) {
                 $startDate = date('Y-m-d', strtotime($startOfLastGeneratedMonth . ' +1 month'));
             } else {
                 $startDate = $dbStartDate;
             }
         }
         //and add following invoices till today
         while (strtotime($startDate) <= strtotime($currentDate)) {
             $this->createPayment($user, $tariff, $startDate, $lang);
             $startDate = date('Y-m-d', strtotime($startDate . ' +1 month'));
             $new = true;
         }
         if ($new == true) {
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:vane00ssa,项目名称:TMS2,代码行数:38,代码来源:Payments.php

示例12: getBitcoinpayId

 public function getBitcoinpayId($paymentId)
 {
     return Db::querySingleOne('SELECT `bitcoinpay_payment_id` FROM `payments`
         WHERE `id_payment` = ?', [$paymentId]);
 }
开发者ID:vane00ssa,项目名称:TMS2,代码行数:5,代码来源:Bitcoinpay.php

示例13: getTariffName

 public function getTariffName($tariffId, $lang)
 {
     if ($lang == 'cs') {
         return Db::querySingleOne('SELECT `tariffCZE` FROM `tariffs`
         WHERE `id_tariff` = ?', [$tariffId]);
     }
     if ($lang == 'en') {
         return Db::querySingleOne('SELECT `tariffENG` FROM `tariffs`
         WHERE `id_tariff` = ?', [$tariffId]);
     }
     return false;
 }
开发者ID:vane00ssa,项目名称:TMS2,代码行数:12,代码来源:Model.php

示例14: getFakturoidIdFromUserId

 public function getFakturoidIdFromUserId($userId)
 {
     return Db::querySingleOne('SELECT `fakturoid_id` FROM `users` WHERE `id_user` = ?', [$userId]);
 }
开发者ID:ParalelniPolis,项目名称:TMS2,代码行数:4,代码来源:FakturoidWrapper.php


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