function item_html($results)
{
    ob_start();
    foreach ($results as $row) {
        $lowest_price = $row['start_price'] + 1;
        $highest_bid = get_highest_bid($row["id"]);
        if ($highest_bid) {
            $lowest_price = $highest_bid["price"] + 1;
        }
        $item = get_item_id($row['item_id']);
        ?>
<div class="item-thumbnail">
   <?php 
        if ($item['image']) {
            ?>
  <img src="img/image_view.php?item_id=<?php 
            echo $row['item_id'];
            ?>
" class="thumbnail">
    <?php 
        } else {
            ?>
  <img src="img/placeholder.png" class="thumbnail">
    <?php 
        }
        ?>
  <span>
    <a href="auction.php?auction_id=<?php 
        echo $row['id'];
        ?>
"> <?php 
        echo $item['name'];
        ?>
 </a>
    <br>
    Bid Price:&nbsp;<strong class="itemPrice" name="itemPrice">£<?php 
        echo $lowest_price;
        ?>
</strong>
  </span>
</div>
<?php 
    }
    $ret_val = ob_get_contents();
    ob_end_clean();
    return $ret_val;
}
예제 #2
0
function send_update_on_bought($auction)
{
    $item_id = $auction["item_id"];
    $item = get_item_id($item_id);
    $subject = "Receipt for your new item";
    $message = "<b>You have recently bought an item</b><br>";
    $message .= "<h1>" . $item["name"] . "</h1><br>";
    $highest = get_highest_bid($auction["id"]);
    $seller = find_email($highest["user_id"]);
    $to = $seller["email"];
    $message .= "<b>Item:" . $item["name"] . "</b><br>";
    $message .= "<b>Seller :" . $auction["seller_id"] . "</b><br>";
    $message .= "<b>Price :£" . $highest["price"] . "</b><br>";
    echo $message;
    $header = "From:no-reply-auctions@gmail.com \r\n";
    $header .= "MIME-Version: 1.0\r\n";
    $header .= "Content-type: text/html\r\n";
    $retval = mail($to, $subject, $message, $header);
    if ($retval == true) {
        echo "Message sent successfully...";
    } else {
        echo "Message could not be sent...";
    }
}
예제 #3
0
}
if (isset($_POST['placeBid'])) {
    if ($auction['seller_id'] === $_SESSION['id'] || $lowest_price > floatval($_POST['yourBid'])) {
        echo 'Your Bid is not Valid';
    } else {
        make_bid($auction['id'], floatval($_POST['yourBid']), $_SESSION['id']);
        if ($highest_bid) {
            send_update_on_outbid($auction, $highest_bid["user_id"]);
        }
        //            send_update_on_auctions($auction);
        send_update_on_watch_list($auction, $_SESSION['id'], $highest_bid["user_id"]);
    }
}
$auction = get_auctions_id($_GET['auction_id']);
$bids_count = get_num_bids_auction($auction['id']);
$highest_bid = get_highest_bid($auction['id']);
$lowest_price = $auction['start_price'];
$highest_bid_username = "******";
$highest_bid_price = "No Bids Yet";
if ($highest_bid) {
    $lowest_price = $highest_bid['price'];
    $highest_bid_username = find_user_id($highest_bid['user_id'])["name"];
    $highest_bid_price = $lowest_price;
}
$lowest_price = $lowest_price + 1;
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">