<?php define('_DIR_', dirname(__FILE__)); require_once 'config/db.php'; require_once 'config/settings.inc.php'; require_once 'app/core/tools.class.php'; require_once 'app/core/database.class.php'; require_once 'daemons_functions.php'; date_default_timezone_set($settings['app']['timezone']); session_start(); if (!empty($_SESSION['user_id'])) { $data['user_id'] = $_SESSION['user_id']; } else { $data['user_id'] = null; } if (!empty($_GET['id'])) { $data['auction_id'] = htmlspecialchars($_GET['id'], ENT_QUOTES, 'UTF-8'); $data['time_increment'] = get('time_increment', $data['auction_id'], 0); $data['bid_debit'] = get('bid_debit', $data['auction_id'], 0); $data['price_increment'] = get('price_increment', $data['auction_id'], 0); } $data['isPeakNow'] = tools::isPeakNow(); // bid the auction $auction = bid($data);
<?php define('_DIR_', dirname(__FILE__)); require_once _DIR_ . '/config/settings.inc.php'; require_once _DIR_ . '/config/db.php'; require_once _DIR_ . '/app/core/database.class.php'; require_once _DIR_ . '/app/core/tools.class.php'; require_once _DIR_ . '/app/libs/fastjson/fastjson.php'; session_start(); if (!empty($_SESSION['user_id'])) { $user_id = $_SESSION['user_id']; } else { $user_id = null; } date_default_timezone_set($settings['app']['timezone']); $isPeakNow = tools::isPeakNow(); $site_online = tools::siteOnline(); $data = $_POST; if (empty($data)) { die('No data given'); } $results = array(); foreach ($data as $key => $value) { if (!empty($_GET['histories'])) { $result = tools::readCache('auction_view_' . $value); } else { $result = tools::readCache('auction_' . $value); } if (empty($result)) { $db = database::getInstance(); // gettting data
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); } $seconds_after_peak = strtotime($auction['end_time']) - strtotime($peak['peak_end']); $time = strtotime($peak['peak_start']) + $seconds_after_peak; $endTime = date('Y-m-d H:i:s', $time); if (strtotime($endTime) < time()) { $endTime = date('Y-m-d H:i:s', strtotime($endTime) + 86400); } $db->update('auctions', "end_time = '{$endTime}'", "id = {$auction['id']}"); } else { $data['auction_peak_start'] = get('auction_peak_start'); $data['auction_peak_end'] = get('auction_peak_end'); $data['isPeakNow'] = $isPeakNow; $data['time_increment'] = get('time_increment', $auction['id'], 0);