document.location.href='install.php'"; } else { #/////////////////////////////////////////////////////// require_once ('./includes/config.inc.php'); #// Run cron according to SETTINGS if($SETTINGS['cron'] == 2) { include_once "cron.php"; } require_once ("./header.php"); function get_next_bid($auction_id) { if (intval($auction_id)>0) { $result = mysql_query("SELECT * FROM BPPENNYAUTOBID_auctions WHERE id=" . intval($auction_id)); $result_bids = mysql_query("select max(bid) AS maxbid, bidder FROM BPPENNYAUTOBID_bids WHERE auction=" . intval($auction_id) . " GROUP BY auction, bidder ORDER BY maxbid DESC"); $customincrement = mysql_result($result, 0, "increment"); $max_bid = mysql_result($result_bids, 0, "maxbid"); $minimum_bid = mysql_result($result, 0, "minimum_bid"); if($max_bid == 0) { $MAX_BID = $minimum_bid; //// Added by Yosi 22 Jul 2009 - consider if auction starts with some value $max_bid = $minimum_bid; }else { $MAX_BID = $max_bid; } /* Get bid increment for current bid and calculate minimum bid */ $query = "SELECT increment FROM BPPENNYAUTOBID_increments WHERE " . "((low <= $MAX_BID AND high >= $MAX_BID) OR " . "(low < $MAX_BID AND high < $MAX_BID)) ORDER BY increment DESC"; //echo "
sql:
"; //echo "$query
"; $result_incr = mysql_query($query); if(mysql_num_rows($result_incr) != 0) { $increment = mysql_result($result_incr, 0, "increment"); } if($customincrement > 0) { $increment = $customincrement; } if($max_bid == 0 || $atype == 2) { $next_bid = $minimum_bid; }else { $next_bid = $max_bid + $increment; } return $next_bid; } else { return 0; } } function get_winner_name($auction_id) { $sql = "SELECT b.bid, b.bidder, COUNT(bid) AS bid_count,u.nick FROM BPPENNYAUTOBID_bids b INNER JOIN BPPENNYAUTOBID_users u ON b.bidder=u.id WHERE b.auction=".$auction_id." GROUP BY b.bid ORDER BY b.bid DESC "; $result = mysql_query($sql); if ($row1=mysql_fetch_array($result)) { return $row1['nick']; } else { return ""; } } $TIME = mktime(date("H") + $SETTINGS['timecorrection'], date("i"), date("s"), date("m"), date("d"), date("Y")); //echo "
"; $NOW = date("YmdHis", $TIME); /* prepare data for templates/template */ /* prepare categories list for templates/template */ # Prepare categories sorting if($SETTINGS['catsorting'] == 'alpha') { $catsorting = " ORDER BY t.cat_name ASC"; }else { $catsorting = " ORDER BY sub_counter DESC"; } $TPL_categories_value = ""; $query = "select distinct * from BPPENNYAUTOBID_categories c, BPPENNYAUTOBID_cats_translated t WHERE c.parent_id=0 AND t.cat_id=c.cat_id AND t.lang='" . $USERLANG . "' $catsorting"; $result = mysql_query($query); if(!$result) { MySQLError($query); exit(); }else { $num_cat = mysql_num_rows($result); $i = 0; $TPL_categories_value = "\n"; $TPL_categories_value .= "$MSG_277"; } /********************************************************************************************/ //------------------------------------------------------------------------------ // prepare classic auctions values (get last created auctions) $query = "SELECT id,title,starts, ends, pict_url, auction_type, item_value, minimum_bid, bid_value,w_seat, Seat_Left, Seat_Number, Seat_Price, closed, started FROM BPPENNYAUTOBID_auctions WHERE closed='0' AND suspended=0 AND auction_type = 1 AND is_main_auction = 0 AND "; if($SETTINGS['adultonly'] == 'y' && !isset($_SESSION["BPPENNYAUTOBID_LOGGED_IN"])) { $query .= "adultonly='n' AND "; } if($category_id != ""){ if (subCategoriesList($category_id) !="") { $query .= "(category = ".$category_id." OR category IN (".subCategoriesList($category_id).")) AND "; } else { $query .= "category = ".$category_id." AND "; } } $query .= "starts <= " . $NOW . " ORDER BY ends ASC LIMIT " . $SETTINGS['lastitemsnumber']; $result = mysql_query($query); if($result) $num_auction = mysql_num_rows($result); else $num_auction = 0; $i = 0; $TPL_auctions_classic = array(); while($i < $num_auction) { $closed= mysql_result($result, $i, "closed"); $started= mysql_result($result, $i, "started"); $Seat_Price= mysql_result($result, $i, "Seat_Price"); $Seat_Number= mysql_result($result, $i, "Seat_Number"); $Seat_Left= mysql_result($result, $i, "Seat_Left"); $w_seat = mysql_result($result, $i, "w_seat"); $title = mysql_result($result, $i, "title"); $id = mysql_result($result, $i, "id"); $date = mysql_result($result, $i, "ends"); $pict_url = mysql_result($result, $i, "pict_url"); if($pict_url == "") { $pict_url = 'no_image.png'; } $auction_type = mysql_result($result, $i, "auction_type"); $item_value = mysql_result($result, $i, "item_value"); $bid_value = mysql_result($result, $i, "bid_value"); $year = substr($date, 0, 4); $month = substr($date, 4, 2); $day = substr($date, 6, 2); $hours = substr($date, 8, 2); $minutes = substr($date, 10, 2); $seconds = substr($date, 12, 2); $minimum_a_bid = mysql_result($result, $i, "minimum_bid"); $sql2="SELECT * FROM BPPENNYAUTOBID_auctions_signed WHERE auction_id=".$id." and user_id=".$_SESSION["BPPENNYAUTOBID_LOGGED_IN"]; $result2=mysql_query($sql2); $is_signed=mysql_num_rows($result2); if($Seat_Left>0 && $w_seat=="2" && $closed=="0") { $sql1="SELECT COUNT(*) as seats_sold FROM BPPENNYAUTOBID_auctions_signed WHERE auction_id=".$id; $result1=mysql_query($sql1); $seats_sold = mysql_result($result1,0,"seats_sold"); $Seat_Left=$Seat_Number-$seats_sold; $update="update BPPENNYAUTOBID_auctions set Seat_Left ='".$Seat_Left."' where id= '".$id."'"; mysql_query($update); } $sql="SELECT MAX(bid) AS max_bid FROM BPPENNYAUTOBID_bids WHERE auction=".$id; $result_bid = mysql_query($sql); #// Check bold and highlighted options $ISBOLD = FALSE; $ISHIGHLIGHTED = FALSE; $TPL_auctions_classic[$i] = array(); $TPL_auctions_classic[$i]["date_created"] = $month . "/" . $day . "/" . $year . " " . $hours . ":" . $minutes . ":" . $seconds; $TPL_auctions_classic[$i]["remained_seconds"]=strtotime($TPL_auctions_classic[$i]["date_created"])-time(); //ArrangeDateNoCorrection($day,$month,$year,$hours,$minutes); $TPL_auctions_classic[$i]["name"] = stripslashes($title); $TPL_auctions_classic[$i]["link_href"] = "./item.php?id=".$id."&history=view#history"; $TPL_auctions_classic[$i]["pict_url"] = $pict_url; $TPL_auctions_classic[$i]["item_value"] = stripslashes($item_value); $TPL_auctions_classic[$i]["bid_value"] = stripslashes($bid_value); $TPL_auctions_classic[$i]["winner"]=get_winner_name($id); $TPL_auctions_classic[$i]["w_seat"]=stripslashes($w_seat); $TPL_auctions_classic[$i]["Seat_Number"]=stripslashes($Seat_Number); $TPL_auctions_classic[$i]["Seat_Left"]=stripslashes($Seat_Left); $TPL_auctions_classic[$i]["Seat_Price"]=stripslashes($Seat_Price); $TPL_auctions_classic[$i]["started"]=stripslashes($started); $TPL_auctions_classic[$i]["is_signed"]=stripslashes($is_signed); $TPL_auctions_classic[$i]["next_bid"]=get_next_bid($id); $TPL_auctions_classic[$i]["winner"]=get_winner_name($id); $TPL_auctions_classic[$i]["current_bid"]=mysql_result($result_bid, 0, "max_bid"); if ($TPL_auctions_classic[$i]["current_bid"]=="") { $TPL_auctions_classic[$i]["current_bid"]=$minimum_a_bid; } $TPL_auctions_classic[$i]["auction_id"] = $id; $i++; } /********************************************************************************************/ //------------------------------------------------------------------------------ // prepare "more live auctions" $query = "SELECT id,title,starts, ends, pict_url, auction_type, item_value, minimum_bid, bid_value,w_seat, Seat_Left, Seat_Number, Seat_Price, closed, started FROM BPPENNYAUTOBID_auctions WHERE closed='0' AND suspended=0 AND auction_type = 1 AND is_main_auction = 0 AND "; if($SETTINGS['adultonly'] == 'y' && !isset($_SESSION["BPPENNYAUTOBID_LOGGED_IN"])) { $query .= "adultonly='n' AND "; } if($category_id != ""){ if (subCategoriesList($category_id) !="") { $query .= "(category = ".$category_id." OR category IN (".subCategoriesList($category_id).")) AND "; } else { $query .= "category = ".$category_id." AND "; } } $query .= "starts <= " . $NOW . " ORDER BY ends ASC LIMIT " . ($SETTINGS['lastitemsnumber']).",30"; $result = mysql_query($query); if($result) $num_auction1 = mysql_num_rows($result); else $num_auction1 = 0; $i = 0; $TPL_more_auctions = array(); while($i < $num_auction1) { $closed= mysql_result($result, $i, "closed"); $started= mysql_result($result, $i, "started"); $Seat_Price= mysql_result($result, $i, "Seat_Price"); $Seat_Number= mysql_result($result, $i, "Seat_Number"); $Seat_Left= mysql_result($result, $i, "Seat_Left"); $w_seat = mysql_result($result, $i, "w_seat"); $title = mysql_result($result, $i, "title"); $id = mysql_result($result, $i, "id"); $date = mysql_result($result, $i, "ends"); $pict_url = mysql_result($result, $i, "pict_url"); if($pict_url == "") { $pict_url = 'no_image.png'; } $auction_type = mysql_result($result, $i, "auction_type"); $item_value = mysql_result($result, $i, "item_value"); $bid_value = mysql_result($result, $i, "bid_value"); $year = substr($date, 0, 4); $month = substr($date, 4, 2); $day = substr($date, 6, 2); $hours = substr($date, 8, 2); $minutes = substr($date, 10, 2); $seconds = substr($date, 12, 2); $minimum_a_bid = mysql_result($result, $i, "minimum_bid"); $sql2="SELECT * FROM BPPENNYAUTOBID_auctions_signed WHERE auction_id=".$id." and user_id=".$_SESSION["BPPENNYAUTOBID_LOGGED_IN"]; $result2=mysql_query($sql2); $is_signed=mysql_num_rows($result2); if($Seat_Left>0 && $w_seat=="2" && $closed=="0") { $sql1="SELECT COUNT(*) as seats_sold FROM BPPENNYAUTOBID_auctions_signed WHERE auction_id=".$id; $result1=mysql_query($sql1); $seats_sold = mysql_result($result1,0,"seats_sold"); $Seat_Left=$Seat_Number-$seats_sold; $update="update BPPENNYAUTOBID_auctions set Seat_Left ='".$Seat_Left."' where id= '".$id."'"; mysql_query($update); } $sql="SELECT MAX(bid) AS max_bid FROM BPPENNYAUTOBID_bids WHERE auction=".$id; $result_bid = mysql_query($sql); #// Check bold and highlighted options $ISBOLD = FALSE; $ISHIGHLIGHTED = FALSE; $TPL_more_auctions[$i] = array(); $TPL_more_auctions[$i]["date_created"] = $month . "/" . $day . "/" . $year . " " . $hours . ":" . $minutes . ":" . $seconds; $TPL_more_auctions[$i]["remained_seconds"]=strtotime($TPL_more_auctions[$i]["date_created"])-time(); //ArrangeDateNoCorrection($day,$month,$year,$hours,$minutes); $TPL_more_auctions[$i]["w_seat"]=stripslashes($w_seat); $TPL_more_auctions[$i]["Seat_Number"]=stripslashes($Seat_Number); $TPL_more_auctions[$i]["Seat_Left"]=stripslashes($Seat_Left); $TPL_more_auctions[$i]["Seat_Price"]=stripslashes($Seat_Price); $TPL_more_auctions[$i]["started"]=stripslashes($started); $TPL_more_auctions[$i]["is_signed"]=stripslashes($is_signed); $TPL_more_auctions[$i]["name"] = stripslashes($title); $TPL_more_auctions[$i]["link_href"] = "./item.php?id=".$id."&history=view#history"; $TPL_more_auctions[$i]["pict_url"] = $pict_url; $TPL_more_auctions[$i]["item_value"] = stripslashes($item_value); $TPL_more_auctions[$i]["bid_value"] = stripslashes($bid_value); $TPL_more_auctions[$i]["next_bid"]=get_next_bid($id); $TPL_more_auctions[$i]["winner"]=get_winner_name($id); $TPL_more_auctions[$i]["current_bid"]=mysql_result($result_bid, 0, "max_bid"); $TPL_more_auctions[$i]["auction_id"] = $id; if ($TPL_more_auctions[$i]["current_bid"]=="") { $TPL_more_auctions[$i]["current_bid"]=$minimum_a_bid; } $i++; } $open_auction_num=$num_auction+$num_auction1; /****************************************************************************************/ /****************************************************************************************/ /** * NOTE: get higher bids */ $TPL_maximum_bids = ""; $query = "select auction,max(bid) AS max_bid FROM BPPENNYAUTOBID_bids b, BPPENNYAUTOBID_auctions a WHERE a.suspended=0 AND a.closed=0 AND a.id=b.auction GROUP BY b.bid,b.auction ORDER BY max_bid desc"; $result = mysql_query($query); if($result) $num_auction = mysql_num_rows($result); else $num_auction = 0; $i = 0; $j = 0; $bgcolor = "#FFFFFF"; $AU = array(); while($i < $num_auction && $j < $SETTINGS['higherbidsnumber']) { $max_bid = mysql_result($result, $i, "max_bid"); $auction = mysql_result($result, $i, "auction"); //-- Get auction data $query = "SELECT title,closed,id from BPPENNYAUTOBID_auctions WHERE id=\"$auction\" AND"; $query .= "'" . $NOW . "'>=starts"; //print $query; $result_bid = mysql_query($query); if(mysql_num_rows($result_bid) > 0) { $title = mysql_result($result_bid, 0, "title"); $closed = mysql_result($result_bid, 0, "closed"); $auc_id = mysql_result($result_bid, 0, "id"); } if($closed == "0" && !in_array($auction, $AU)) { #// Check bold and highlighted options $ISBOLD = FALSE; $ISHIGHLIGHTED = FALSE; $TPL_maximum_bids .= "

