コード例 #1
0
function retrieve_followed_by_user_failure()
{
    $temp = null;
    if (isset($_SESSION['userId'])) {
        $temp = $_SESSION['userId'];
    }
    $_SESSION['userId'] = 272;
    $result = retrieve_followed_by_user();
    // print_r($result[3]);
    assert(!$result);
    if ($temp) {
        $_SESSION['userId'] = $temp;
    }
}
コード例 #2
0
        $winning_price = htmlentities($auction['winning_price']);
        // echo $auction['winner_id'] . "<br/>";
        if ($_SESSION['userId'] == $auction['winner_id']) {
            $is_this_buyer = "<br><div id=\"this-you\">This is you!</div>";
        } else {
            $is_this_buyer = "\n        <br><div id=\"this-not-you\">Your bid is not the winning bid!</div>";
        }
        $link = "auction.php?auctionId=" . urlencode(htmlentities($auction['auctionId']));
        $output = "\n      <tr>\n        <td><a href=\"{$link}\"><h7>{$title}</h7>\n        <img src=\"img/auctions/{$imageName}\"\n        title=\"{$title}\">\n        </a></td>\n        <td>\n          <strong>Description:</strong><br/>\n          {$description}\n        </td>\n        <td>\n          <Strong>Current price:</strong><br/>\n          £{$winning_price}\n          {$is_this_buyer}\n        </td>\n      </tr>";
        echo $output;
    }
}
?>

    <?php 
$auction_set = retrieve_followed_by_user();
if ($auction_set) {
    $outputTableHeader = "\n      </table>\n  <a name=\"following\"><h3>Following</h3></a>\n  <table class=\"table table-striped\">\n    <col width=\"15%\">\n    <col width=\"50%\">\n    <col width=\"20%\">\n    <col width=\"15%\">\n    <tr>\n      <th>Item Name</th>\n      <th>Description</th>\n      <th>Current Price</th>\n      <th>Unfollow</th>\n    </tr>\n      ";
    echo $outputTableHeader;
    foreach ($auction_set as $auction) {
        $imageName = htmlentities($auction['imageName']);
        $title = htmlentities($auction['title']);
        $description = htmlentities($auction['description']);
        $winning_price = htmlentities($auction['winning_price']);
        // echo $auction['winner_id'] . "<br/>";
        $is_this_buyer = "";
        if ($_SESSION['userId'] == $auction['winner_id']) {
            $is_this_buyer = "<br><div id=\"this-you\">This is you!</div>";
        }
        if (time() - strtotime($auction['expirationDate']) > 0) {
            $is_this_buyer .= "<br><div id=\"this-not-you\">\n                            This auction is expired!</div>";