<?php include("sql/conn.php"); 
session_start(); //开着身份验证，以后写
?>

<?php 
//截取中文字符串 
function mysubstr($str, $start, $len) { 
$tmpstr = ""; 
$strlen = $start + $len; 
for($i = 0; $i < $strlen; $i++) { 
if(ord(substr($str, $i, 1)) > 0xa0) { 
$tmpstr .= substr($str, $i, 2); 
$i++; 
} else 
$tmpstr .= substr($str, $i, 1); 
} 
return $tmpstr; 
} 
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><?php include("adm/all/gjz.txt"); ?>网页游戏</title>
<meta name="description" content="<?php include("adm/all/description.txt"); ?>网页游戏" />
<meta name="keywords" content="<?php include("adm/all/gjz.txt"); ?>网页游戏" />
<link  href="css/css<?php include("adm/all/css.txt"); ?>.css" rel="stylesheet" type="text/css">

<style type="text/css">
<!--
#dh27 {
	width: 958px;
	overflow: hidden;

}
#dh28 {
	width: 698px;
	overflow: hidden;
	float: left;
	border-right-width: 1px;
	border-right-style: solid;
	border-right-color: #00FFFF;
	font-size: 16px;
	text-align: left;
}
#dh29 {
	width: 246px;
	overflow: hidden;
	float: right;
	white-space:nowrap;
}
-->
</style>


</head>

<?php
$result = mysql_query("select distinct name from webk");
while($row = mysql_fetch_array($result))
  {
               	 $result1 = mysql_query("SELECT * FROM webyxlb where name ='".$row['name']."'");
	           	  if (mysql_num_rows($result1) != 0)//检查库里是否有这个用户名
	           	  {/////echo "有了不加了！";
	           	  }
				  else
				  {
				  mysql_query("INSERT INTO webyxlb (name) VALUES ('".$row['name']."')");
				  }//////////$yxm = $row['name'];
  }  
/////////////////////////以上循环是指，游戏存在于列表中，就提出名字，没有则添加/////////
?>


<?php //////////////////////广告时间到期，自动删除//////
$iipp = $_SERVER["REMOTE_ADDR"];
$noww = time();