" . print_money($max_bid) . " "; if($ISHIGHLIGHTED) { $TPL_maximum_bids .= ""; } if($ISBOLD) { $TPL_maximum_bids .= ""; } $TPL_maximum_bids .= stripslashes($title); if($ISBOLD) { $TPL_maximum_bids .= ""; } if($ISHIGHLIGHTED) { $TPL_maximum_bids .= ""; } $TPL_maximum_bids .= "

"; if($bgcolor == "#FFFFFF") { $bgcolor = $FONTCOLOR[$SETTINGS['headercolor']]; }else { $bgcolor = "#FFFFFF"; } $AU[] = $auction; $j++; } $i++; } //-- Build news list if(($SETTINGS['newsbox'] == 1) && !isset($_SESSION["BPPENNYAUTOBID_LOGGED_IN"])) { $query = "SELECT title,id,new_date from BPPENNYAUTOBID_news where suspended=0 order by new_date DESC limit " . $SETTINGS['newstoshow']; $res = mysql_query($query); if(!$res) { MySQLError($query); exit(); } $TPL_news = array(); $TPL_news_list = ""; $i = 0; while($new = mysql_fetch_array($res)) { $TPL_news_list .= "
"; $TR = @mysql_fetch_array(@mysql_query("SELECT title,content FROM BPPENNYAUTOBID_news_translated WHERE id=".intval($new['id'])));//." AND lang='".addslashes($language)."'" $new['title']=$TR['title']; $new['content']=$TR['content']; $new_date = $new['new_date']; $F_date = FormatDate($new_date); $TPL_news_list .= "
"; $TPL_news_list .= $F_date." - ".substr($new['content'], 0, 90)."... More"; $TPL_news_list .= "
"; $TPL_news_list .= "
"; $TPL_news[$i] = $new; $i++; } }else { $TPL_news_list = " "; } $TPL_news_list .= "  " . $MSG_31_0046 . ""; //-- Build closed auctions list $query = "SELECT DISTINCT a.title, a.id, a.pict_url, w.bid, w.winner, a.ends AS closingdate, w.bid, u.nick FROM BPPENNYAUTOBID_auctions a LEFT OUTER JOIN BPPENNYAUTOBID_winners w ON a.id = w.auction LEFT OUTER JOIN BPPENNYAUTOBID_users u ON w.winner = u.id WHERE auction_type = '1' AND closed = '1' ORDER BY ends DESC limit 0, 7"; $res = mysql_query($query); if(!$res) { //MySQLError($query); //exit; } $TPL_closed_auctions_list = ""; $TPL_closed_auctions = array(); $i = 0; while($row = mysql_fetch_array($res)) { $TPL_closed_auctions[$i] = $row; $title = ((strlen($row['title']) > 12) ? substr($row['title'], 0, 12) . "..." : $row['title']); $closed_date = $row['closingdate']; $pict_url = $row['pict_url']; if($pict_url == "") { $pict_url = 'no_image.png'; } $winner = ($row['winner'] != "") ? " Winner: " . $row['nick'] : ""; $bid = ($row['bid'] != "") ? " Won bid: " . $row['bid'] : ""; $F_date = FormatDate($closed_date); $TPL_closed_auctions_list .= "
"; $TPL_closed_auctions_list .= ""; $TPL_closed_auctions_list .= ""; $TPL_closed_auctions_list .= ""; $TPL_closed_auctions_list .= ""; $TPL_closed_auctions_list .= ""; if($row['pict_url']!="") { $TPL_closed_auctions_list .= ""; } else { $TPL_closed_auctions_list .= ""; } $TPL_closed_auctions_list .= "
" . $title . "" . $F_date . "
" . $row[" . $row["; $TPL_closed_auctions_list .= $MSG_40_020."
" . print_money($row['bid'], 2, '.', ' ') . "

"; $TPL_closed_auctions_list .= $MSG_40_021."
" . $row['nick'] . "

"; $TPL_closed_auctions_list .= "
"; $TPL_closed_auctions_list .= "
"; $TPL_closed_auctions_list .= "
"; $i++; } $TPL_closed_auctions_list .= "
"; $TPL_closed_auctions_list .= "  " . $MSG_31_0046 . ""; require_once (phpa_include("template_index_php.html")); require_once ('./footer.php'); } ?>