<?
  error_reporting(0);
	include("config/connect.php");
	include("functions.php");
	if($_SESSION["userid"])	$uid = $_SESSION["userid"];

	$ipaddress = $_SERVER['REMOTE_ADDR']; 
		
	if($_SESSION["ipid"]=="" && $_SESSION["login_logout"]=="")
	{
		$qryipins = "Insert into login_logout (ipaddress,load_time) values('".$ipaddress."',NOW())";
		mysql_query($qryipins) or die(mysql_error());
		$ipid = mysql_insert_id();

		$qryipsel = "select * from login_logout where id='$ipid'";
		$rsip = mysql_query($qryipsel);
		$obj = mysql_fetch_object($rsip);
		$_SESSION["ipid"] = $obj->load_time;
		$_SESSION["ipaddress"] = $ipaddress;
	}
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>拍客网</title>
<link href="style/css/index.css" rel="stylesheet" type="text/css" />
<meta name="Description" content="竞拍 抢拍 一元拍 拍卖 gobid weabid " />
<meta name="Keywords" content="竞拍 抢拍 一元拍 拍卖 gobid weabid " />

<script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script language="javascript" src="jquery.js"></script>
<script language="javascript" src="effect.js"></script>
<script language="javascript" src="default.js"></script>
<script language="javascript" src="jqModal.js"></script>
<script language="javascript" src="function.js"></script>
<script language="javascript" src="basic.js"></script>
  <script language="javascript">
    function _delete_login_fields(_field, _default, _current) {
      if (_default == _current) {
        _field.value='';
      }
    }
  </script>
</head>
<body id="main_div" onload="OnloadPage();">
<?
	include("d1.php");
	
?>		

