Example #1
0
echo "</form>";
echo "<button class=\"awardButton\">Exercise Benevolence/Malice</button>\n";
?>

</div>

<div id="auctions">
<h2>Current Auction:</h2>
<p/>
<form method="post" action="endAuction.php" id="endAuc">
<?php 
$stmt = $dbh->prepare("SELECT * FROM auctions WHERE pending=1");
$stmt->execute();
while ($row = $stmt->fetch()) {
    echo "The current auction lot is:<p/><img src=\"../img.php?img=" . $row['wid'] . "\" style=\"width:200px;\"><p/>Offered by " . getUsername($row['uid']) . ".";
    echo "High bid: " . $CURRENCY_SYMBOL . getHighBidAmountForAuction($row['id']) . " (" . getHighBidderForAuction($row['id']) . ")";
}
echo "<input type=\"hidden\" name=\"aid\" value=\"0\"/><button id=\"nextLot\">Next Lot</button>\n";
?>
</form>
<p/>
<h2>Upcoming Auction</h2>
<?php 
if (isAuctionPending()) {
    echo "An auction will be held at " . pendingAuctionDate() . ".";
} else {
    echo "There is no upcoming auction, but you can add one below.";
}
?>
<h2>Schedule an Auction</h2>
After you schedule the auction, it will appear in the list of upcoming auctions above.  For now, it's possible to
Example #2
0
<?php

/**
 * aucval.php: In the live auction system, this script is called by client-side polling
 * every couple seconds to update the high bidder, time of last bid, and bid amount in
 * JSON format.  
 *
 * @param i (via GET): the auction id.  Corresponds with primary key of auctions table.
 * 
 * Called by: marketplace.php (within JavaScript polling function).
 *
 * @author William Shaw <*****@*****.**>
 * @author Katherine Jentleson <*****@*****.**>, designer
 * @version 0.1, 10/2012
 * 
 */
if (session_id() == '') {
    session_start();
}
header('Content-type: application/json');
ob_start();
require 'db.php';
require 'functions.php';
ob_end_clean();
$requested = $_GET['i'];
// Set upt he JSON object containing our data.  Sample format: {"amt":120,"u":16,"t":128974918274, "metReserve":0 }
// amt = bid amount; u = user ID of high bidder; t: epoch timestamp of last bid; metReserve: was reserve met? 1/0
$JSON = "{\"amt\":" . getHighBidAmountForAuction($requested) . ", \"u\":\"" . getHighBidderForAuction($requested) . "\", \"t\":" . getLastBidTimeForAuction($requested) . ", \"metReserve\":" . didAuctionMeetReserve($requested) . "}";
echo $JSON;
Example #3
0
	if ( $mode === "absentee" ) {
		$query = $dbh->prepare( "INSERT INTO absentee_bids(uid,aid,amt) VALUES(?,?,?)" );
		$query->bindParam( 1, $uuid );
		$query->bindParam( 2, $auctionId );
		$query->bindParam( 3, $bidAmt );
		$query->execute( );
		echo( "You have placed an absentee bid of " . $CURRENCY_SYMBOL . $bidAmt . ".");	
		exit;
	}
	*/
