<?
		include("config/connect.php");
		include("functions.php");
		$uid = $_SESSION["userid"];
		$flipflop = $_GET["flp"];

		$aucidsnew = '';
		foreach($_POST as $name => $value)
		{
			if($aucidsnew=='')
			{
				$aucidsnew .= "'".$value."'";
			}
			else
			{
				$aucidsnew .= ",'".$value."'";

			}	
		}
		      $now=time();
			$qrysel = "select * from auc_due_table adt left join auction a on a.auctionID=adt.auction_id where a.auctionID in (".$aucidsnew.") order by auc_due_time";
			$ressel = mysql_query($qrysel);
			$total = mysql_num_rows($ressel);
			for($i=1;$i<=$total;$i++)
			{
				$obj = mysql_fetch_object($ressel);
				//$newtime = $obj->auc_due_time;

               	$qr = "select * from bid_account ba left join registration r on ba.user_id=r.id where auction_id='".$obj->auction_id."' and bid_flag='d' order by ba.id desc limit 0,1";
				$res2 = mysql_query($qr);
				$total2 = mysql_num_rows($res2);
				$obj2 = mysql_fetch_object($res2);
				$username = $obj2->username;

				$now=time();
				$newtime=$obj->auc_due_time - $now;
				
				$newprice = $obj->auc_due_price;
				$pstatus = $obj->pause_status;
	
			
				/*
						$sql="select bids_info from bidsinfo where auctionID='".$obj->auction_id."'";						
						$resb = mysql_query($sql);
						$tb = mysql_num_rows($resb);
						if($tb>0){
							$objb = mysql_fetch_object($resb);
							$bids_info = $objb->bids_info;
					  }
				*/
				
				if($i==1)
				{
					$temp = '{"auction":{"id":"'.$obj->auction_id.'","time":"'.$newtime.'","pause":"'.$pstatus.'","price":"'.$newprice.'","username":"'.$username.'"}}';
				}
				else
				{
					$temp .= ',{"auction":{"id":"'.$obj->auction_id.'","time":"'.$newtime.'","pause":"'.$pstatus.'","price":"'.$newprice.'","username":"'.$username.'"}}';
				}
	
			}
		
		echo iconv('gb2312','utf-8',"[".$temp."]");
		//echo "[".$temp."]";
?>
