<?php
require_once("../global/checkuser2.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>博客</title>
<link rel="stylesheet" href="index.css" />
<script>
function initselect2(){
var vee = document.getElementById("userr").value;
var ste = document.getElementById("user");
for(var i=0;i<ste.options.length;i++){
  if(vee==ste.options[i].value){
       ste.selectedIndex = i;
       break;
  }
}
}
function sformsbmit(){
document.getElementById("sform").submit();
}
</script>
</head>

<body>
<div class="bigdiv">
<?php
if(isset($_GET["user"])){?>
<input type="hidden" id="userr" name="userr" value="<?=$_GET['user']?>"/>
<?php } 
?>
<table cellspacing="0" cellpadding="0" style="font-size:14px;"><tr><td style="text-align:left;border-left:none;">您的位置：<a href="index.php">外部账号管理</a></td><td style="text-align:right;border-left:none;"><a href="add.php">添加博客帐号</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr></table>
<div style="float:left;width:100%;border-bottom:2px solid #337abb;height:25px;font-size:14px;line-height:25px;"><ul>
<li style="float:left;width:100px;text-align:center;border:2px solid #337abb;border-top:1px solid #337abb;border-bottom:none;background:#337abb;margin-left:20px;display:inline;"><a href="index.php" style="color:#FFF;">外部账号管理</a></li>
</ul></div>
<div class="list">
<table cellspacing="0" cellpadding="0">
<tr style="background:#d3edf9;"><td style="width:13%;border-left:none;">博客名称</td><td style="width:26%;">博客地址</td>
<form action="" method="get" id="sform">
<td style="width:9%">
<select id="user" name="user" onchange="sformsbmit()">
<option value="">发布人</option>
<?php        require_once("../global/connect.php");
			  $rs=mysql_query("select * from user");
			   if($rs){
			   while($row=mysql_fetch_array($rs)){?>
			   <option value="<?=$row['name']?>"><?=$row['name']?></option>
			 <?php }}?>
</select></td></form>
<td style="width:9%;">创建时间</td><td style="width:12%;">帐号</td><td style="width:12%;">密码</td><td style="width:7%;">文章数</td>
<td class="g">操作</td></tr></table>
<script>initselect2();</script>
<table cellspacing="0" cellpadding="0">
<?php
ob_start();
require_once("../global/page.class.php");
$where="";
$user="";
if(isset($_GET["user"])){
$user=$_GET["user"];
if($_GET["user"]!=""){
$where="where user='$_GET[user]'";
}
}
$pageSize=15;
$total=mysql_num_rows(mysql_query("SELECT * FROM blog $where")); 
//echo "SELECT * FROM blog $where";
pageft($total,$pageSize,1,1,1,9,20,0);
$sql="SELECT * FROM  blog $where order by id DESC limit $firstcount,$pageSize";
$sql=mysql_query($sql);
ob_end_clean();
if($sql){
while($row=mysql_fetch_array($sql)){
echo "<tr><td style=\"width:13%;border-left:none;text-align:left;\">&nbsp;<a href=\"$row[url]\" target=\"_black\">".$row["name"]."</a></td><td style=\"width:26%;text-align:left;\">&nbsp;".$row["url"]."</td><td style=\"width:9%;\">".$row["user"]."</td><td style=\"width:9%;\">".$row["adddate"]."</td><td style=\"width:12%;color:green;\">".$row["username"]."</td><td style=\"width:12%;color:green;\">".$row["password"]."</td><td style=\"width:7%;\">";
$rurl=str_replace("http://","",$row["url"]);
$rurl=str_replace("www.","",$rurl);
$sqls=mysql_query("select * from weblink where url like '%$rurl%'");
if($sqls)
echo mysql_num_rows($sqls);
else
echo 0;
echo "</td><td class='g'><a href=\"function.php?mod=delete&id=$row[id]\">[删除]</a><a href=\"modify.php?id=$row[id]\">[修改]</a></td></tr>";
}
}else
echo "<tr><td style='text-align:center;color:red;'>没有符合该条件的记录!</td></tr>";
ob_end_flush();
?>
</table>
<div>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $pagenav;?></div>
<div style="width:100%;height:10px;"></div>
<div style="width:98%;margin:auto;overfollow:hidden;border:2px solid #ccc;line-height:25px;font-size:14px;">
&nbsp;&nbsp;&nbsp;&nbsp;功能使用帮助说明：<br />
&nbsp;&nbsp;1、此功能用于记录外部博客的登录帐号与密码，并统计在该博客上发布的文章数。<br />
&nbsp;&nbsp;2、可通过选择发布人对记录进行筛选。
</div>
</div>
</div>
</body>
</html>