// Series of sanity checks: did the user enter a positive integer as his/her bid?
if (!is_numeric($bidAmt) || $bidAmt < 1) {
    echo $bidAmt . " isn't an acceptable bid.  Please bid only positive integers.";
    // Is the auction still active?  And is the user bidding an acceptable minimum?  (Current high bid + 5 FCG)
} elseif (isAuctionStillActiveFixedEnd($auctionId) && $bidAmt < getHighBidAmountForAuction($auctionId) + 5) {
    echo "Please bid at least " . $CURRENCY_SYMBOL . (getHighBidAmountForAuction($auctionId) + 5) . ".";
    echo "<p/><button id=\"dismiss\" class=\"ui-widget ui-button ui-state-default ui-corner-all ui-button-text-only\" style=\"width:100px;height:40px;\" onClick=\"window.parent.Shadowbox.close( );\">Okay</button>";
    // Is the attempted bid less than the minimum bid for the auction?
} elseif (isAuctionStillActiveFixedEnd($auctionId) && $bidAmt < getMinimumBidForAuction($auctionId)) {
    echo "Sorry, but the minimum bid for this auction is " . getMinimumBidForAuction($auctionId) . ".";
    echo "<p/><button id=\"dismiss\" class=\"ui-widget ui-button ui-state-default ui-corner-all ui-button-text-only\" style=\"width:100px;height:40px;\" onClick=\"window.parent.Shadowbox.close( );\">Okay</button>";
    // Does the user have enough money to place this bid?  If so, place it.
} elseif (isAuctionStillActiveFixedEnd($auctionId) && $bidAmt <= getPoints($uuid)) {
    placeBidFixedEnd($auctionId, $uuid, $bidAmt, $gameinstance);
    echo "You have bid " . $CURRENCY_SYMBOL . $bidAmt . " on this work.";
    echo "<p/><button id=\"dismiss\" class=\"ui-widget ui-button ui-state-default ui-corner-all ui-button-text-only\" style=\"width:100px;height:40px;\" onClick=\"window.parent.Shadowbox.close( );\">Okay</button>";
    // Logically, this should come first so we don't call the function 3 times in a row for other checks... FIXME
} elseif (!isAuctionStillActiveFixedEnd($auctionId)) {
    echo "The auction has already ended!";
    echo "<p/><button id=\"dismiss\" class=\"ui-widget ui-button ui-state-default ui-corner-all ui-button-text-only\" style=\"width:100px;height:40px;\" onClick=\"window.parent.Shadowbox.close( );\">Okay</button>";
} else {
Example #4
0
    echo "<div style=\"float:left;display:inline;\"><a rel=\"shadowbox\" href=\"workview.php?wid=" . $row['wid'] . "\"><img src=\"img.php?img=" . $row['wid'] . "\" style=\"height:150px;\"/></a>\n";
    echo "</div><div style=\"float:left;display:inline;width:80%;padding:10px;\">";
    echo "<span style=\"font-size:1.5em;\">" . getTombstoneOrBlank($row['wid'], true) . "</span><br/>";
    echo "Offered by " . getUsername($row['uid']) . " (ends in <b>" . secondsToString(strtotime($row['end']) - strtotime('-0 seconds')) . "</b>, on " . $row['end'] . ")<p/>Current high bid: " . getHighBidderForAuction($row['id']);
    echo " (" . $CURRENCY_SYMBOL . getHighBidAmountForAuction($row['id']);
    if (getReserve($row['id'] > 0)) {
        echo ", reserve" . (didAuctionMeetReserve($row['id']) > 0 ? " met" : " not met");
    }
    echo ")<p/>\n";
    echo "<input type=\"text\" name=\"amount\" size=\"5\"/>\n";
    echo "<button type=\"submit\" style=\"\" class=\"buyClassified\" name=\"" . $row['id'] . "\" id=\"#buy" . $row['wid'] . "\">Place Bid";
    if (getMinimumBidForAuction($row['id']) > getHighBidAmountForAuction($row['id'])) {
        echo " (Minimum bid: " . $CURRENCY_SYMBOL . getMinimumBidForAuction($row['id']) . ")";
    }
    echo "</button>\n";
    if (getAuctionBIN($row['id']) > 0 && getHighBidAmountForAuction($row['id']) <= getMinimumBidForAuction($row['id'])) {
        echo "<input type=\"hidden\" name=\"amountOutright\" value=\"" . getAuctionBIN($row['id']) . "\"/>\n";
        echo "<button class=\"buyBIN\" name=\"" . $row['id'] . "\" id=\"#bin" . $row['wid'] . "\">Buy outright for " . $CURRENCY_SYMBOL . getAuctionBIN($row['id']) . "</button>\n";
    }
    echo "</div></div><p/>\n";
    echo "</form>\n";
}
?>
<p/>
	</div>
</div>
</div>
<!-- Hidden divs used for jQuery UI modal dialogs -->
<div id="dialog-confirm" title="Place bid?">
	<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span></p>
</div>