"); exit(); } } $password = $HTTP_POST_VARS['password']; if ($password == null) { $password = $HTTP_GET_VARS['password']; if ($password == null) { printError($scriptName, $startTime, "BuyNow", "You must provide a password!
"); exit(); } } $itemId = $HTTP_POST_VARS['itemId']; if ($itemId == null) { $itemId = $HTTP_GET_VARS['itemId']; if ($itemId == null) { printError($scriptName, $startTime, "BuyNow", "You must provide an item identifier!
"); exit(); } } getDatabaseLink($link); beginRO($link); // Authenticate the user $userId = authenticate($nickname, $password, $link); if ($userId == -1) { printError($scriptName, $startTime, "Authentication", "You don't have an account on RUBiS!
You have to register first.
\n"); exit(); } function buynow($link, $itemId, $userId) { $row = getItem($link, $itemId); if (!$row) { global $scriptName, $startTime; printError($scriptName, $startTime, "BuyNow", "

ERROR: Sorry, but this item does not exist.


"); exit(); } $sellerNameRow = getUser($link, $userId); $sellerName = $sellerNameRow["nickname"]; printHTMLheader("RUBiS: Buy Now"); printHTMLHighlighted("You are ready to buy this item: ".$row["name"]); print("\n"); print("
Quantity".$row["quantity"]."\n"); print("
Seller$sellerName (Leave a comment on this user)\n"); print("
Started".$row["start_date"]."\n"); print("
Ends".$row["end_date"]."\n"); print("
\n"); printHTMLHighlighted("Item description"); print($row["description"]); print("

\n"); printHTMLHighlighted("Buy Now"); print("

\n". "\n". "\n". "\n"); if ($row["quantity"] > 1) print("
Quantity:
\n"); else print("\n"); print("

\n"); } if (MICROCACHE) buynow($link, $itemId, $userId); else wrap(true, 'buynow', $link, $itemId, $userId); commit($link); sql_close($link); printHTMLfooter($scriptName, $startTime); ?>