예제 #1
0
if ($canBuy == false) {
    $_SESSION['error'] = $lang['purchaseItem']['no_buy'];
    header("Location: ../index.php");
}
require 'itemInfo.php';
require_once '../classes/Auction.php';
require_once '../classes/EconAccount.php';
if ($useTwitter == true) {
    require_once 'twitter.class.php';
}
$itemId = mysql_real_escape_string(stripslashes($_POST['ID']));
$numberLeft = 0;
$player = new EconAccount($user, $useMySQLiConomy, $iConTableName);
$auction = new Auction($itemId);
$owner = new EconAccount($auction->owner, $useMySQLiConomy, $iConTableName);
$itemEnchantsArray = $auction->getEnchantmentArray();
if (is_numeric($_POST['Quantity']) && $_POST['Quantity'] > 0) {
    $buyQuantity = mysql_real_escape_string(stripslashes(round(abs($_POST['Quantity']))));
} elseif ($_POST['Quantity'] <= 0) {
    $_SESSION['error'] = $lang['purchaseItem']['insufficient_quantity'];
    header("Location: ../index.php");
    return;
} else {
    $buyQuantity = $auction->quantity;
}
$toDelete = false;
$totalPrice = round($auction->price * $buyQuantity, 2);
$numberLeft = $auction->quantity - $buyQuantity;
if ($numberLeft < 0 && $auction->quantity > 0) {
    $_SESSION['error'] = $lang['purchaseItem']['too_many_quantity'];
    header("Location: ../index.php");