<?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 base where id='$id'";
$result=mysql_query($sql);
if (mysql_affected_rows()>0)
{
@unlink("html/".$_GET[id].".htm");
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.php'</script>";
}
else
{
echo "<script language='javascript'>alert('密码不正确，请重新输入！');location.href='admin.php'</script>";
}
}
mysql_close();
}



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

axing_connect();
$sql="update base set red='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"]=="nored")
{

axing_connect();
$sql="update base set red='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();

}


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

axing_connect();
$sql="update base set bold='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"]=="nobold")
{

axing_connect();
$sql="update base set bold='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();

}



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

axing_connect();
$sql="update base set page='all' 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"]=="page_index")
{

axing_connect();
$sql="update base set page='index' 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"]=="able")
{

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

}


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

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

}



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

axing_connect();
$sql="update base set good='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"]=="nogood")
{

axing_connect();
$sql="update base set good='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=$page_num;
$result=mysql_query("select count(*) from base");
$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 base order by id desc limit $offset,$pagesize";
$result=mysql_query($sql);
while ($myrow=mysql_fetch_assoc($result))
{
?>
<div onMouseOver="this.style.background='#E7F3FA'" onMouseOut="this.style.background='#FFFFFF'" style="border-bottom:dashed 1px #CCCCCC;height:30px;padding:4px;background-color:#FFFFFF">
            <img src="skin/dis/images/50.jpg">
            <?php if ($myrow[type]=="index")
			 {
			 echo "<a style='color:red'>[首页]</a>";
			 }
			 else
			 {
             echo "<a style='color:green'>[内页]</a>";
			 }
           ?>
            <a href="admin_site.php?id=<?echo($myrow[id]);?>" target="_blank">
             <?php if ($myrow[title_url]=="")
			 {
			 echo FSubstr($myrow[url],0,24)."...";
			 }
			 else
			 {
             echo FSubstr($myrow[title_url],0,12);
			 }
            ?>
            (
             <?php if ($myrow[title]=="")
			 {
			 echo FSubstr($myrow[url],0,24)."...";
			 }
			 else
			 {
             echo FSubstr($myrow[title],0,12)."...";
			 }
            ?>) - <?echo($myrow[class_url])?>
            </a>
            <a href='#' onClick="javascript:window.open('admin_update_one.php?id=<?echo($myrow[id])?>','axing','height=200, width=400, top=200, left=300, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no')" style="color:#006600">更新</a>
             <?php if ($myrow[able]=="yes")
			{
		    ?>
             <a href="?action=noable&id=<?echo($myrow[id])?>" style="color:#3399CC">取消审核</a>
            <?php 
			}
			else
			{
			?>
            <a href="?action=able&id=<?echo($myrow[id])?>" style="color:#3399CC">审核</a>
            <?php 
			}
			?>
			<?php if ($myrow[good]=="yes")
			{
		    ?>
             <a href="?action=nogood&id=<?echo($myrow[id])?>" style="color:#993300">取消推荐</a>
            <?php 
			}
			else
			{
			?>
            <a href="?action=good&id=<?echo($myrow[id])?>" style="color:#993300">推荐</a>
            <?php 
			}
			?>
             <!--<?php 
			 if ($myrow[type]=="index")
			 {
			 if ($myrow[page]=="all")
			{
		    ?>
             <a href="?action=page_index&id=<?echo($myrow[id])?>" style="color:#FF6600">禁止收录内页</a>
            <?php 
			}
			else
			{
			?>
            <a href="?action=page_all&id=<?echo($myrow[id])?>" style="color:#FF6600">容许收录内页</a>
            <?php 
			}
			}
			?>-->
            <?php if ($myrow[red]=="yes")
			{
		    ?>
             <a href="?action=nored&id=<?echo($myrow[id])?>" style="color:#FF0000">取消加红</a>
            <?php 
			}
			else
			{
			?>
            <a href="?action=red&id=<?echo($myrow[id])?>" style="color:#FF0000">加红</a>
            <?php 
			}
			?>
             <?php if ($myrow[bold]=="yes")
			{
		    ?>
             <a href="?action=nobold&id=<?echo($myrow[id])?>" style="color:#0000FF">取消加粗</a>
            <?php 
			}
			else
			{
			?>
            <a href="?action=bold&id=<?echo($myrow[id])?>" style="color:#0000FF">加粗</a>
            <?php 
			}
			?>
            <!--<a href='#' onClick="javascript:window.open('admin_html_one.php?id=<?echo($myrow[id])?>','axing','height=200, width=400, top=200, left=300, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no')" style="color:#009900">重新生成静态</a>-->
            [<a href="?action=edit&id=<?echo($myrow[id])?>" style="color:#CC6600">编辑</a>
            <a href="?action=del&id=<?echo($myrow[id])?>" style="color:#CC6600">删除</a>]
  </div>

<?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");?>

