<?php
include_once("inc/conn.php");
include_once("inc/function.php");

$query=$db->query("select * from {$web_dbtop}gamedodge where zt=0 and UNIX_TIMESTAMP(time) < UNIX_TIMESTAMP(NOW())-3600*24");
while($rs=$db->fetch_array($query)){
	$db->query("update {$web_dbtop}users set points=points+".$rs["points"]." where id=".$rs["uid"]);
	$db->query("update {$web_dbtop}game_log set gamedodge_hd=gamedodge_hd+".$rs["points"]." where uid=".intval($_COOKIE["usersid"]));
	$db->query("INSERT INTO {$web_dbtop}msg (usersid,title,mag,mid,time) VALUES (0,'猜拳无人挑战退回','您摆擂的第".$rs["id"]."期猜拳，因24小时无人挑战投注的".$rs["points"].$web_moneyname."已经退回',".$rs["uid"].",'".date("Y-m-d H:i:s")."')");
	$db->query("delete from {$web_dbtop}gamedodge where id=".$rs["id"]);
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>猜拳-游戏中心-<?=$web_name;?></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="keywords" content="<?=$web_keywords;?>" />
<meta name="description" content="<?=$web_description;?>" />
<META http-equiv=X-UA-Compatible content=IE=EmulateIE7>
<link href="style/default.css" rel="stylesheet" type="text/css" />
</head>
<?php include_once("top.php");?>
<script language="javascript">
qiehuan(2);
document.getElementById("qh_con2").getElementsByTagName('li')[6].className="current";
</script>
<DIV class="wrapper">
	<DIV class="page_content">
		<DIV class="webgame-info-title">
		  <UL>
			<LI class="current"><A href="dodge.php">猜拳首页</A></LI>
			<LI><A href="dodgeinsert.php">我要摆擂</A></LI>
			<LI><A href="dodgemylist.php">我的投注记录</A></LI>
			<LI><A href="bbs/forum.php?forumsid=5">玩家交流</A></LI>
		  </UL>
		</DIV>
		<DIV class="webgame-info">
			<DIV class="webgame-info-tabs">
			  <TABLE cellSpacing=1 cellPadding=0 width=940 align=center bgColor=#b63a2a border=0>
                <TBODY>
                  <TR>
                    <TD align=middle width=100 background=images/dn02.jpg bgColor=#ffffff height=28>摆擂时间</TD>
                    <TD align=middle background=images/dn02.jpg bgColor=#ffffff>擂主</TD>
                    <TD align=middle width=100 background=images/dn02.jpg bgColor=#ffffff>投注<?=$web_moneyname?></TD>
                    <TD width="250" align=middle background=images/dn02.jpg bgColor=#ffffff>挑战者</TD>
                    <TD align=middle width=100 background=images/dn02.jpg bgColor=#ffffff>操作</TD>
                  </TR>
                  <?
				$intpage = 30;
				if (isset($_GET['page'])){
					$rsnum = (intval($_GET['page']) -1)*$intpage;
				}else{
					$rsnum = 0;
				}
				$sql="select * from {$web_dbtop}gamedodge Order by zt asc,id desc";
				$query=$db->query($sql);
				if($db->fetch_array($query)) 
					$intnum=$db->num_rows($query);
				$query=$db->query($sql." limit $rsnum,$intpage");
					while($rs=$db->fetch_array($query)){
				?>
                  <TR>
                    <TD class=font12game align=middle bgColor=#fbe4de height=32><?=date("m-d H:i",strtotime($rs["time"]));?></TD>
                    <TD align=middle bgColor=#ffffff class=font12game><A href="user.php?id=<?=$rs["uid"]?>" target=_blank>
                      <?=$rs["uid"]?>
                    </A></TD>
                    <TD class=font12game align=middle bgColor=#ffffff><?=number_format($rs["points"]);?>
                        <img src="<?=$web_moneypic?>" align="absmiddle" /></TD>
                    <TD class=font12game align=middle bgColor=#ffffff><? if($rs["zt"]==1){?>
                        <SPAN class=rf><A href="user.php?id=<?=$rs["tzid"]?>" target=_blank>
                        <?=$rs["tzid"]?>
                        </a></SPAN>
                        <? }?></TD>
                    <TD align=middle bgColor=#ffffff><? if($rs["zt"]==0){?>
                        <A href="dodgeinsert.php?act=tz&dodgeno=<?=$rs["id"]?>">挑战</A>
                        <? }else{?>
                        <A href="dodgelook.php?dodgeno=<?=$rs["id"]?>">查看</A>
                        <? }?></TD>
                  </TR>
                  <?
				}
				?>
                </TBODY>
              </TABLE>
			  <TABLE cellSpacing=4 cellPadding=2 width=940 align=center border=0>
                <TBODY>
                  <TR>
                    <TD align=center><?php
					  include_once("inc/page_class.php");
					  $page=new page(array('total'=>$intnum,'perpage'=>$intpage));
					  echo $page->show(5,"","");?></TD>
                  </TR>
                </TBODY>
              </TABLE>
		  </DIV>
			<DIV class=cl></DIV>
		</DIV>
		<DIV class="area960-b h5px"></DIV>
	<!--Flink End-->
	<div class="blank10"></div>
	<!--Footer Start-->
<?php include_once("footer.php");?>
</DIV>