function buy() { echo "\n <div class='row'>\n <div class='col-sm-12'>\n <div class='panel-group'>\n <div class='panel panel-primary'>\n\n <div class='panel-body basecolours' align='center'>\n <form class='input-group' role='form' method='get' action='search.php' >\n <input type='text' name='search' class='form-control' id='search' placeholder='Search...' >\n <span class='input-group-btn''>\n <button class='btn btn-primary' type='submit' value='Submit'>\n <span class='glyphicon glyphicon-search'></span>\n </button>\n </span>\n </form>\n </div>\n </div>\n </div>\n </div>\n </div>\n "; findItems(); echo "\n <div class='col-sm-4'>\n <div class='panel-group'>\n <div class='panel panel-primary'>\n <div class='panel-heading basecolours'>\n <h1>Watched Items</h1>\n </div>\n <div class='panel-body basecolours'>\n <table class='table table-striped'>"; $sql = "SELECT auction.auctionID, item.imgLoc, item.itemName\n FROM `watching` , `item` , `auction`\n WHERE watching.`Auction_auctionID` = auction.auctionID\n AND auction.Item_itemID = item.itemID\n AND watching.Buyer_buyerID = " . $_SESSION['id'] . "\n AND auction.endTime > NOW( )\n LIMIT 5"; $db = Database::connect(); foreach ($db->query($sql) as $row) { $img = $row['imgLoc']; $auc = $row['auctionID']; $itemName = $row['itemName']; echo "\n <tr>\n <td width='25%'><a href='auction.php?id={$auc}'><img src='{$img}' width='100%' alt='{$itemName}'></a></td>\n <td><a href='auction.php?id={$auc}'>{$itemName}</a></td>\n </tr>"; } echo " </table>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n "; recommended(); }
function make_file($suffix, $offset = 1, $sort = false, $curlReq = 0) { global $cg; global $lang; $yesterday = strtotime("yesterday") + 60 * 60 * $offset; // yesterday + offset hours $today = strtotime("today") + 60 * 60 * $offset; // today + offset hours $fileY = $yesterday . $suffix; $fileY = $cg['basedir'] . '/cache/' . $fileY . '.php'; $fileT = $today . $suffix; $fileT = $cg['basedir'] . '/cache/' . $fileT . '.php'; $lastWrite = $cg['basedir'] . '/cache/lastwrite.txt'; $canWrite = _check_last_time(3); // interval of 3 mins if (!$canWrite) { // prevent amazon api call for less than 3 minutes // if last file write is less than 3 minutes, return and use current file to display. if (file_exists($fileT)) { return $fileT; } else { return $fileY; } exit; } // if no file exists, means 1 day has elapsed. // need to create a new file based on today. // will also make an API call to amazon to pull new content if (!file_exists($fileT)) { if ($curlReq) { $response = curl_string($curlReq); $res = simplexml_load_string($response); $data = arrify($res->Items); } else { $data = recommended($suffix, 1, $sort); // 2 pages or loops } if (!$data) { return false; } $str = ''; foreach ($data->Items->Item as $item) { if (isset($item->ItemAttributes->ListPrice)) { $price = trim($item->ItemAttributes->ListPrice->FormattedPrice); } else { $price = ''; } if (isset($item->LargeImage)) { $image = $item->LargeImage->URL; } else { if (isset($item->MediumImage)) { $image = $item->MediumImage->URL; } else { if (isset($item->SmallImage)) { $image = $item->SmallImage->URL; } else { $image = $cg['imageurl'] . '/no-image.png'; } } } if (isset($item->ItemAttributes->ProductGroup)) { $pg = (string) $item->ItemAttributes->ProductGroup[0]; $categ[$pg] = $pg; } $str .= <<<EOF \t\t\t\t<li><a href="{$item->DetailPageURL}" target="_blank"> \t\t\t\t\t<div class="prbox"><span class="hovmask"></span> \t\t\t\t\t\t<img src="{$image}" class="" alt="{$item->ItemAttributes->Title}" title=""> \t\t\t\t\t</div> \t\t\t\t\t<div class="prbottom simptip" data-tooltip="{$item->ItemAttributes->Title}"> \t\t\t\t\t\t<h3 class="title">{$item->ItemAttributes->Title}</h3> \t\t\t\t\t\t<span class="price">{$price}</span> \t\t\t\t\t</div> \t\t\t\t</a></li> EOF; //<span class="price">{htmlspecialchars($price, ENT_HTML5,'UTF-8', true)}</span> } // foreach unlink($fileY); // delete yesterday's file unlink($lastWrite); file_put_contents($fileT, $str); file_put_contents($lastWrite, time()); // write to file last time(); } // !file_exists return $fileT; }