<div id="wrap">
	<div id="col1">
    	<div class="banner"><script type="text/javascript">
  				var swf_width=693;
  				var swf_height=179;
  			</script>
  			<script type="text/javascript" src="data/flashdata/redfocus/cycle_image.js"></script></div>
        <div class="info"><img src="style/images/left-info-index.gif" /></div>
        <div class="hot">
        	<div class="hot-title">今日热拍</div>
            <div class="hot-wrap">
            	<ul>

	<?	$now=time();
	
	$qryauc = "select *, p.productID as pid,substring(p.name,1,10) as name,".$lng_prefix."short_desc as short_desc from auction a left join products p on a.productID=p.productID left join auc_due_table adt on a.auctionID=adt.auction_id where adt.auc_due_time>$now and a.is_close='0' and featured_flag='0' and is_hot=1 and is_exprice=0 and a.auc_start_time <".$now." order by adt.auc_due_time limit 0,3";
	$resauc = mysql_query($qryauc);
	$totalauc = mysql_num_rows($resauc);
	
	
				   if($totalauc>0){ 
				   $a = 1;
				   $i=0;
				   while($objauc=mysql_fetch_array($resauc))
				   {	
					   
						if($a==1)
						{
							$co = "'".$objauc["auctionID"]."'";
							$arr = $objauc["auctionID"];
							$prr = $objauc["auc_due_price"];
						}
						else
						{
							$co .= ",'".$objauc["auctionID"]."'";
							$arr .= ",".$objauc["auctionID"];
							$prr .= ",".$objauc["auc_due_price"];
						}
				?>
                			
          <div class="auction-item" style="display: none" title="<?=$objauc["auctionID"];?>" id="auction_<?=$objauc["auctionID"];?>"></div>
					<li>
							
        <div class="thumb">
<a href="auction_<?=str_replace(" ","_",strtolower(stripslashes($objauc["name"])));?>_<?=$objauc["auctionID"];?>.html" target="_blank">
<img src="uploads/products/thumbs_big/thumbbig_<?=$objauc["picture1"];?>" alt="<?=stripslashes($objauc["name"]);?>" width="175" height="150" border="0" /></a></div>

        <div class="title"><a href="auction_<?=str_replace(" ","_",strtolower(stripslashes($objauc["name"])));?>_<?=$objauc["auctionID"];?>.html" target="_blank"><?=stripslashes($objauc["name"]);?>
</a></div>
			<div>					<div class="time">
								 <span id="counter_index_page_<?=$objauc["auctionID"];?>">
									<? 
			                         $now=time();
		                             $newtime=$objauc["auc_due_time"]-$now;
									echo "<script language='javascript' type='text/javascript'>
									document.getElementById('counter_index_page_".$objauc["auctionID"]."').innerHTML = calc_counter_from_time('".$newtime."');
									</script>";
								   ?>
								  </span>
								</div>
								<div  class="current-price">当前价：
									<span id="currencysymbol_<?=$objauc["auctionID"];?>"></span><span id="price_index_page_<?=$objauc["auctionID"];?>">---</span>
								</div>
								<div class="username">出价人: <span id="product_bidder_<?=$objauc["auctionID"];?>">---</span></div>
							</div>

							
						<div  class="bid-button">
						  	 <? 
						  	    if($uid=="")
						  	    { 
						  	 ?>
								<img src="style/images/left-hot-button.gif" border="0"  alt="BID" onmouseover="this.src='style/images/LOGIN_btn-2.png'" onmouseout="this.src='style/images/left-hot-button.gif'" onclick="javascript: window.location.href='login.html'" id="image_main_<?=$objauc["auctionID"];?>"  style="cursor: pointer"/>
						  <? } else { ?>
						    <?				       
						       if(getWonCount()<8)
						       {
						    ?> 
								<img src="style/images/left-hot-button.gif" border="0" class="bid-button-link" name="getbid.php?prid=<?=$objauc["productID"];?>&aid=<?=$objauc["auctionID"];?>&uid=<?=$uid;?>" alt="BID" onmouseover="this.src='style/images/left-hot-button.gif'" onmouseout="this.src='style/images/left-hot-button.gif'" id="image_main_<?=$objauc["auctionID"];?>"  style="cursor: pointer"/>
						  	<? }else{ ?>
								<img src="style/images/left-hot-button.gif" border="0" name="" alt="BID" onclick="alert( '<?=stripslashes($lng_notice_maxbidnum);?>' );" onmouseover="this.src='style/images/left-hot-button.gif'" onmouseout="this.src='style/images/left-hot-button.gif'" id="image_main_<?=$objauc["auctionID"];?>"  style="cursor: pointer"/>
						  	<?	 } ?>
						  <? }?>
							</div>
						<!--div class="openAuction_itemvalue"><?=stripslashes($lng_itemvalue);?><?=$Currency.number_format($objauc["price"],2);?></div-->						
						<!--div style="height: 10px;">&nbsp;</div-->
					</li>

					<?
						$a++;
						}
					}
					else
					{
					?>
					<div style="height: 10px;">&nbsp;</div>
					<div class="noauction_message">没有热拍</div>	
					<?
					}
					?>
										
				
                         
                </ul>
            </div>
        </div>




        
        <div class="bid-list">
        	<div class="bid-title">正在竞拍</div>
            <div class="bid-wrap">
            	<ul>
					<?	$now=time();
	
	$qryauc = "select *, p.productID as pid,substring(p.name,1,10) as name,".$lng_prefix."short_desc as short_desc from auction a left join products p on a.productID=p.productID left join auc_due_table adt on a.auctionID=adt.auction_id where adt.auc_due_time>$now and a.is_close='0' and featured_flag='0' and is_exprice=0 and is_hot=0  and a.auc_start_time <".$now." order by adt.auc_due_time ";
	$resauc = mysql_query($qryauc);
	$totalauc = mysql_num_rows($resauc);
	
	//$qryfu = "select *, p.productID as pid, p.name as name,short_desc as short_desc from auction a left join products p on a.productID=p.productID where a.auc_status=1";
	//$resfu = mysql_query($qryfu);
	//$totalfu = mysql_num_rows($resfu);
	
	//echo $uid;
	
				   if($totalauc>0){ 
				   $a = 1;
				   $i=0;
				   while($objauc=mysql_fetch_array($resauc))
				   {	
					   
						if($a==1)
						{
							$co = "'".$objauc["auctionID"]."'";
							$arr = $objauc["auctionID"];
							$prr = $objauc["auc_due_price"];
						}
						else
						{
							$co .= ",'".$objauc["auctionID"]."'";
							$arr .= ",".$objauc["auctionID"];
							$prr .= ",".$objauc["auc_due_price"];
						}
				?>
                	
				
          <div class="auction-item" style="display: none" title="<?=$objauc["auctionID"];?>" id="auction_<?=$objauc["auctionID"];?>"></div>
					<li>
							
        <div class="thumb">
<a href="auction_<?=str_replace(" ","_",strtolower(stripslashes($objauc["name"])));?>_<?=$objauc["auctionID"];?>.html" target="_blank">
<img src="uploads/products/thumbs_big/thumbbig_<?=$objauc["picture1"];?>" alt="<?=stripslashes($objauc["name"]);?>" width="92" height="78" border="0" /></a></div>

        <div class="bid-info">
                        	<span class="title"><a href="auction_<?=str_replace(" ","_",strtolower(stripslashes($objauc["name"])));?>_<?=$objauc["auctionID"];?>.html" target="_blank"><?=stripslashes($objauc["name"]);?>
</a> </span>
                            <span class="price"><div  class="current-price">当前价：
									<span id="currencysymbol_<?=$objauc["auctionID"];?>"></span><span id="price_index_page_<?=$objauc["auctionID"];?>">---</span>
								</div></span>
                            <span class="username"><div class="username">出价人: <span id="product_bidder_<?=$objauc["auctionID"];?>">---</span></div>
							</span>
                        </div>


				<div class="time">
								 <span id="counter_index_page_<?=$objauc["auctionID"];?>">
									<? 
			                         $now=time();
		                             $newtime=$objauc["auc_due_time"]-$now;
									echo "<script language='javascript' type='text/javascript'>
									document.getElementById('counter_index_page_".$objauc["auctionID"]."').innerHTML = calc_counter_from_time('".$newtime."');
									</script>";
								   ?>
								  </span>
								</div>
								

							
						<div  class="bid-button">
						  	 <? 
						  	    if($uid=="")
						  	    { 
						  	 ?>
								<img src="style/images/bid_list_but2.jpg" border="0"  alt="BID" onmouseover="this.src='style/images/bid_login_btn2.jpg'" onmouseout="this.src='style/images/bid_list_but2.jpg'" onclick="javascript: window.location.href='login.html'" id="image_main_<?=$objauc["auctionID"];?>"  style="cursor: pointer"/>
						  <? } else { ?>
						    <?				       
						       if(getWonCount()<8)
						       {
						    ?> 
								<img src="style/images/bid_list_but2.jpg" border="0" class="bid-button-link" name="getbid.php?prid=<?=$objauc["productID"];?>&aid=<?=$objauc["auctionID"];?>&uid=<?=$uid;?>" alt="BID" onmouseover="this.src='style/images/bid-list-button.gif'" onmouseout="this.src='style/images/bid_list_but2.jpg'" id="image_main_<?=$objauc["auctionID"];?>"  style="cursor: pointer"/>
						  	<? }else{ ?>
								<img src="style/images/bid_list_but2.jpg" border="0" name="" alt="BID" onclick="alert( '<?=stripslashes($lng_notice_maxbidnum);?>' );" onmouseover="this.src='style/images/bid-list-button.gif'" onmouseout="this.src='style/images/bid_list_but2.jpg'" id="image_main_<?=$objauc["auctionID"];?>"  style="cursor: pointer"/>
						  	<?	 } ?>
						  <? }?>
							</div>
						<!--div class="openAuction_itemvalue"><?=stripslashes($lng_itemvalue);?><?=$Currency.number_format($objauc["price"],2);?></div-->						
						<!--div style="height: 10px;">&nbsp;</div-->
						 <div class="clear"></div>
					</li>

					<?
						$a++;
						}
					}
					else
					{
					?>
					<div style="height: 10px;">&nbsp;</div>
					<div class="noauction_message">没有竟拍</div>	
					<?
					}
					?>
                    
                </ul>
  </div>
        </div>
        
        <div class="col1-row">
        
        	<div class="chat">
            	<div class="chat-title">聊天室</div>
                <div class="chat-list">
                	<ul>
