$query = "SELECT ends, id, title FROM " . $DBPrefix . "auctions\r\n WHERE closed = 0 AND suspended = 0 AND starts <= " . $NOW . "\r\n ORDER BY ends LIMIT " . $system->SETTINGS['endingsoonnumber']; $res = mysql_query($query); $system->check_mysql($res, $query, __LINE__, __FILE__); $num_auction = mysql_num_rows($res); $i = 0; $bgcolor = '#FFFFFF'; while ($i < $num_auction) { if ($bgcolor == '#FFFFFF') { $bgcolor = '#FFFEEE'; } else { $bgcolor = '#FFFFFF'; } $ends = mysql_result($res, $i, 'ends'); $difference = $ends - time(); if ($difference > 0) { $ends_string = FormatTimeLeft($difference); } else { $ends_string = $MSG['911']; } $template->assign_block_vars('end_soon', array('BGCOLOUR' => $bgcolor, 'DATE' => $ends_string, 'ID' => mysql_result($res, $i, 'id'), 'TITLE' => mysql_result($res, $i, 'title'))); $i++; } $end_soon = $i > 0 ? true : false; // get higher bids $query = "SELECT max(b.bid) AS max_bid, a.title, a.id FROM " . $DBPrefix . "bids b\r\nLEFT JOIN " . $DBPrefix . "auctions a ON (a.id = b.auction)\r\nWHERE a.suspended = 0 AND a.closed = 0 AND a.starts <= '" . $NOW . "' GROUP BY b.bid, b.auction ORDER BY max_bid DESC"; $res = mysql_query($query); $system->check_mysql($res, $query, __LINE__, __FILE__); $num_auction = mysql_num_rows($res); $i = 0; $j = 0; $bgcolor = '#FFFFFF';
$_SESSION['REDIRECT_AFTER_LOGIN'] = '******'; header('location: user_login.php'); exit; } // get active bids for this user $query = "SELECT a.current_bid, a.id, a.title, a.ends, b.bid, b.quantity, p.bid As proxybid FROM " . $DBPrefix . "bids b\n\tLEFT JOIN " . $DBPrefix . "proxybid p ON (p.itemid = b.auction)\n\tLEFT JOIN " . $DBPrefix . "auctions a ON (a.id = b.auction)\n\tWHERE a.closed = 0 AND b.bidder = :user_id\n\tAND a.bn_only = 'n' ORDER BY a.ends ASC, b.bid DESC"; $params = array(); $params[] = array(':user_id', $user->user_data['id'], 'int'); $db->query($query, $params); $idcheck = array(); $auctions_count = 0; while ($row = $db->fetch()) { if (!in_array($row['id'], $idcheck)) { // prepare some data $bgColor = !($auctions_count % 2) ? '' : 'class="alt-row"'; // Outbidded or winning bid if ($row['current_bid'] != $row['bid']) { $bgColor = 'style="background-color:#FFFF00;"'; } $auctions_count++; $idcheck[] = $row['id']; $template->assign_block_vars('bids', array('BGCOLOUR' => $bgColor, 'ID' => $row['id'], 'TITLE' => $system->uncleanvars($row['title']), 'BID' => $system->print_money($row['bid']), 'PROXYBID' => intval($row['proxybid']) > 0 ? $system->print_money($row['proxybid']) : '', 'QTY' => $row['quantity'], 'TIMELEFT' => FormatTimeLeft($row['ends'] - time()), 'CBID' => $system->print_money($row['current_bid']))); } } $template->assign_vars(array('NUM_BIDS' => $auctions_count)); include 'header.php'; $TMP_usmenutitle = $MSG['620']; include $include_path . 'user_cp.php'; $template->set_filenames(array('body' => 'yourbids.tpl')); $template->display('body'); include 'footer.php';
$params[] = array(':perpage', $system->SETTINGS['perpage'], 'int'); $db->query($query, $params); $k = 0; while ($row = $db->fetch()) { if (strlen($row['pict_url']) > 0) { $row['pict_url'] = $system->SETTINGS['siteurl'] . 'getthumb.php?w=' . $system->SETTINGS['thumb_show'] . '&fromfile=' . $uploaded_path . $row['id'] . '/' . $row['pict_url']; } else { $row['pict_url'] = get_lang_img('nopicture.gif'); } // number of bids for this auction $query = "SELECT bid FROM " . $DBPrefix . "bids WHERE auction = :id"; $params[] = array(':id', $row['id'], 'int'); $db->query($query, $params); $num_bids = $db->numrows(); $difference = $row['ends'] - $NOW; $template->assign_block_vars('auctions', array('BGCOLOUR' => !($k % 2) ? '' : 'class="alt-row"', 'ID' => $row['id'], 'PIC_URL' => $row['pict_url'], 'TITLE' => $system->uncleanvars($row['title']), 'BNIMG' => get_lang_img($row['bn_only'] == 'n' ? 'buy_it_now.gif' : 'bn_only.png'), 'BNVALUE' => $row['buy_now'], 'BNFORMAT' => $system->print_money($row['buy_now']), 'BIDVALUE' => $row['current_bid'], 'BIDFORMAT' => $system->print_money($row['current_bid']), 'NUM_BIDS' => $num_bids, 'TIMELEFT' => FormatTimeLeft($difference), 'B_BUY_NOW' => $row['buy_now'] > 0 && ($row['bn_only'] == 'y' || $row['bn_only'] == 'n' && ($row['num_bids'] == 0 || $row['reserve_price'] > 0 && $row['current_bid'] < $row['reserve_price'])), 'B_BNONLY' => $row['bn_only'] == 'y')); $k++; } // get this user's nick $query = "SELECT nick FROM " . $DBPrefix . "users WHERE id = :user_id"; $params[] = array(':user_id', $user_id, 'int'); $db->query($query, $params); $TPL_user_nick = $db->result('nick'); $page_title = $MSG['219'] . ': ' . $TPL_user_nick; $LOW = $PAGE - 5; if ($LOW <= 0) { $LOW = 1; } $COUNTER = $LOW; $pagenation = ''; while ($COUNTER <= $PAGES && $COUNTER < $PAGE + 6) {
if ($idcheck != $rowid) { $bid = $row['bid']; // prepare some data if ($bgColor == "#EBEBEB") { $bgColor = "#FFFFFF"; } else { $bgColor = "#EBEBEB"; } // // Outbidded or winning bid if ($row['current_bid'] != $row['bid']) { $bgColor = '#FFFF00'; } // current bid of this auction if ($bid == 0) { $bid = $starting_price; } $bid = $system->print_money($bid); // time left till the end of this auction $difference = $row['ends'] - time(); $auctions_count++; $idcheck = $rowid; $template->assign_block_vars('bids', array('BGCOLOUR' => $bgColor, 'ID' => $rowid, 'TITLE' => $row['title'], 'BID' => $bid, 'TIMELEFT' => FormatTimeLeft($difference))); } } $template->assign_vars(array('NUM_BIDS' => $auctions_count)); include "header.php"; $TMP_usmenutitle = $MSG['620']; include "includes/user_cp.php"; $template->set_filenames(array('body' => 'yourbids.html')); $template->display('body'); include "footer.php";
function browseItems($result, $current_page) { global $system, $uploaded_path, $DBPrefix, $MSG, $ERR_114; global $id, $template, $PAGES, $PAGE; $k = 0; if ($result && mysql_num_rows($result)) { while ($row = mysql_fetch_array($result)) { /* prepare some data */ $is_dutch = intval($row['auction_type']) == 2 ? true : false; /* image icon */ if (strlen($row['pict_url']) > 0) { $row['pict_url'] = $system->SETTINGS['siteurl'] . 'getthumb.php?w=' . $system->SETTINGS['thumb_show'] . '&fromfile=' . $uploaded_path . $row['id'] . '/' . $row['pict_url']; } else { $row['pict_url'] = $system->SETTINGS['siteurl'] . 'images/nopicture.gif'; } $tplv['img'] = '<a href="' . $system->SETTINGS['siteurl'] . 'item.php?id=' . $row['id'] . '"><img src="' . $row['pict_url'] . '" width="' . $system->SETTINGS['thumb_show'] . '" border=0 /></a>'; /* this subastas title and link to details */ $tplv['id'] = $row['id']; $tplv['title'] = '<a href="' . $system->SETTINGS['siteurl'] . 'item.php?id=' . $row['id'] . '">' . $row['title'] . '</a>'; if ($row['current_bid'] == 0) { $row['current_bid'] = $row['minimum_bid']; } if ($row['buy_now'] > 0 && $row['bn_only'] == 'n' && ($row['num_bids'] == 0 || $row['reserve_price'] > 0 && $row['current_bid'] < $row['reserve_price'])) { $tplv['buy_now'] = ' ( <a href="' . $system->SETTINGS['siteurl'] . 'buy_now.php?id=' . $row['id'] . '"><img src="' . $system->SETTINGS['siteurl'] . 'images/buy_it_now.gif" border=0 class="buynow"></a> ' . $system->print_money($row['buy_now']) . ')'; } elseif ($row['buy_now'] > 0 && $row['bn_only'] == 'y') { $tplv['buy_now'] = ' ( <a href="' . $system->SETTINGS['siteurl'] . 'buy_now.php?id=' . $row['id'] . '"><img src="' . $system->SETTINGS['siteurl'] . 'images/buy_it_now.gif" border=0></a> ' . $system->print_money($row['buy_now']) . ') <img src="' . $system->SETTINGS['siteurl'] . 'images/bn_only.png" border=0>'; $row['current_bid'] = $row['buy_now']; } else { $tplv['buy_now'] = ''; } $tplv['bid'] = $row['current_bid']; // number of bids for this auction $query = "SELECT bid FROM " . $DBPrefix . "bids WHERE auction = " . $row['id']; $res = mysql_query($query); $system->check_mysql($res, $query, __LINE__, __FILE__); $num_bids = mysql_num_rows($res); $rpr = (int) $row['reserved_price']; if ($rpr != 0) { $reserved_price = ' <img src="images/r.gif">'; } else { $reserved_price = ''; } $tplv['rpr'] = $reserved_price . $num_bids; // time left till the end of this auction $s_difference = time() - $row['starts']; $difference = $row['ends'] - time(); $template->assign_block_vars('items', array('ID' => $tplv['id'], 'ROWCOLOUR' => $k % 2 ? 'bgcolor="#FFFEEE"' : '', 'IMAGE' => $tplv['img'], 'TITLE' => $tplv['title'], 'BUY_NOW' => $tplv['buy_now'], 'BID' => $tplv['bid'], 'BIDFORM' => $system->print_money($tplv['bid']), 'TIMELEFT' => FormatTimeLeft($difference), 'NUMBIDS' => $num_bids, 'RESERVE' => $reserved_price)); $k++; } $PREV = intval($PAGE - 1); $NEXT = intval($PAGE + 1); if ($PAGES > 1) { $LOW = $PAGE - 5; if ($LOW <= 0) { $LOW = 1; } $COUNTER = $LOW; while ($COUNTER <= $PAGES && $COUNTER < $PAGE + 6) { $template->assign_block_vars('pages', array('PAGE' => $PAGE == $COUNTER ? '<b>' . $COUNTER . '</b>' : '<a href="' . $system->SETTINGS['siteurl'] . $current_page . '?PAGE=' . $COUNTER . '&id=' . $id . '"><u>' . $COUNTER . '</u></a>')); $COUNTER++; } } } $template->assign_vars(array('NUM_AUCTIONS' => $k == 0 ? $ERR_114 : $k, 'ID' => $id, 'PREV' => $PAGES > 1 && $PAGE > 1 ? '<a href="' . $system->SETTINGS['siteurl'] . $current_page . '?PAGE=' . $PREV . '&id=' . $id . '"><u>' . $MSG['5119'] . '</u></a> ' : '', 'NEXT' => $PAGE < $PAGES ? '<a href="' . $system->SETTINGS['siteurl'] . $current_page . '?PAGE=' . $NEXT . '&id=' . $id . '"><u>' . $MSG['5120'] . '</u></a>' : '', 'PAGE' => $PAGE, 'PAGES' => $PAGES)); }
$bgColor = "#FFFFFF"; } else { $bgColor = "#EBEBEB"; } if (strlen($row['pict_url']) > 0) { $row['pict_url'] = $system->SETTINGS['siteurl'] . "getthumb.php?w=" . $system->SETTINGS['thumb_show'] . "&fromfile=" . $uploaded_path . $row['id'] . "/" . $row['pict_url']; } else { $row['pict_url'] = $system->SETTINGS['siteurl'] . "images/nopicture.gif"; } // number of bids for this auction $query = "SELECT bid FROM " . $DBPrefix . "bids WHERE auction=" . $row['id']; $tmp_res = mysql_query($query); $system->check_mysql($tmp_res, $query, __LINE__, __FILE__); $num_bids = mysql_num_rows($tmp_res); $difference = $row['ends'] - time(); $template->assign_block_vars('auctions', array('BGCOLOUR' => $bgColor, 'ID' => $row['id'], 'PIC_URL' => $row['pict_url'], 'TITLE' => $row['title'], 'BNIMG' => $row['bn_only'] == 'n' ? 'buy_it_now.gif' : 'bn_only.png', 'BNVALUE' => $row['buy_now'], 'BNFORMAT' => $system->print_money($row['buy_now']), 'BIDVALUE' => $row['minimum_bid'], 'BIDFORMAT' => $system->print_money($row['minimum_bid']), 'RESERVE' => $row['reserve_price'] > 0 ? '<img src="images/r.gif" alt="reserve set">' : '', 'NUM_BIDS' => $num_bids, 'TIMELEFT' => FormatTimeLeft($difference), 'B_BUY_NOW' => $row['buy_now'] > 0 && ($row['current_bid'] == 0 || $row['reserve_price'] > 0 && $row['current_bid'] < $row['reserve_price']))); $auctions_count++; } if ($auctions_count == 0) { $template->assign_block_vars('no_auctions', array()); } /* get this user's nick */ $query = "SELECT * FROM " . $DBPrefix . "users WHERE id = {$user_id}"; $result = mysql_query($query); $system->check_mysql($result, $query, __LINE__, __FILE__); if (mysql_num_rows($result) > 0) { $TPL_user_nick = mysql_result($result, 0, 'nick'); } else { $TPL_user_nick = ""; } $LOW = $PAGE - 5;