modify('-2 hours'); $sql = 'SELECT A.*, count(L.lot_id) AS num_lots FROM auctions AS A LEFT OUTER JOIN lots AS L ON A.auction_id=L.auction_id WHERE A.starts > '.qesc($cutoff).' GROUP BY auction_id ORDER BY starts ASC LIMIT 1;'; $auction = $db->query($sql)->fetch_assoc(); // if there simply isn't an auction listed yet, keep the previous one // rather than making the front page empty if(!$auction) { $sql = 'SELECT A.*, count(L.lot_id) AS num_lots FROM auctions AS A LEFT OUTER JOIN lots AS L ON A.auction_id=L.auction_id GROUP BY auction_id ORDER BY starts DESC LIMIT 1;'; $auction = $db->query($sql)->fetch_assoc(); } if($auction) { $sql = 'SELECT lot_id as id, number, title, notes, estimate, sold_at, featured FROM lots WHERE auction_id = ' . qesc($auction['auction_id']) . ' ORDER BY featured DESC,estimate DESC,sold_at DESC,number,id LIMIT 15'; $featured = fetchall($db->query($sql)); foreach($featured as &$lot) { // grab photo $sql = 'SELECT filename, width, height, thumbname, thumbwidth, thumbheight FROM lotimgs WHERE lot_id='.qesc($lot['id']); $lot['photos'] = fetchall($db->query($sql)); } sort($featured); } else $featured = NULL; $start = new DateTime($auction['starts']); ?>
Check back soon for our next auction!
'; else { ?>
Next Auction -
Commences format('l jS F Y, g:ia')?>
0) { ?>

About us

modify('-2 hours'); /* future auctions */ $faucs = fetchall($db->query('SELECT A.*, count(L.lot_id) AS num_lots FROM auctions AS A LEFT OUTER JOIN lots AS L ON A.auction_id=L.auction_id WHERE A.starts > '.qesc($cutoff).' GROUP BY auction_id ORDER BY starts LIMIT 10;')); $paucs = fetchall($db->query('SELECT A.*, count(L.lot_id) AS num_lots FROM auctions AS A LEFT OUTER JOIN lots AS L ON A.auction_id=L.auction_id WHERE A.starts < '.qesc($cutoff).' GROUP BY auction_id ORDER BY starts DESC LIMIT 5;')); ?>

Forthcoming auctions

Recent results

query('SELECT text FROM globals WHERE name=' . qesc($key))->fetch_array(); pct_header(ucwords($key), $key); if($content) echo $content[0]; else echo '(empty)'; pct_footer(); } function page_auctions() { global $db; $cutoff = new DateTime('now'); $cutoff->modify('-2 hours'); /* future auctions */ $faucs = fetchall($db->query('SELECT A.*, count(L.lot_id) AS num_lots FROM auctions AS A LEFT OUTER JOIN lots AS L ON A.auction_id=L.auction_id WHERE A.starts > '.qesc($cutoff).' GROUP BY auction_id ORDER BY starts;')); $paucs = fetchall($db->query('SELECT A.*, count(L.lot_id) AS num_lots FROM auctions AS A LEFT OUTER JOIN lots AS L ON A.auction_id=L.auction_id WHERE A.starts < '.qesc($cutoff).' GROUP BY auction_id ORDER BY starts DESC;')); pct_header("Sale calendar", 'calendar'); pct_auctions($faucs, $paucs); pct_footer(); } function page_catalogue($path) { global $pc_root, $db; $pc_root = '../'; // get the auction listing, and all lots and photos $auction = $db->query( 'SELECT auction_id as id, linktext, category, title, notes, starts FROM auctions WHERE linktext='.qesc($path) )->fetch_assoc(); if(!$auction) return pca_error(404, 'Auction does not exist ' . $path); $starts = dbtodate($auction['starts']); $in_past = $starts < (new DateTime('today')); $lots = fetchall($db->query( 'SELECT lot_id as id, number, title, notes, estimate, sold_at, featured FROM lots WHERE auction_id = ' . qesc($auction['id']) . ' ORDER BY number,id' )); foreach($lots as &$lot) { /* TODO: reduce to a subquery, and support multiple */ $sql = 'SELECT filename, width, height, thumbname, thumbwidth, thumbheight FROM lotimgs WHERE lot_id='.qesc($lot['id']); $lot['photos'] = fetchall($db->query($sql)); } $commence_text = 'Commence'.($in_past?'d':'s').' at ' . $starts->format('g:ia'); pct_header(fmt_auction_title($auction) . " Catalogue ", 'catalogue'); ?>

query($sql)->fetch_assoc(); if(!$auction) return pca_error(404, 'Auction does not exist'); if(!pc_admin()) return pca_error(403, 'You are not logged in as an administrator'); /* and all bids and associated lot */ $sql = 'SELECT bids.*, lots.title as lot_title, lots.lot_id, lots.number as lot_number FROM bids JOIN lots ON bids.lot_id=lots.lot_id WHERE lots.auction_id='.qesc($auction['auction_id']).' ORDER BY lots.number ASC, lots.lot_id ASC, bid DESC, bidtime DESC'; $bids = fetchall($db->query($sql)); pct_header('Viewing all bids', 'bidview'); ?>

List of all Internet bids on

Total bids placed:

\n"; echo '
'; echo '

' . $bid['lot_number'] . ' - ' . $bid['lot_title'] . '

'; $last_lot_id = $bid['lot_id']; $nbids = 0; ?>
Max bid
Full name
Contact details
Bid date
5) continue; $bidtime = new DateTime($bid['bidtime']); ?>
format('d/m/y H:i')?>
\n"; ?>
format('l jS \o\f F, Y'); } function page_login($path) { global $db; pct_header("Log in ", 'login'); ?>

Auction administration access

password