include('ini.php'); $id = $_GET['id']; $ean = $_GET['ean']; $secret = $_GET['h']; if (!$secret == md5($md5.$id.$ean)) { header("HTTP/1.0 404 Not Found"); echo "Not found"; exit; } $sql = "SELECT * FROM STORES WHERE ID = $id AND ACTIVE = 1 AND VISIBLE = 1"; if ($rs = @mysqli_query($db, $sql)) { if ($store = mysqli_fetch_array($rs)) { // ID, NAMEID, HOME, COUNTRY, CURRENCY, ACTIVE, VISIBLE, EAN13, OFFERURL, SEARCHURL, REGEXP, INC_VAT, PRODUCTLANGUAGES, CACHETIME, SHIPPING $shippingcountries = preg_split('/\s+/', $store['SHIPPING'], null, PREG_SPLIT_NO_EMPTY); foreach ($shippingcountries as $countryinfo) { list($shippingcountry,$shippingprice,$shippingmin,$shippingmax) = explode(',',$countryinfo,4); // if shipping to this country if ($shippingcountry == $country) { // check cache $sql = "SELECT * FROM OFFER WHERE STOREID = $id AND EAN = '$ean'"; if ($rs = @mysqli_query($db, $sql)) { if ($offer = mysqli_fetch_array($rs)) { // STOREID, EAN, VALID, PRICE, URL, AVAILABILITY, AVAILABILITY_MIN, AVAILABILITY_MAX $store['CACHETIME'] = empty($store['CACHETIME'])?(60*60*24):$store['CACHETIME']; // default 24 h // if cache still valid if (strtotime($offer['VALID']) + $store['CACHETIME'] > time()) { } } } } } ?>