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


PHP tools::writeCache方法代码示例

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


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

示例1: SUM

         }
     }
     $result['Auction'] = $auction;
     // writing data to the application cache
     if (!empty($_GET['histories'])) {
         $auction = tools::writeCache('auction_view_' . $value, $result);
     } else {
         $auction = tools::writeCache('auction_' . $value, $result);
     }
 }
 $result['User_id'] = $user_id;
 if (!empty($user_id)) {
     $balance = tools::readCache('bids_balance_' . $user_id);
     if (empty($balance)) {
         $balance = database::getInstance()->getRow("SELECT SUM(credit) - SUM(debit) AS balance FROM " . DB_PREFIX . "bids WHERE user_id = {$user_id}");
         tools::writeCache('bids_balance_' . $user_id, $balance);
     }
     $result['Balance'] = $balance['balance'];
 }
 $result['Auction']['price'] = $result['Auction']['price'];
 $result['Auction']['serverTimestamp'] = time();
 $result['Auction']['serverTimeString'] = date('d-m-Y, H:i:s');
 $result['Auction']['time_left'] = strtotime($result['Auction']['end_time']) - time();
 if ($result['Auction']['time_left'] <= 0 && $result['Auction']['closed'] == 0) {
     $result['Auction']['time_left'] = 1;
 }
 if ($site_online == 'no') {
     $result['Auction']['isPeakNow'] = 0;
     $result['Auction']['peak_only'] = 1;
 } else {
     $result['Auction']['isPeakNow'] = $isPeakNow;
开发者ID:7s4r,项目名称:eBidix,代码行数:31,代码来源:getstatus.php

示例2: getUserInfos

 private function getUserInfos()
 {
     if (isset($_SESSION['user_id']) && !empty($_SESSION['user_id'])) {
         $isOnline = tools::readCache('user_count_' . $_SESSION['user_id']);
         if (!empty($isOnline)) {
             tools::deleteCache('user_count_' . $_SESSION['user_id']);
             tools::writeCache('user_count_' . $_SESSION['user_id'], $_SESSION['user_id'], 300);
         } else {
             tools::writeCache('user_count_' . $_SESSION['user_id'], $_SESSION['user_id'], 300);
         }
         $balance = $this->db->select("fetch", "bids", "SUM(credit) - SUM(debit) AS total", array("user_id" => $_SESSION['user_id']));
         $this->user['balance'] = $balance['total'];
     }
 }
开发者ID:7s4r,项目名称:eBidix,代码行数:14,代码来源:appController.php

示例3: login

 function login()
 {
     if (isset($_SESSION['user_id'])) {
         tools::redirect('/account');
     }
     if (!empty($_POST)) {
         $data = tools::filter($_POST);
         $user = $this->user->getByUsername($data['username']);
         if (!$user) {
             tools::setFlash($this->l('Username does not exist'), 'error');
             tools::redirect('/user/login');
         } else {
             if ($user['active'] == 0) {
                 tools::setFlash($this->l('Account not active'), 'error');
                 tools::redirect('/user/login');
             } else {
                 // php >= 5.6 -> if (hash_equals($user['ppasswd'], crypt($data['password'], $user['ppasswd']))) {
                 if (password_verify($data['password'], $user['ppasswd'])) {
                     $_SESSION['user_id'] = $user['id'];
                     $_SESSION['username'] = $data['username'];
                     if ($user['admin'] == 1) {
                         $_SESSION['admin'] = true;
                     }
                     // increment online users number
                     tools::writeCache('user_count_' . $user['id'], $user['id'], 300);
                     // log access
                     $this->user->logAccess();
                     // if account not completed redirect to form
                     if (empty($user['firstname'])) {
                         tools::setFlash($this->l('Please complete your profile'), 'error');
                         tools::redirect('/user/edit');
                     } else {
                         tools::setFlash($this->l('Logged in successfully'), 'success');
                         tools::redirect('/account');
                     }
                 } else {
                     tools::setFlash($this->l('Wrong password'), 'error');
                     //tools::redirect('/user/login');
                 }
             }
         }
     }
     $this->smarty->display('user/login.tpl');
 }
开发者ID:7s4r,项目名称:eBidix,代码行数:44,代码来源:userController.php

示例4: get

                         $data['price_increment'] = get('price_increment', $data['auction_id'], 0);
                         $data['time_increment'] = get('time_increment', $data['auction_id'], 0);
                         $result = bid($data);
                     }
                 }
             }
         }
         sleep(4);
     }
     tools::deleteCache('autobid.pid');
     break;
 case 'close':
     if (tools::readCache('close.pid')) {
         return false;
     } else {
         tools::writeCache('close.pid', microtime(), 50);
     }
     $db = database::getInstance();
     $isPeakNow = tools::isPeakNow();
     $expireTime = time() + 60;
     while (time() < $expireTime) {
         $sql = "SELECT id, peak_only, end_time FROM " . DB_PREFIX . "auctions WHERE end_time <= '" . date('Y-m-d H:i:s') . "' AND closed=0 AND active=1 AND status_id=3";
         if ($res = $db->getRows($sql)) {
             if (sizeof($res) > 0) {
                 foreach ($res as $auction) {
                     if (checkCanClose($auction['id'], $isPeakNow) == false) {
                         if ($auction['peak_only'] == 1 && !$isPeakNow) {
                             $peak = tools::isPeakNow(true);
                             if (strtotime($peak['peak_start']) < time()) {
                                 $peak['peak_start'] = date('Y-m-d H:i:s', strtotime($peak['peak_start']) + 86400);
                             }
开发者ID:7s4r,项目名称:eBidix,代码行数:31,代码来源:daemons.php


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