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

$intpage = 30;
if (isset($_GET['page'])) {
	$rsnum = (intval($_GET['page']) -1)*$intpage;
}
else {
	$rsnum = 0;
}
if($_GET["minNO"] && $_GET["maxNO"]){
	$sql="Select {$web_dbtop}game16.id,{$web_dbtop}game16.kgtime,{$web_dbtop}game16.kgjg,{$web_dbtop}game16.zjpl,{$web_dbtop}game16.kj,{$web_dbtop}game16_users_tz.hdpoints,{$web_dbtop}game16_users_tz.points from {$web_dbtop}game16,{$web_dbtop}game16_users_tz where {$web_dbtop}game16.id={$web_dbtop}game16_users_tz.NO and {$web_dbtop}game16_users_tz.uid=".intval($_COOKIE["usersid"])." and {$web_dbtop}game16.id>=".intval($_GET["minNO"])." and {$web_dbtop}game16.id<=".intval($_GET["maxNO"])." and kj=1 Order by {$web_dbtop}game16.id desc";
}else{
	$sql="Select {$web_dbtop}game16.id,{$web_dbtop}game16.kgtime,{$web_dbtop}game16.kgjg,{$web_dbtop}game16.zjpl,{$web_dbtop}game16.kj,{$web_dbtop}game16_users_tz.hdpoints,{$web_dbtop}game16_users_tz.points from {$web_dbtop}game16,{$web_dbtop}game16_users_tz where {$web_dbtop}game16.id={$web_dbtop}game16_users_tz.NO and {$web_dbtop}game16_users_tz.uid=".intval($_COOKIE["usersid"])." and kj=1 Order by {$web_dbtop}game16.id desc";
}
$query=$db->query($sql);
if($rs=$db->fetch_array($query)){
	$maxid=$rs["id"];
	$intnum=$db->num_rows($query);
}

if($_GET["minNO"] && $_GET["maxNO"]){
	$query=$db->query("Select min({$web_dbtop}game16.id) as id,sum({$web_dbtop}game16_users_tz.hdpoints) as hdpoints,sum({$web_dbtop}game16_users_tz.points) as tzpoints from {$web_dbtop}game16,{$web_dbtop}game16_users_tz where {$web_dbtop}game16.id={$web_dbtop}game16_users_tz.NO and uid=".intval($_COOKIE["usersid"])." and {$web_dbtop}game16.id>=".intval($_GET["minNO"])." and {$web_dbtop}game16.id<=".intval($_GET["maxNO"]));
}else{
	$query=$db->query("Select min({$web_dbtop}game16.id) as id,sum({$web_dbtop}game16_users_tz.hdpoints) as hdpoints,sum({$web_dbtop}game16_users_tz.points) as tzpoints from {$web_dbtop}game16,{$web_dbtop}game16_users_tz where {$web_dbtop}game16.id={$web_dbtop}game16_users_tz.NO and uid=".intval($_COOKIE["usersid"]));
}
if($rs=$db->fetch_array($query)){
	$minid=$rs["id"];
	$tzpoints=$rs["tzpoints"];
	$sumpoints=$rs["hdpoints"];
}

