<?php

include "../../include/conn.php";

include "../../include/function.php";

include "../admin_loginstate.php";

include "../admin_version.php";

/*

'**************************************************************************************************

' 软件名称: 黑色幻想舞曲管理系统CMS2.0

' 版本编号: hshxsdj 2.0

' 官方网站: http://www.hshxs.com

' 官方论坛：http://bbs.hshxs.com

' 版权所有: 黑色幻想开发团队    噬己翼(QQ:532917920)

' 郑重声明:

'    1、任何个人或组织不得在未经授权的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息；

'    2、黑色幻想网络事业部保留此软件的法律追究权利

'**************************************************************************************************

*/


?>

<!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=gb2312" />

<title>微薄管理</title>

<script type="text/javascript" language="javascript">var tentpath='<?php echo S_SitePath;?>';</script>

<link href="../images/alerts.css" rel="stylesheet" type="text/css" media="screen" />

<link  href="../images/style.css" rel="stylesheet" type="text/css" />

<script src="../js/jquery.js"></script>

<script src="../js/alerts.js"></script>

<script language="javascript">

	$(document).ready(function(){

                $("#ChkAll").click(function(){

		if($(this).attr("checked")==true){

			$("input[name='S_ID[]']").each(function(){

				$(this).attr("checked",true);									 

			})							

		}else{

			$("input[name='S_ID[]']").each(function(){

				$(this).attr("checked",false);									 

			})							

		}

                });

	});

function del(id){

	jConfirm('您确定要删除该微薄吗?', '操作提示', function(r) {

		if(r==true){

			window.location='?action=del&S_ID='+id;

			}

				});

	};

function delall(){

	jConfirm('您确定要执行操作吗?', '操作提示', function(r) {

		if(r==true){form2.submit();}

		});

};

function backpage(){

	window.history.go(-1);

	};

</script>

</head>

<body>

<?php

SystemPer(9);

$ac=SafeRequest("action","get");

if($ac=="del"){return Del();}

if($ac=="delall"){ return DelAll();}

if($ac==""){

               $sql="select * from s_blog Order by S_ID asc";

}

		global $db;

		$Arr=getpagerow($sql,30);//sql,每页显示条数

		$result=$db->query($Arr[2]);

		$action=SafeRequest("action","get");

?>

<form id="form2" action="?action=delall" method="post" name="form2">

    <table  width="100%" border="0" cellpadding="0" cellspacing="0" class="tb_style">

    	<tr>

            <td  height="30" colspan="5" class="td_title">&nbsp;微薄列表</td>

        </tr>

        <tr>

            <td width="10%" height="30" bgcolor="#FFFFFF" class="td_btop3">&nbsp;编号</td>

            <td width="38%" height="30" bgcolor="#FFFFFF" class="td_btop3">&nbsp;微薄内容</td>

            <td width="23%" height="30" bgcolor="#FFFFFF" class="td_btop3">&nbsp;发送者</td>

            <td width="18%" height="30" align="center" bgcolor="#FFFFFF" class="td_btop3">发送时间</td>

            <td width="11%" height="30" align="center" bgcolor="#FFFFFF" class="td_btop3">操作</td>

        </tr>

<?php

$numdate="a";

if($result){

	while ($row = $db ->fetch_array($result)){

		$numdate="b";

?>

    <tr>

        <td height="30" class="td_border"><input type="checkbox" value="<?php echo $row["S_ID"]?>" name="S_ID[]" class="checkbox"/><?php echo $row["S_ID"]?>.</td>

        <td height="30" class="td_border">&nbsp;<?php echo facehtml($row["S_Content"])?></td>

        <td height="30" class="td_border">&nbsp;<a href="<?php echo linkweburl(1,$row["S_User"])?>" target="_blank"><?php echo $row["S_User"]?></a></td>

        <td height="30" class="td_border" align="center"><?php echo $row["S_Addtime"]?></td>

        <td height="30" class="td_border" align="center">

        <a style="cursor:pointer;" onclick="del(<?php echo $row["S_ID"]?>)">删除</a></td>

    </tr>

    <?php

	}

}

if($numdate=="a"){

	echo("<tr><td height='30' align='center' class='td_border' colspan='5'><b>暂无微薄！</b></td></tr>");

}

	?>

    <tr>

        <td height="30" bgcolor="#FFFFFF"  colspan="10"><input type="checkbox" name="ChkAll" id="ChkAll" ids="S_ID" class="checkbox"/>

          全选 &nbsp;

        <input type="button" value="删除所选" class="rb1" onclick="delall()"/>        </td>

      </tr>

    <tr>

          <td height="40" colspan="10" align="right" valign="bottom" bgcolor="#FFFFFF" class="td_btop3">

          <?php echo $Arr[0];?>

          </td>

      </tr>

    </table>	

</form>

<?php

function Del(){

	global $db;

	$S_ID = SafeRequest("S_ID","get");

		$sqlc="select S_Content from s_blog where S_ID=$S_ID Order by S_ID desc";

		$crow=$db->getrow($sqlc);

		$sql1="delete from s_dt where S_Name='".$crow['S_Content']."'";

		$db->query($sql1);

	$sql="delete from s_blog where S_ID=".$S_ID;

	if($db->query($sql)){

		die("<script>window.location='admin_blog.php'</script>");

		}

	else{

		die("<script>jAlert('删除失败!','操作提示',function(R){history.back();})</script>");

		}

}



function DelAll(){

	global $db;

	$S_ID=RequestBox("S_ID");

	$S_ID=explode(",",$S_ID);

	for($i=0;$i<count($S_ID);$i++){

		$sqlc="select S_Content from s_blog where S_ID=".$S_ID[$i]." Order by S_ID desc";

		$crow=$db->getrow($sqlc);

		$sql1="delete from s_dt where S_Name='".$crow['S_Content']."'";

		$db->query($sql1);

		$sql="delete from s_blog where S_ID=".$S_ID[$i];

		$db->query($sql);

		}

	die("<script>window.location='admin_blog.php'</script>");

}

?>

<div class="bottom">

<?php



include "../admin_bottom.php";

?>

 

</div>

</body>

</html>