<?php

/*

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

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

' 版本编号: hshxsdj 2.0

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

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

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

' 郑重声明:

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

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

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

*/


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

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

include "../admin_loginstate.php";

include "../admin_version.php";

include "../../include/userset.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=gb2312" />

<title>图片管理</title>

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

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

<style type="text/css">

.imageFriend {

	MARGIN: 5px 0px 0px 2px; WIDTH: 100%; DISPLAY: inline; FLOAT: left

}

.imageFriend UL {

	DISPLAY: inline; FLOAT: left

}

.imageFriend LI {

	PADDING-BOTTOM: 10px; WIDTH: 110px; DISPLAY: inline; FLOAT: left; HEIGHT: 110px

}

.imageFriend LI .pic {

	MARGIN: 0px 10px; WIDTH: 90px; DISPLAY: inline; FLOAT: left; HEIGHT: 90px

}

.imageFriend LI .pic IMG {

	BORDER-BOTTOM: #d5d5d5 4px solid; BORDER-LEFT: #d5d5d5 4px solid; PADDING-BOTTOM: 1px; PADDING-LEFT: 1px; WIDTH: 80px; PADDING-RIGHT: 1px; HEIGHT: 80px; BORDER-TOP: #d5d5d5 4px solid; BORDER-RIGHT: #d5d5d5 4px solid; PADDING-TOP: 1px

}

.imageFriend LI .user {

	LINE-HEIGHT: 22px; BACKGROUND-COLOR: #ecf5f7; MARGIN: 3px 10px; WIDTH: 90px; DISPLAY: inline; WHITE-SPACE: nowrap; FLOAT: left; HEIGHT: 22px; WORD-BREAK: keep-all

}

.imageFriend LI .user A {

	WIDTH: 62px; DISPLAY: inline; FLOAT: left; COLOR: #216187; MARGIN-LEFT: 3px; OVERFLOW: hidden

}

.imageFriend LI .user A:hover {

	TEXT-DECORATION: none

}

.imageFriend LI .user IMG {

	MARGIN-TOP: 3px; WIDTH: 16px; DISPLAY: inline; FLOAT: left; HEIGHT: 16px; MARGIN-LEFT: 3px

}

</style>

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

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

			})							

		}

});





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

	var S_Name=$("#SearchStr").val();

	$("#SearchStr").css("border-color","#666 #ccc #ccc #666");

	if(S_Name==""){

		$("#SearchStr").css("border","1px solid red");

		return false;

		}

	})



})

function turnback(){

	window.history.go(-1);

	};



function delall(){

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

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

		});

};

function isEmail(str){

 res = /^[0-9a-zA-Z_\-\.]+@[0-9a-zA-Z_\-]+(\.[0-9a-zA-Z_\-]+)*$/;

 var re = new RegExp(res);

 return !(str.match(re) == null);

};

function isID(str){

	res = /^(?!_)(?!.*?_$)[a-zA-Z0-9\u4e00-\u9fa5]+$/;

	var re = new RegExp(res);

	return !(str.match(re) == null);

};

function len(s) {

	var l = 0;

	var a = s.split("");

	for (var i=0;i<a.length;i++) {

	if (a[i].charCodeAt(0)<299) {

		l++;

		}

	else{

   l+=2;

		}

	}

	return l;

}

</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_pic Order by S_ID asc";

}

		global $db;

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

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

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

?>

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

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

	<tr><td>

							<div class="imageFriend">

<ul>

<?php

$numdate="a";

if($result){

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

		$numdate="b";

	$sqlu="select s_logo,S_RealName from s_users where S_name='".$row["S_User"]."' order by s_id desc";

	$rsu=$db->query($sqlu);

	$rowu=$db->fetch_array($rsu);

        $S_Logo=$rowu["s_logo"];



?>

	<li>

	<div class="pic"><a href="<?php echo piclinkurl($row["S_ID"],$row["S_User"])?>" target="_blank"><img onerror="pubLibs.imageError(this);"  src="<?php echo $row["S_Url"]?>"/></a></div>

	<div class="user" title="<?php echo $row["s_user"]?>"/><a href="<?php echo userlink("index",$row["S_User"])?>" target="_blank"><?php echo $row["S_User"]?></a><input type="checkbox" value="<?php echo $row["S_ID"]?>" name="S_ID[]" class="checkbox"/></div>

	</li>

<?php

	}

}

if($numdate=="a"){

		

		echo("<div class='nothing'>没有相片。</div>");

}

?>

						</div>

					</div>

    </td>

    </tr>

        <tr>

    <td colspan="6" style="padding-top:5px; padding-bottom:5px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">

        <tr>

          <td class="td_border">

            &nbsp;<input type="checkbox" name="ChkAll" id="ChkAll" ids="S_ID" class="checkbox"/>

    全选&nbsp;&nbsp; <input type="button" value="删除所选图片" class="rb1" onclick="delall()"/></td>

          </tr>

        <tr>

          <td height="40" align="right" >

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

          </tr> 

      </table></td>

    </tr>

    </form>

</table>

<?php

function DelAll(){

	global $db;

	$S_ID=RequestBox("S_ID");

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

$ags=count($S_ID);

$ds=$ags*S_PicPoints;

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

		$sqlc="select S_Url,S_User from s_pic where S_ID=$S_ID[$i] Order by S_ID desc";

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

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

		$db->query($sql);

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

		$db->query($sql1);

                $picurl=explode("upload",$crow['S_Url']);

                $picurl="/upload".$picurl[1];

		$fileurl="../..".$picurl;

		     if(file_exists($fileurl)){

		              unlink($fileurl);

		     }

		}

		$sqlup="update s_users set S_Coin=S_Coin-".$ds." where S_Name='".$crow['S_User']."'";

		$db->query($sqlup);

								//发消息通知

								$s_xid=0;

								$s_nameb="系统消息";

								$s_namea=$crow['S_User'];

								$s_content="很抱歉，您上传的《".$crow['S_Url']."》图片未通过审核，系统自动给您减去了（".S_PicPoints."）点！";

								$s_addtime=date('Y-m-d H:i:s');

								$sql="insert into s_xiaoxi (S_Xid,S_Nameb,S_Namea,S_Content,S_Addtime) values (".$s_xid.",'".$s_nameb."','".$s_namea."','".$s_content."','".$s_addtime."')";

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

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

}

?>

<div class="bottom">

<?php



include "../admin_bottom.php";

?>

 

</div>

</body>

</html>