if($_GET["minNO"] && $_GET["maxNO"]){
	$minid=$_GET["minNO"];
	$maxid=$_GET["maxNO"];
}
?>
<!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>开心16-游戏中心-<?=$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')[2].className="current";
</script>
<DIV class="wrapper">
	<DIV class="page_content">
		<DIV class="webgame-info-title">
		  <UL>
			<LI><A href="happy.php">开心16首页</A></LI>
			<LI><A href="happyhelp.php">开心16规则</A></LI>
			<LI class="current"><A href="happymylist.php">我的投注记录</A></LI>
			<LI><A href="happymodel.php">投注模式编辑</A></LI>
			<LI><A href="happyautoset.php">自动投注</A></LI>
			<LI><A href="happydirection.php">开心16走势图</A></LI>
		  </UL>
		</DIV>
		<DIV class="webgame-info">
			<DIV class="webgame-info-tabs">		  
			  <table width="940" height="27" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="12"><img src="images/game2_03.jpg" width="12" height="27" /></td>
                  <td background="images/game2_04.jpg" class="font14">我的投注记录:</td>
                  <td width="13"><img src="images/game2_06.jpg" width="13" height="27" /></td>
                </tr>
              </table>
			  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td height="5"></td>
                </tr>
              </table>
			  <table width="940" border="0" align="center" cellpadding="0" cellspacing="0">
                <form action="?" method="get">
                  <tr>
                    <td colspan="9"> 投注期数：
                        <input name="minNO" type="text" size="20" maxlength="10" value="<?=$minid?>"/>
        至
        <input name="maxNO" type="text" size="20" maxlength="10" value="<?=$maxid?>" />
        <input type="submit" name="btnSearch" value="查询" />
                    </td>
                  </tr>
                </form>
                <tr>
                  <td colspan="9" height="30"> 从
                      <?=$minid?>
      期 至
      <?=$maxid?>
      期已开奖期数中，你共投注
      <?=$tzpoints?>
      <?=$web_moneyname?>，中奖
      <?=$sumpoints;?>
      <?=$web_moneyname?>，共盈利（亏损）
      <?=$sumpoints-$tzpoints?>
      <?=$web_moneyname?>，盈亏比为
      <?=($sumpoints?number_format($sumpoints/$tzpoints*100,2):"00.00")?>
      %。 </td>
                </tr>
  <td bgcolor="#9F4F18"><table width="100%" border="0" cellpadding="0" cellspacing="1">
        <tr>
          <td width="80" height="28" align="center" background="images/happy16_40.jpg" bgcolor="#FFFFFF" class="font-white">期号</td>
          <td width="130" height="28" align="center" background="images/happy16_40.jpg" bgcolor="#FFFFFF" class="font-white">投注时间</td>
          <td align="center" background="images/happy16_40.jpg" bgcolor="#FFFFFF" class="font-white">开奖结果</td>
          <td width="100" align="center" background="images/happy16_40.jpg" bgcolor="#FFFFFF" class="font-white">投入<?=$web_moneyname?></td>
          <td width="100" align="center" background="images/happy16_40.jpg" bgcolor="#FFFFFF" class="font-white">获得<?=$web_moneyname?></td>
          <td width="80" align="center" background="images/happy16_40.jpg" bgcolor="#FFFFFF" class="font-white">赔率</td>
          <td width="80" align="center" background="images/happy16_40.jpg" bgcolor="#FFFFFF" class="font-white">盈亏比例</td>
          <td width="60" align="center" background="images/happy16_40.jpg" bgcolor="#FFFFFF" class="font-white">详细</td>
          <td width="100" align="center" background="images/happy16_40.jpg" bgcolor="#FFFFFF" class="font-white">保存为投注模式</td>
        </tr>
        <?php
					$query=$db->query($sql." limit $rsnum,$intpage");
					while($rs=$db->fetch_array($query)){
						$kgh=explode("|",$rs["kgjg"]);
						$zjpl=explode("|",$rs["zjpl"]);
					?>
        <tr>
          <td height="32" align="center" bgcolor="#FCF5E1" class="font12game"><?=$rs["id"]?></td>
          <td align="center" bgcolor="#FFFFFF" class="font12game"><?=$rs["kgtime"]?></td>
          <td align="center" bgcolor="#FFFFFF" class="font12game"><?="<img src=\"images/happy/number_".$kgh[3].".gif\" />"?></td>
          <td align="center" bgcolor="#FFFFFF" class="font12game"><?=number_format($rs["points"])?>
              <img src="<?=$web_moneypic?>" /></td>
          <td align="center" bgcolor="#FFFFFF" class="font12game"><?=number_format($rs["hdpoints"])."<img src=\"".$web_moneypic."\" />"?></td>
          <td align="center" bgcolor="#FFFFFF" class="font12game"><?=$zjpl[$kgh[3]-3]?></td>
          <td align="center" bgcolor="#FFFFFF" class="font12game"><?=number_format(($rs["hdpoints"]/$rs["points"]*100),2)."%"?></td>
          <td align="center" bgcolor="#FFFFFF"><a href="happymydetail.php?happyno=<?=$rs["id"]?>">查看</a></td>
          <td align="center" bgcolor="#FFFFFF"><a href="happymodelsave.php?happyno=<?=$rs["id"]?>">保存</a></td>
        </tr>
        <?
				  }
				  ?>
    </table></td>
  </tr>
              </table>
			  <table width="940" border="0" align="center" cellpadding="2" cellspacing="4">
                <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>
              </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>