<?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 base where url='$admin' order by id desc";
$result=mysql_query($sql);
if (mysql_num_rows($result)>0)
{
$myrow=mysql_fetch_assoc($result);
if ($passwords==$myrow["pw"])
{
//程序开发，Axingweb | 阿星 www.axingweb.cn
$_SESSION['user']=$admin; 
echo "<script language='javascript'>alert('登录成功！');location.href='user.php'</script>";
}
else
{
echo "<script language='javascript'>alert('密码不正确，请重新输入！');location.href='user.php'</script>";
}
}
mysql_close();
}
?>
<DIV id="no_index_container">
<DIV id="no_index_content">
<div id="no_index_content_top">
管理中心
</div>
<?php
include ("add_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['user'])
{
?>
<?php
axing_connect();

//分页代码
$pagesize=$page_num;
$result=mysql_query("select count(*) from base where who='$_SESSION[user]'");
$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 where who='$_SESSION[user]' 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="user_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)."...";
			 }
            ?>)
            </a>
            <a href='#' onClick="javascript:window.open('user_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 style="color:#3399CC"><互链正常></a>
            <?php 
			}
			else
			{
			?>
            <a style="color:#000000"><！未链接，请放置代码后点击更新></a>
            <?php 
			}
			?>
           <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");?>

