<?php
require ("inc/function.php");
require("lib_splitword_full.php");
$this_title="关键字管理";
include ("top.php");
?>
<?php
if ($_GET["action"]=="del")
{
$id=$_GET["id"];
axing_connect();
$sql="delete from tag where id='$id'";
$result=mysql_query($sql);
if (mysql_affected_rows()>0)
{
echo "<script language='javascript'>alert('删除成功');history.go(-1)</script>";
mysql_close();
}
}

if ($_GET["action"]=="out")
{
//程序开发，Axingweb | 阿星 www.axingweb.cn
session_destroy();
echo "<script language='javascript'>alert('成功退出登录！');history.go(-1)</script>";
}
if ($_GET["action"]=="login")
{
$admin=$_POST["admin"];
$passwords=$_POST["passwords"];
axing_connect();
$sql="select * from admin where admin='$admin'";
$result=mysql_query($sql);
if (mysql_num_rows($result)>0)
{
$myrow=mysql_fetch_assoc($result);
if ($passwords==$myrow["passwords"])
{
//程序开发，Axingweb | 阿星 www.axingweb.cn
$_SESSION['admin']=$admin; 
echo "<script language='javascript'>alert('登录成功！');location.href='admin_tag.php'</script>";
}
else
{
echo "<script language='javascript'>alert('密码不正确，请重新输入！');location.href='admin_tag.php'</script>";
}
}
mysql_close();
}



if ($_GET["action"]=="able")
{

axing_connect();
$sql="update tag set able='yes' where id='$_GET[id]'";
$result=mysql_query($sql);
if (mysql_affected_rows()>0)
{
echo "<script language='javascript'>alert('审核成功！');history.go(-1)</script>";
}
mysql_close();

}


if ($_GET["action"]=="noable")
{

axing_connect();
$sql="update tag set able='no' where id='$_GET[id]'";
$result=mysql_query($sql);
if (mysql_affected_rows()>0)
{
echo "<script language='javascript'>alert('取消审核成功！');history.go(-1)</script>";
}
mysql_close();

}


?>
<DIV id="no_index_container">
<DIV id="no_index_content">
<div id="no_index_content_top">
管理中心
</div>
<?php
include ("admin_box.php");
?>
</DIV>
<DIV id="no_index_content">
<div class="left_top" id="no_index_content_z_s_l_t"></div>
<div class="right_top" id="no_index_content_z_s_r_t"></div>
<div id="no_index_content_top">标签管理</div>
<div id="no_index_content_content">
<?php
//程序开发，Axingweb | 阿星 www.axingweb.cn
if ($_SESSION['admin'])
{
?>
<?php
axing_connect();

//分页代码
$pagesize=70;
$result=mysql_query("select count(*) from tag");
$myrow = mysql_fetch_array($result);
$numrows=$myrow[0];
$pages=intval($numrows/$pagesize);

if ($numrows%$pagesize)
{
$pages++;
}
if (isset($_GET['page']))
{
$page=intval($_GET['page']);
}
else{
$page=1;
}
$offset=$pagesize*($page - 1);
//分页代码

$sql="select * from tag order by id desc limit $offset,$pagesize ";
$result=mysql_query($sql);
while ($myrow=mysql_fetch_assoc($result))
{
?>
<span style="border-bottom:dashed 1px #CCCCCC; width:190px">
            <img src="skin/dis/images/50.jpg">
            &nbsp;&nbsp; <a href="<?echo($myrow[url]);?>" target="_blank"><?echo($myrow[tag]);?></a>&nbsp;
            
            
             <?php if ($myrow[able]=="yes")
			{
		    ?>
             <a href="?action=noable&id=<?echo($myrow[id])?>" style="color:#009900">取消审核</a>
            <?php 
			}
			else
			{
			?>
            <a href="?action=able&id=<?echo($myrow[id])?>" style="color:#FF0000">审核</a>
            <?php 
			}
			?>
            
            
            &nbsp;<a href="?action=del&id=<?echo($myrow[id])?>" style="color:#CC6600">删除</a>
  </span>
<?PHP
}

//分页代码
$first=1;
$prev=$page-1;
$next=$page+1;
$last=$pages;
echo "<div align='left' style='padding:5px'>共有".$pages."页(".$page."/".$pages.")";
if ($page > 1)
{
echo " <a href='?page=".$first."'>首页</a> ";
echo " <a href='?page=".$prev."'>上一页</a> ";
}

if ($page < $pages)
{
echo " <a href='?page=".$next."'>下一页</a> "; 
echo " <a href='?page=".$last."'>尾页</a> ";
echo "</div>";
}
//分页代码

mysql_free_result($result);
mysql_close();
?>
<?php
}
else
{
echo("请先登录！");
}
?>

  </div>
  </DIV>
  </div>
<?php include ("bottom.php");?>

