<?php
require_once("../check.php");
require_once("../../config.php");

$m="1";//每页显示的记录数
$sql_table = "dunling_web";//数据库表名
isset($_GET['page'])?$page=$_GET['page']:$page="1";//当前页数
$numsql = "select * from dunling_web where smoney>'0' and  not exists (select * from dunling_web_log where danhao=dunling_web.danhao and username='$username')";
$numery = mysql_query($numsql,$config);
$zongjilushu = mysql_num_rows($numery);//总记录数
$zy = (int)(($zongjilushu-1)/$m)+1;//总页数
$one = (int)($page-1)*$m;//当前页的首条记录
$listsql = "select * from dunling_web where smoney>'0' and not exists (select * from dunling_web_log where danhao=dunling_web.danhao and username='$username') order by danjia desc limit $one,$m";
$listery = mysql_query($listsql,$config);

$zsql = "select * from dunling_web_log where username='$username'";
$zery = mysql_query($zsql,$config);
$znum = mysql_num_rows($zery);
$list = mysql_fetch_array($listery);
mysql_close();
?>
<!DOCTYPE HTML>
<html>
<head>
<title>阅读浏览</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script src="../js/jquery-1.11.1.min.js"></script>
<script src="../js/a1.js"></script>
<link rel="stylesheet" type="text/css" href="../style/template.css" />
</head>
<body>
<div id="bg"></div>
<div id="windows">
<div class="Otime"></div>
<div class="text">
<div class="t1"></div>
</div>
<div class="Wclose">关</div>
</div>
<div id="top">&nbsp;总任务数: <span><?php echo $zongjilushu+$znum; ?></span> 个,您已完成 <span><?php echo $znum;?></span> 个 ，还剩 <span><?php echo $zongjilushu; ?></span> 个任务;每完成一个任务后可进行下一个任务!</div>

<?php
if($zongjilushu<"1"){
    exit;
}

?>
<div id="renwu">
<div class="title">任务编号:<?php echo $list['danhao'];?></div>

<div class="rw_l">阅览拥金</div>
<div class="rw_r"><?php echo $list['danjia'];?> (金币)</div>


<div class="rw_l">阅览时间</div>
<div class="rw_r"><?php echo $list['time'];?> (秒)</div>

<div class="rw_l">推广网址</div>
<div class="rw_r"><?php echo $list['title'];?></div>



<div class="rw_r" id="start"><input class="a1" id="<?php echo $list['danhao'];?>"  value="开始阅览" type="button" danhao="<?php echo $list['danhao'];?>" money="<?php echo $list['danjia'];?>" time="<?php echo $list['time'];?>"  url="<?php echo $list['url'];?>" /></div>
<div class="rw_r" id="next">
<?php
if($zongjilushu=="1"){
    echo '恭喜,您已完成所有任务!';
}elseif($zongjilushu > "1"){
    echo '<input class="a1" onclick="location.href=\'a1.php\'" value="下一个" type="submit"/>';
}
?>

</div>

</div>





</body>
</html>