<?	
	$qryauc = "select * from chat  c left join  auction  a on a.auctionID=c.bid left join products p on a.productID=p.productID order by addtime desc limit 0,20";
	$resauc = mysql_query($qryauc);
	$totalauc = mysql_num_rows($resauc);

	
				   if($totalauc>0){ 
				   while($objauc=mysql_fetch_array($resauc))
				   {	

				?>
                    	<li>
                        	<div class="chat-info">
                            	<span class="username"><?=$objauc["username"];?></span>
                                <span class="info-text"><?=$objauc["content"];?></span>
                            </div>
                            <div class="product-title"><a href="auction_<?=str_replace(" ","_",strtolower(stripslashes($objauc["name"])));?>_<?=$objauc["auctionID"];?>.html" target="_blank"><?=stripslashes($objauc["name"]);?>
</a> </div>
                        </li>
                    <?
					}
				   }
					?>                                                                                       
                    </ul>
                </div>
            </div>
            
            <div class="help">
            	<div class="help-title">帮助中心</div>
                <div class="help-wrap">
                	<div class="intro">
若您有任何问题，都可以通过免费电话或者网上在线客服与我们联系。我们将竭诚为您服务。                    
                    </div>
                    <div class="list">
                    	<ul>
                        	<li><a href="article_5.html">竞拍流程</a></li>
                            <li><a href="article_6.html">竞拍规则</a></li>
                            <li style="margin-right:0"><a href="article_7.html">竞拍秘籍</a></li>
                            <li><a href="article_4.html">服务条款</a></li>
                            <li><a href="article_10.html">安全承诺</a></li>
                            <li style="margin-right:0"><a href="article_15.html">意见反馈</a></li>
                        </ul>
                    </div>
                    <div class="list-row"><a href="article_16.html"><img src="style/images/online-service.gif" /></a></div>
                    <div class="list-row">7*24小时服务热线：13658411171</div>
                    <div class="list-row">服务邮箱：805731202@qq.com</div>
                </div>
            </div>
            
            <div class="clear"></div>
        </div>
    </div>
    <div id="col2">
    	<div class="announce">
        	<div class="announce-title">网站公告<span class="more"><a href="{:U('default-announce/index')}">更多</a></span></div>
            <div class="announce-list">
            	<ul>
				<?php
						$qrynews = "select * from news where news_type=1 order by news_date desc limit 0,6 ";
						$resnews = mysql_query($qrynews);
						$totalnews = mysql_num_rows($resnews);
				    if($totalnews>0)
				    { 
				      $i_news = 1;
				      while($objnews=mysql_fetch_array($resnews))
				      {
				      	?>

						<li>
                			<div class="list-title"><a href="news_arc.html?arcid=<?=$objnews["id"];?>"><?=stripslashes($objnews["news_title"]);?></a></div>
                			<div class="list-time"><?=date('m/d',$objnews['news_date']);?></div>
                		</li>
				      	<?
								$i_news++;
							}				      	
				    }
				?>
                </ul>
            </div>
        </div>
        
        <div class="option">
        	<ul>
            	<li><a href="faq.html">如何获得拍币？</a></li>
                <li><a href="faq.html">如何参与竞拍？</a></li>
                <li><a href="faq.html">什么是差价购买？</a></li>
                <li><a href="faq.html">如何晒单？</a></li>
            </ul>
        </div>
        
        <div class="trends">
        	<div class="trends-title">看看拍友在忙什么</div>
            <div class="trends-list">
            	<ul>
				<?php
						$qryuser = "select username from registration order by register_date desc limit 0,7 ";
						$resnews = mysql_query($qryuser);
						$totalnews = mysql_num_rows($resnews);
				    if($totalnews>0)
				    { 
				      $i_news = 1;
				      while($objnews=mysql_fetch_array($resnews))
				      {
				      	?>

                    	
                	<li>
                    	<span class="username"><?=$objnews["username"];?>：</span>
                        <span class="info">刚刚加入拍客网</span>
                    </li>
					 <?
					}
				   }
					?>       
                	                                                                                                          
                </ul>
            </div>
        </div>
        
        <div class="new">
        	<div class="new-title">最新成交</div>
            <div class="new-list">
            	<ul>
         <?php
  $qrycount = "select w.id,r.username,w.won_date,p.name,a.auc_final_price,a.auctionID,p.picture1,p.price,(100-100*a.auc_final_price/p.price) as discount,a.auctionID from won_auctions w left join auction a on w.auction_id=a.auctionID left join products p on a.productID=p.productID inner join registration r on w.userid = r.id where w.userid>=0 order by w.won_date desc limit 0,7 ";  
  $rescount = mysql_query($qrycount);
  
  while($obj1 = mysql_fetch_array($rescount))
  { 
	  ?>
  
                	<li style="margin-top:0">
                    	<div class="thumb">
						<a  href="auction_<?=str_replace(" ","_",strtolower(stripslashes($obj1["name"])));?>_<?=$obj1["auctionID"];?>.html" >
                    		<img src="uploads/products/thumbs_big/thumbbig_<?=$obj1["picture1"];?>" alt="<?=stripslashes($obj1["name"]);?>" width="92" height="75" border="0" />
</a>
						</div>
                        <div class="new-info">
                        	<div class="title"><a  href="auction_<?=str_replace(" ","_",strtolower(stripslashes($obj1["name"])));?>_<?=$obj1["auctionID"];?>.html" >
							<?=$obj1["name"];?></a></div>
                            <div class="username">获胜者：<?=$obj1["username"];?>  </div>
                            <div class="price"> 成交价：￥<?=$obj1["auc_final_price"];?>  </div>
                        </div>
                    </li>
					<?php 
		  }
	
 
