<?php include("dh.php"); 
include("../sql/conn.php");
include("yz.php"); 
$llym = $_SERVER["HTTP_REFERER"];

///$mulu=dirname(__FILE__);
///$mulu = str_replace("adm","gif",$mulu);
$mulu = '../gif/';
?>


<?php
if ($_GET['id']=="rename")
{
$oldname = $_POST['oldname']; 
echo $oldname;
echo "<br>"; 
$newname = $mulu."/".$_POST['newname']; 
echo $newname;
rename($oldname,$newname) ;
?>
<script language="javascript">setTimeout(function (){location.href='<?php echo $llym; ?>';},2);</script>
<?
}
?>

<?php
if ($_GET['id']=="del")
{
$oldname = $_POST['oldname']; 
unlink($oldname);
?>
<script language="javascript">setTimeout(function (){location.href='<?php echo $llym; ?>';},2);</script>
<?
}
?>


<?php
if ($_GET['tj']=="tj")
{
mysql_query("INSERT INTO top (tt, nameid, name, url, kf, bz) 
VALUES ('".$_POST['tt']."', '".$_POST['nameid']."', '".$_POST['name']."', '".$_POST['url']."', '".$_POST['kf']."', '".$_POST['yx']."')");
mysql_query("INSERT INTO text (name, time, ip, ing, f, bz) 
VALUES ('".$_SESSION['name']."', '".$noww."', '".$iipp."', 'TOP增加".$_GET['id']."', '0', '')");
?>
<script language="javascript">setTimeout(function (){location.href='<?php echo $llym; ?>';},2);</script>
<?
}
?>

<?php
if ($_GET['xg']=="xg")
{
mysql_query("UPDATE top SET tt = '".$_POST['tt']."' WHERE id='".$_GET['id']."'");
mysql_query("UPDATE top SET name = '".$_POST['name']."' WHERE id='".$_GET['id']."'");
mysql_query("UPDATE top SET bz = '".$_POST['bz']."' WHERE id='".$_GET['id']."'");
mysql_query("UPDATE top SET nameid = '".$_POST['nameid']."' WHERE id='".$_GET['id']."'");
mysql_query("UPDATE top SET kf = '".$_POST['kf']."' WHERE id='".$_GET['id']."'");
mysql_query("UPDATE top SET url = '".$_POST['url']."' WHERE id='".$_GET['id']."'");

mysql_query("INSERT INTO text (name, time, ip, ing, f, bz) 
VALUES ('".$_SESSION['name']."', '".$noww."', '".$iipp."', 'TOP修改".$_GET['id']."', '0', '')");
?>
<script language="javascript">setTimeout(function (){location.href='<?php echo $llym; ?>';},2);</script>
<?
}
?>


<?php
if ($_GET['s']=="ok")
{
mysql_query("DELETE FROM top WHERE id='".$_GET['id']."'");
mysql_query("INSERT INTO text (name, time, ip, ing, f, bz) 
VALUES ('".$_SESSION['name']."', '".$noww."', '".$iipp."', 'TOP删除".$_GET['id']."', '0', '')");
?>
<script language="javascript">setTimeout(function (){location.href='<?php echo $llym; ?>';},2);</script>
<?
}
?>


<table >
  <tr>
<td>

<table >
<tr><td>NO.</td><td>图片</td><td>游戏</td><td>搜</td><td>位置</td><td>排行</td>
<td>平台</td><td>地址</td><td>删</td><td>审</td><td>修改</td></tr>
<?php
$i=1;



$result = mysql_query("SELECT * FROM top where bz = 30");
while($row = mysql_fetch_array($result))
{
echo "<form action=?xg=xg&id=".$row['id']." method=post><tr><td>".$i."</td>";
echo "<td><textarea cols=8 rows=1 name=tt>".$row['tt']."</textarea></td>";
echo "<td><textarea cols=6 rows=1 name=name>".$row['name']."</textarea></td>"; 

echo "<td>[<a href=http://image.baidu.com/i?tn=baiduimage&ct=201326592&lm=-1&cl=2&nc=1&word=".$row['name']."&ie=utf-8#lm=6&z=0 target=_blank>图</a>]</td>";
echo "<td><select name=bz><option value=".$row['bz'].">";
if($row['bz']=="30")
{
echo "上边八图";
}
elseif($row['bz']=="20")
{
echo "右侧四图";
}
else
{
echo "暂时无用";
}
echo "</option>";
echo "<option value=10>暂时无用</option><option value=20>右侧四图</option><option value=30>上边八图</option></select></td>";
echo "<td><textarea cols=3 rows=1 name=nameid>".$row['nameid']."</textarea></td>";
echo "<td><textarea cols=8 rows=1 name=kf>".$row['kf']."</textarea></td>";
echo "<td><textarea cols=8 rows=1 name=url>".$row['url']."</textarea></td>";
  echo "<td><a ";
    ?>onClick="return confirm('删除要小心！？')"<?php
  echo " href=?id=".$row['id']."&s=ok >删</a></td>";
echo "<TD ><a href=".$row['url'] . " target=_blank>审</a></td>";
echo "<td><input type=submit value=修改 /></td></tr></form>";
$i++;
}
echo "<tr><td colspan=10>^^^以上为上边八图的广告^^^</td></tr>";

$result = mysql_query("SELECT * FROM top where bz = 20 ");
while($row = mysql_fetch_array($result))
{
echo "<form action=?xg=xg&id=".$row['id']." method=post><tr><td>".$i."</td>";
echo "<td><textarea cols=8 rows=1 name=tt>".$row['tt']."</textarea></td>";
echo "<td><textarea cols=6 rows=1 name=name>".$row['name']."</textarea></td>"; 

echo "<td>[<a href=http://image.baidu.com/i?tn=baiduimage&ct=201326592&lm=-1&cl=2&nc=1&word=".$row['name']."&ie=utf-8#lm=6&z=0 target=_blank>图</a>]</td>";
echo "<td><select name=bz><option value=".$row['bz'].">";
if($row['bz']=="30")
{
echo "上边八图";
}
elseif($row['bz']=="20")
{
echo "右侧四图";
}
else
{
echo "暂时无用";
}
echo "</option>";
echo "<option value=10>暂时无用</option><option value=20>右侧四图</option><option value=30>上边八图</option></select></td>";
echo "<td><textarea cols=3 rows=1 name=nameid>".$row['nameid']."</textarea></td>";
echo "<td><textarea cols=8 rows=1 name=kf>".$row['kf']."</textarea></td>";
echo "<td><textarea cols=8 rows=1 name=url>".$row['url']."</textarea></td>";
  echo "<td><a ";
    ?>onClick="return confirm('删除要小心！？')"<?php
  echo " href=?id=".$row['id']."&s=ok >删</a></td>";
echo "<TD ><a href=".$row['url'] . " target=_blank>审</a></td>";
echo "<td><input type=submit value=修改 /></td></tr></form>";
$i++;
}
echo "<tr><td colspan=10>^^^以上为右边四图的广告^^^</td></tr>";

$result = mysql_query("SELECT * FROM top where bz<>30 and bz<>20");
while($row = mysql_fetch_array($result))
{
echo "<form action=?xg=xg&id=".$row['id']." method=post><tr><td>".$i."</td>";
echo "<td><textarea cols=8 rows=1 name=tt>".$row['tt']."</textarea></td>";
echo "<td><textarea cols=6 rows=1 name=name>".$row['name']."</textarea></td>"; 

echo "<td>[<a href=http://image.baidu.com/i?tn=baiduimage&ct=201326592&lm=-1&cl=2&nc=1&word=".$row['name']."&ie=utf-8#lm=6&z=0 target=_blank>图</a>]</td>";
echo "<td><select name=bz><option value=".$row['bz'].">";
if($row['bz']=="30")
{
echo "上边八图";
}
elseif($row['bz']=="20")
{
echo "右侧四图";
}
else
{
echo "暂时无用";
}
echo "</option>";
echo "<option value=10>暂时无用</option><option value=20>右侧四图</option><option value=30>上边八图</option></select></td>";
echo "<td><textarea cols=3 rows=1 name=nameid>".$row['nameid']."</textarea></td>";
echo "<td><textarea cols=8 rows=1 name=kf>".$row['kf']."</textarea></td>";
echo "<td><textarea cols=8 rows=1 name=url>".$row['url']."</textarea></td>";
  echo "<td><a ";
    ?>onClick="return confirm('删除要小心！？')"<?php
  echo " href=?id=".$row['id']."&s=ok >删</a></td>";
echo "<TD ><a href=".$row['url'] . " target=_blank>审</a></td>";
echo "<td><input type=submit value=修改 /></td></tr></form>";
$i++;
}
echo "<tr><td colspan=10>^^^以上为暂时无用的广告^^^</td></tr>";

?> 
</table>

</td>

<td>
|<br />|<br />|<br />|<br />
|<br />|<br />|<br />|<br />
|<br />|<br />|<br />|<br />
</td>


<td valign="top">

<form action="uploadgif.php" enctype="multipart/form-data" method="post" name="up">
上传文件：
<input name="upfile" type="file"/>
<input type="submit" value="上传"/><br/>
</form>




<?php
////数据备份重命名
$sz = ListFiles($mulu);
///$sz = glob($mulu.'\*.*'); // 文件种类 

echo "<br><form action=?id=rename method=post>选择<strong>更名</strong>文件<SELECT  name=oldname ><OPTION></OPTION>";
foreach($sz as $v)
{
echo "  <OPTION  value=".$v." >";
echo str_replace($mulu."/","",$v);
echo "</OPTION>";
}
echo "</SELECT>";
echo "<br>新　名　字: <input type=text name=newname />";
echo "<input type=submit value=重命名  /></form>";
////数据备份重命名
?>


<?php

echo "<br><form action=?id=del method=post>选择<strong>删除</strong>文件<SELECT  name=oldname ><OPTION></OPTION>";
foreach($sz as $v)
{
echo "  <OPTION  value=".$v." >";
echo str_replace($mulu."/","",$v);
echo "</OPTION>";
}
echo "</SELECT>";

echo "<input type=submit value=删除文件 /></form>";

////echo $mulu;
?>


<p>文件名列表</p>

<textarea cols="33" rows="8">
<?php
foreach($sz as $v)
{
$wjm = str_replace($mulu."/","",$v);
$wjm = str_replace("\\","",$wjm);
echo $wjm;
echo "\n";
}
?>
</textarea>

</td>
  </tr>
</table>







<hr> 
 
<?php
     $result = mysql_query("SELECT * FROM webk WHERE bz <> 'adm' order by rand() limit 0,2");
     while($row = mysql_fetch_array($result))
     {
             $result3 = mysql_query("SELECT * FROM webyxlb where name = '".$row['name']."' ");
			 while($row3 = mysql_fetch_array($result3))
            {
			$flid = $row3['id'];
echo "<form action=?tj=tj method=post style='clear:both;height: 1px;'>";
echo "图片：<textarea name=tt cols=8 rows=1 >".$row3['id'].".jpg</textarea>";
echo "游戏：<textarea name=name cols=8 rows=1 >".$row['name']."</textarea>"; 
echo "优先：<textarea name=yx cols=8 rows=1 >".$row3['yx']."</textarea>";
            }
echo "排行<textarea name=nameid cols=8 rows=1 >".$flid."</textarea>";
echo "平台：<textarea name=kf cols=8 rows=1 >".$row['kf']."</textarea>";
echo "地址：<textarea name=url cols=8 rows=1 >".$row['url']."</textarea>";
echo "　　<input type=submit value=新增加 /></form><br>";
     }
?>

<hr>





<textarea cols="88" rows="3">此处为,上边的八张图片广告200*60,和右边的四张图片广告110*80的链接修改处,此处不是直链,
还不支持FLASH,下个版本再出吧
图片可以上传,右边改名,定下来之事,左边录入.
</textarea>


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