db = new db(); $this->Args = func_get_args(); if(count($this->Args) == 1) { $this->direction = $this->Args[0]; } if(count($this->Args) > 1) { $this->direction = $this->Args[0]; $this->auction_data = $this->db->getData(AUCTION_TABLE, "*", "auction_id", $this->Args[1]); } } function bid($data) { if(time() >= strtotime($this->auction_data[0]['start_time']) && time() <= $this->auction_data[0]['end_time']) { if($this->direction == "normal") { if($data['amount'] < $this->auction_data[0]['minmax']) { return false; } } else { if($data['amount'] > $this->auction_data[0]['minmax']) { return false; } } $before_end = mktime(date("H", $this->auction_data[0]['end_time']), date("i", $this->auction_data[0]['end_time']) - AUCTION_INTERVAL, date("m", $this->auction_data[0]['end_time']), date("d", $this->auction_data[0]['end_time']), date("Y", $this->auction_data[0]['end_time'])); $after_end = mktime(date("H", $this->auction_data[0]['end_time']), date("i", $this->auction_data[0]['end_time']) + AUCTION_INTERVAL, date("m", $this->auction_data[0]['end_time']), date("d", $this->auction_data[0]['end_time']), date("Y", $this->auction_data[0]['end_time'])); if(time() >= $before_end) { $update_data = array("end_time" => $after_end); $update_result = $this->db->update(AUCTION_TABLE, "auction_id", $this->auction_data[0]['auction_id'] ); } $result = $this->db->add(BIDS_TABLE, $data); if($result) { return true; } } else { return false; } } } ?>