% require("wsm.inc"); require("../auction.inc"); require("../bids.inc"); require("../registration_manager.php"); wsm_no_cache(); error_reporting(E_ALL | E_STRICT); $auction_fancy_box = false; $user_id = ""; $rm = new RegistrationManager; $rm->set_cookie_name($auction_cookie_name); $rm->open_db("localhost", "heckler_db_admin", "eTVaPs5MXUadYkG0", $auction_db, "user"); $logged_in = $rm->logged_in(); if ($logged_in) { $user_id = $rm->get_field("user_id"); } $item = get_cgi_parameter("item", 0); $lot = get_cgi_parameter("lot", 0); if ($lot > 0) { $item = $lot; } $thing = get_thing(); $thing_cap = get_thing_cap(); $things = get_things(); define("IP_TIME", 6*60*60); // min time for hit with same IP address function show_large($n, $image, $link) { echo " ($link)"; } ############################## ## check_ip ############################## function check_ip($id) { $ip = getenv("REMOTE_ADDR"); // optimize, add the record, if we get an error, he has viewed it in the last N hours // $sql = "INSERT auction_ip SET id='$id', ip='$ip', date=UNIX_TIMESTAMP(), hits=1"; $result = wsmsql_query($sql, "Picture::check_ip (insert IP)", "id=$id"); if ($result) { return TRUE; } // probably a duplicate key error... // find out if this IP address has viewed this picture before // $sql = "SELECT id, ip, date FROM auction_ip WHERE id='$id' and ip='$ip'"; $result = wsmsql_query($sql, "Picture::check_ip", "id=$id"); if (mysql_num_rows($result) == 1) { // Yes, see if it was more than a day ago update the last viewed date if so // $myrow = mysql_fetch_object($result); if ($myrow->date + IP_TIME <= time()) { $sql = "UPDATE auction_ip SET date=UNIX_TIMESTAMP(), hits = hits + 1 WHERE id='$id' and ip='$ip'"; wsmsql_query($sql, "Picture::check_ip (update date)", "id=$id"); return TRUE; } } return FALSE; } // end check_ip $sql = sql_format("SELECT phase, updated, message, window_start, window_minutes, window_start_date FROM status"); $result = $rm->_query($sql); $status = mysql_fetch_object($result); $phase = $status->phase; $window_start = $status->window_start; $window_minutes = $status->window_minutes; $window_start_date = $status->window_start_date; if (!check_phase($phase, "view", $user_id)) { echo "
ERROR: You can not view $things in the '$phase' phase
"; echo "