$result = mysql_query("SELECT * FROM webk");
while($row = mysql_fetch_array($result))
  {
$zltime = $row['ks'] + $row['long1'];///、//发布时间加上延续时间
$timec = time(); /////、、、、、、、、、、//算出当前时间
             if ($zltime<$timec)
			 {
			 mysql_query("DELETE FROM webk WHERE id='".$row['id']."'");////删除动作
			 mysql_query("INSERT INTO text (name, time, ip, ing, f) 
			 VALUES ('".$row['bz']."', '".$noww."', '".$iipp."', '到期下架[".$row['name']."]', '0')");
			 }
  }
///////////////////////广告时间到期，自动删除////////  ?>


<?php
////////////////////////////////////////////////////////////////////////
$file = fopen("adm/tm.txt", "r") or exit("Unable to open file!");
while(!feof($file))
  {
$hang = fgets($file);
$res=explode("%%",$hang,20);
  }/////获得表格表头
///////////////////////////////////////////////////////////////////////////
?>


<?PHP
include("han2.php");
////////////////////////显示当前时间的函数
function gtime($tt)
  {
$hour = substr(date("H:i:s",$tt),0,2);
$hour=(int)$hour; 
$dl = array('【通宵推荐】','【通宵推荐】','【通宵推荐】','凌晨3点整','凌晨4点整','早晨5点整','早晨6点整','早晨7点整','上午8点整','上午9点整','上午10点整','中午11点整','中午12点整','下午13点整','下午14点整','下午15点整','下午16点整','晚上17点整','晚上18点整','晚上19点整','晚上20点整','晚上21点整','晚上22点整','【通宵推荐】');
$tt = date("m月d日",$tt).$dl[$hour];
return $tt;
  }
/////////////////////////
?>


<body >
<div id="top">
<?php include("user.php");  ?>
</div>
<?php include("gh.php");  ?>

<div align="center">
<?php include("logo.php");  ?>

<div id="dh" ><?php 
 if(file_exists("dh1.php"))
 {
include("dh1.php"); 
 }
 else
 {
include("action/dh1.php"); 
 }
?></div>

</div>

<div class="clear"></div>




<div align="center" ><div id="nr">




<div class="RoundedCorner">
<b class="rtop"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b class="r4"></b></b>
<?php
include("ad/ad1.txt");
?>
<b class="rbottom"><b class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1"></b></b>
</div>



<div class="clear"></div>



<div class="RoundedCorner">
<b class="rtop"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b class="r4"></b></b>

<div id="dh27">


<div id="dh28">

<div id="dh3">


<?php 
 if(file_exists("topx.php"))
 {
include("topx.php"); 
 }
 else
 {
include("action/topx.php"); 
 }
?>


</div>

<div class="clear"></div>

<?php

$ii=0;

echo "<TABLE class=webtd1 >";

echo "<TR class='webtd1 tabletop' >";
echo "<TD width=118 ><strong>".$res[2]."</strong></td>";
echo "<TD width=168 ><strong>".$res[3]."</strong></td>";
echo "<TD width=88 ><strong>".$res[4]."</strong></td>";
echo "<TD width=88 ><strong>".$res[1]."</strong></td>";
echo "<TD width=98 ><strong>".$res[5]."</strong></td>";
echo "<TD width=88 ><strong>开　始</strong></td>";
echo "<TD width=18 ><strong>-</strong></td>";
echo "</TR>";

///////////////////////////////////////////////////////
include("px.php");////////// 拉取排序方式

$result = mysql_query("SELECT * FROM webk WHERE bz <> 'adm' ".$pxpx );///按发布时间排序

//$result = mysql_query("SELECT * FROM webk WHERE bz = 'adm' order by rand() DESC LIMIT 0,39");

while($row = mysql_fetch_array($result))
  {
$timejia = $timejia + 168;

if($row['ks']-7200 < time())
{
$ii++;
echo "<TR class='webtd1 ";

if($ii%2==0){
echo "taba";
}else{
echo "tabb";
}

echo "'>";

$name = z_f($row['name']);
$ip = z_f($row['ip']);
$time = z_f($row['time']);
$len = z_f($row['len']);
$js = z_f($row['js']);
$kf = z_f($row['kf']);

echo "<TD >";

               	 $result8 = mysql_query("SELECT * FROM webyxlb where name ='".$name."'");
	           	  if (mysql_num_rows($result8) != 0)//检查库里是否有这个用户名
	           	  {/////echo "有了！";
$result7 = mysql_query("SELECT * FROM webyxlb where name = '".$name."' ");
while($row7 = mysql_fetch_array($result7))
{
echo "<a href=webfl-".$row7['id'].".html title=更多[".$row['name']."]  target=_blank  >".$name . "</a>";
}
	           	  }
				  else
				  {
echo "<a href=go.php?id=".$row['id']. " title=".$row['name']."  target=_blank  >".$name . "</a>";
				  }//////////;


echo "</td>";


if ($time=="")
   {
   echo "<TD >".gtime(time()+$timejia). "</td>";
   }
   else
   {
echo "<TD >".gtime($time). "</td>";//////时间经过格式化
   }

echo "<TD  ><a href=go.php?id=".$row['id']. " target=_blank  >".$len . "</a></td>";

echo "<TD >".$ip . "</td>";

echo "<TD ><div id=sfkf >".$kf ."</div></td>";

/////////////////////////////////////////////////////专属礼包/////////
echo "<TD >";
	 $result6 = mysql_query("SELECT * FROM key1 where idid ='".$row['idid']."' and number <> '' LIMIT 0,1");
	 if (mysql_num_rows($result6) != 0)//检查库里是否有这个用户名
	 {
	    while($row6 = mysql_fetch_array($result6))
   	      {
		  $jlid=$row6['id'];
		  }
	 
	 echo "<a href=weblb_".$jlid.".html target=_blank ><img  title=专属礼包 src=img/lb.gif /></a>";
	 }



$zltime = $row['ks'] + $row['long1'];///、//发布时间加上延续时间
$timec = time(); /////、、、、、、、、、、//算出当前时间
$zltime = $zltime - $timec;///////、、、、//相差，算出剩下多少时间！
$zltime = (int)($zltime/3600);

echo "<a href=go.php?id=".$row['id']. "  target=_blank title=".$zltime."小时 >立即开始</a></td>";
///////////////////////////////////////////////////专属礼包///////////
echo "<TD>";
if($row['zt']=="2")
{
echo "<img src=img/top.gif />";
}
elseif($row['zt']=="6")
{
echo "<img src=img/sf.gif />";
}
else
{
echo "<img src=img/im.gif />";
}
echo "</td>";

echo "</TR>";

}

  }
///////////////////////////////////////////////////////
include("adm/zysj.php");

$cjii = $ads - $ii;

//$result = mysql_query("SELECT * FROM webk WHERE bz <> 'adm' order by ".$pxpx );///按发布时间排序
$result = mysql_query("SELECT * FROM webk WHERE bz = 'adm' order by rand() DESC LIMIT 0,".$cjii );

while($row = mysql_fetch_array($result))
  {
$ii++;
$timejia = $timejia + 168;

if($row['ks'] < time())
{

echo "<TR class='webtd1 ";

if($ii%2==0){
echo "taba";
}else{
echo "tabb";
}

echo "'>";

$name = z_f($row['name']);
$ip = z_f($row['ip']);
$time = z_f($row['time']);
$len = z_f($row['len']);
$js = z_f($row['js']);
$kf = z_f($row['kf']);

echo "<TD >";

               	 $result8 = mysql_query("SELECT * FROM webyxlb where name ='".$name."'");
	           	  if (mysql_num_rows($result8) != 0)//检查库里是否有这个用户名
	           	  {/////echo "有了！";
$result7 = mysql_query("SELECT * FROM webyxlb where name = '".$name."' ");
while($row7 = mysql_fetch_array($result7))
{
echo "<a href=webfl-".$row7['id'].".html title=更多[".$row['name']."]  target=_blank  >".$name . "</a>";
}
	           	  }
				  else
				  {
echo "<a href=go.php?id=".$row['id']. " title=".$row['name']."  target=_blank  >".$name . "</a>";
				  }//////////;


echo "</td>";


if ($time=="")
   {
   echo "<TD >".gtime(time()+$timejia). "</td>";
   }
   else
   {
echo "<TD >".gtime($time). "</td>";//////时间经过格式化
   }

echo "<TD  ><a href=go.php?id=".$row['id']. " target=_blank  >".$len . "</a></td>";

echo "<TD >".$ip . "</td>";

echo "<TD ><div id=sfkf >".$kf ."</div></td>";

/////////////////////////////////////////////////////专属礼包/////////
echo "<TD >";

	 $result6 = mysql_query("SELECT * FROM key1 where idid ='".$row['idid']."' and number <> '' LIMIT 0,1");
	 if (mysql_num_rows($result6) != 0)//检查库里是否有这个用户名
	 {
	    while($row6 = mysql_fetch_array($result6))
   	      {
		  $jlid=$row6['id'];
		  }
	 
	 echo "<a href=weblb_".$jlid.".html target=_blank ><img  title=专属礼包 src=img/lb.gif /></a>";
	 }



$zltime = $row['ks'] + $row['long1'];///、//发布时间加上延续时间
$timec = time(); /////、、、、、、、、、、//算出当前时间
$zltime = $zltime - $timec;///////、、、、//相差，算出剩下多少时间！
$zltime = (int)($zltime/3600);

echo "<a href=go.php?id=".$row['id']. "  target=_blank title=".$zltime."小时 >立即开始</a></td>";
///////////////////////////////////////////////////专属礼包///////////

echo "<TD>-</td>";
echo "</TR>";

}

  }
///////////////////////////////////////////////////////



echo "</TABLE >";

?>




</div>







<div id="dh29">


<?php 
 if(file_exists("right.php"))
 {
include("right.php"); 
 }
 else
 {
include("action/right.php"); 
 }
?>



</div>








<b class="rbottom"><b class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1"></b></b>
</div>



<div class="clear"></div>


<div class="RoundedCorner">
<b class="rtop"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b class="r4"></b></b>
<?php
include("ad/ad7.txt");
?>
<b class="rbottom"><b class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1"></b></b>
</div>



<div class="clear"></div>



</div></div>





<div class="clear"></div>


<?php 
 if(file_exists("foot.php"))
 {
include("foot.php"); 
 }
 else
 {
include("action/foot.php"); 
 }
?>

</body>
