<?php include("../sql/conn.php");  ?>


<?php include("../ad/ad4.txt"); ?>

<?php 
//截取中文字符串 
function mysubstr1($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; 
} 
?> 

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



<table>
<form action="so.php" method="post" target="_blank">
<tr>
    <td><?php echo $res[2];?></td>
    <td><select name=name style="width:98px;">
      <option></option>
      <?php
$result = mysql_query("select distinct name from webk");
while($row = mysql_fetch_array($result))
{
echo "<option value=".$row['name'].">".$row['name']."</option>";
}
?>
    </select></td>
    <td rowspan="2"><input s name="submit" type="submit" value="游戏搜索" style="height:38px; width:88px;" /></td>
  </tr>
  <tr>
    <td><?php echo $res[5];?></td>
    <td><select name=kf style="width:98px;">
      <option></option>
      <?php
$result = mysql_query("select distinct kf from webk");
while($row = mysql_fetch_array($result))
{
echo "<option value=".$row['kf'].">".$row['kf']."</option>";
}
?>
    </select></td>
  </tr>
</form>
</table>






<hr />
<div class="dhbt">|||　页游快迅>></div>

<?php
$result1 = mysql_query("SELECT * FROM wz WHERE fl = 'web1' ORDER BY id DESC LIMIT 0,1");
while($row1 = mysql_fetch_array($result1))
{
echo "<div class=xwtop ><strong><p align=center style=margin:0px auto;>";
echo "<a href=wz_". $row1['id']. ".html target=_blank >";

$tm = mysubstr1($row1['tm'],0,28); 

//////////////////循环替换////////////////////
$result8 = mysql_query("SELECT * FROM ck");
while($row8 = mysql_fetch_array($result8))
  {
$tm = str_replace($row8['old'],$row8['new'],$tm);
  }
//////////////////循环替换////////////////////
echo $tm;

echo "</a></p></strong>";
$nr2 = strip_tags($row1['nr']);

$nr2 = str_replace("　","",$nr2);

echo "<textarea class=textarearight >　　".mysubstr1($nr2,0,106)."....</textarea>";
echo "</div>"; 
}
?>
 

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


<?php
$result1 = mysql_query("SELECT * FROM wz WHERE fl = 'web1' ORDER BY id DESC LIMIT 1,12");
while($row1 = mysql_fetch_array($result1))
{
echo "<p>●<a href=wz_". $row1['id']. ".html target=_blank >";

$tm = mysubstr1($row1['tm'],0,34); 

//////////////////循环替换////////////////////
$result8 = mysql_query("SELECT * FROM ck");
while($row8 = mysql_fetch_array($result8))
  {
$tm = str_replace($row8['old'],$row8['new'],$tm);
  }
//////////////////循环替换////////////////////
echo $tm;

echo "</a></p>";
}

?>



<?php
$result = mysql_query("SELECT * FROM top where bz=20 order by rand() DESC LIMIT 0,4");

while($row = mysql_fetch_array($result))
{
echo "<div id=webyxmt >";

echo "<img  width=110 height=80 src=gif/".$row['tt']." alt=".$row['name']."天天PK onerror=\"this.src='webfl/err.jpg'\" ><hr>";
echo "<img title=火  src=img/h.gif />";

echo "<a href=gotop.php?id=".$row['id']. " title=[".$row['name']."]游戏 target=_blank  >".$row['name'];

echo "<br>推荐[".$row['kf']."]</a>";
echo "</div>";
}
?>




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


<hr>

<div class="dhbt">|||　点击排行>></div>

<table class='webtd2'>
<tr bgcolor=#E8F0F8 class='webtd2' >
  <td class='webtd2' width=38>排序</td>
  <td class='webtd2' width=88><?php echo $res[2]; ?></td>
  <td class='webtd2' width=88><?php echo $res[1]; ?></td>
  <td class='webtd2' width=38>开始</td>
</tr>

<?php

$i=1;
$result = mysql_query("SELECT * FROM tongji WHERE name <> '' ORDER BY text DESC LIMIT 0,1");
while($row = mysql_fetch_array($result))
  {
echo "<tr>";
echo "<td align=center ><div style=font-size:18px class=topp>壹</div></td>";
    $result7 = mysql_query("SELECT * FROM webyxlb where name = '".$row['name']."' ");
    while($row7 = mysql_fetch_array($result7))
    {
    echo "<td>";
    echo "<img  width=81 height=60 src=webfl/".$row7['id'].".jpg alt=".$row['name']."天天PK onerror=\"this.src='webfl/err.jpg'\" >";
    echo "</td>";


$result10 = mysql_query("SELECT * FROM webk WHERE name <> '".$row['name']."' LIMIT 0,1");///按发布时间排序
while($row10 = mysql_fetch_array($result10))
{
echo "<td>".$row['name']."<hr>";
echo $row10['ip']."</td>";
}
echo "<td ><a href=webfl-".$row7['id'].".html title=更多[".$row['text']."]  target=_blank  >";
echo "进入</a><td>";
    }
$i++;
echo "</tr>";
  }

/////////////////////////////////////////////////////////////////////////////
$result = mysql_query("SELECT * FROM tongji WHERE name <> '' ORDER BY text DESC LIMIT 1,9");
while($row = mysql_fetch_array($result))
  {
echo "<tr>";
echo "<td align=center > <div class=topp>".$i."</div></td>";
    $result7 = mysql_query("SELECT * FROM webyxlb where name = '".$row['name']."' ");
    while($row7 = mysql_fetch_array($result7))
    {
    echo "</td>";

$result10 = mysql_query("SELECT * FROM webk WHERE name <> '".$row['name']."' LIMIT 0,1");///按发布时间排序
while($row10 = mysql_fetch_array($result10))
{
echo "<td>".$row['name']."</td>";
echo "<td>".$row10['ip']."</td>";
}
echo "<td ><a href=webfl-".$row7['id'].".html title=更多[".$row['text']."]  target=_blank  >";
echo "进入</a><td>";
    }
$i++;
echo "</tr>";
  }


?>
</table> 


<?php include("../ad/ad13.txt"); ?>

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


<?php
$result = mysql_query("SELECT * FROM wz where fl='zs' order by rand() DESC LIMIT 0,4");
while($row = mysql_fetch_array($result))
{
echo "<div id=webyxm3 >";
echo "<a href=wz_". $row['id']. ".html target=_blank title=".$row['tm']." ><img  width=110 height=113 src=".$row['bz']." alt=".$row['tm']."天天PK onerror=\"this.src='webfl/err.jpg'\" ><hr>";
echo mysubstr1($row['tm'],0,16)."</a>";

echo "</div>";
}
?>






<?php include("../sql/close.php"); ?>