?>                                                                                                
                </ul>
            </div>
        </div>
        
        <div class="success">
        	<div class="success-title">拍友晒单</div>
            <div class="success-list">
            	<ul>
				
                	  <?php
  $qrycount = "select * from auc_show s left join auction a on s.bid_id=a.auctionID left join  products p on a.productID=p.productID  order by s.addtime desc limit 0,6 ";  
  $rescount = mysql_query($qrycount);
  
  while($obj1 = mysql_fetch_array($rescount))
  { 
	  ?>
  
                	<li style="margin-top:0">
                    	<div class="thumb"><a  href="auction_<?=str_replace(" ","_",strtolower(stripslashes($obj1["name"])));?>_<?=$obj1["auctionID"];?>.html" >
                    		<img src="uploads/products/thumbs_big/thumbbig_<?=$obj1["picture1"];?>" alt="<?=stripslashes($obj1["name"]);?>" width="92" height="75" border="0" />
</a></div>
                        <div class="success-info">
                        	<div class="title"><a  href="auction_<?=str_replace(" ","_",strtolower(stripslashes($obj1["name"])));?>_<?=$obj1["auctionID"];?>.html" >
							<?=$obj1["name"];?></a></div>                            
                            <div class="price"> 成交价：￥<?=$obj1["auc_final_price"];?>  </div>
                            <div class="username">获胜者：<?=$obj1["username"];?>  </div>
                        </div>
                    </li>  
					<?php 
		  }
 
?>                      
                                                                                                                             	
                </ul>
            </div>
        </div>
    </div>
    <div class="clear"></div>
</div>

<input type="hidden" id="appPath" value="/" />
<script src="js/hp.js" type="text/javascript"></script>

<script type="text/javascript" src="js/o_code.js"></script>
<input type="hidden" id="qahp" value="qahp" />

<?php
  include("footer2.php");  
?>   
<span style="display: none;" class="firstimagebold" id="firstimage_bold"><?=$totalauc;?></span>
<!-- 主体内容结束-->

</body>
</html>
