www.gusucode.com > 仿51.com的php源码 1.1 > Image/ImageList.php

    <?php
include("../User/CheckLogined.php");
include("../include/dbclass.php");
require_once "../include/page.php";
$dbc=new DbConn();
$group=$_GET["group"];
$page=(int)$_GET["page"];
$deferentparameter="&group=".$group;
$maxline = 9;
$uid=$_COOKIE["uid"];
if ($_GET["act"]=="mdyPhoto")
{
$id=$_POST["photo_id"];
$title=$_POST["photo_title"];
$memo=$_POST["photo_memo"];
$group=$_POST["group"];
$sql="update image set image_Title='$title',Memo='$memo' where id='$id' and User_Account='$uid'";
$dbc->Execute($sql);
echo "<script>alert('修改成功!');location.href='ImageList.php?group=$group';</script>";
}

if($_GET["act"]=="photoSort")
{
$id=$_GET["id"];
$swap=$_GET["swap"];
$group=$_GET["group"];
$refer=$_GET["refer"];
$sql="update image set MyOrder=MyOrder+'$swap' where id='$id' and User_Account='$uid' ";
$dbc->Execute($sql);
header("Location:ImageList.php$refer");
}
if($_GET["act"]=="movePhoto")
{
$id=$_POST["photo_id"];
$group_list=$_POST["group_list"];
$sql="update image set Image_Group='$group_list' where id='$id' and User_Account='$uid'";
$dbc->Execute($sql);
echo "<script>alert('图片移动成功!');location.href='ImageList.php?group=$group_list';</script>";
}

if ($_GET["act"]=="delPhoto")
{
$id=$_GET["photo_id"];
$refer=$_GET["refer"];
$sql="select Image_Big_Url,Image_Sma_Url from image where User_Account='$uid' and  id='$id'";
$rs=$dbc->getRs($sql);
if ($rs==null)
{
echo "<script>alert('找不到');history.back();</script>";
exit();
}
else
{
//删除小图
if(file_exists("../User/".$rs["Image_Sma_Url"]))
{
unlink("../User/".$rs["Image_Sma_Url"]);
}
if(file_exists("../User/".$rs["Image_Big_Url"]))
{
unlink("../User/".$rs["Image_Big_Url"]);
}
//删除评论
$sqldelcom="delete from ImageComment where ImageComment_UserName='$uid' and ImageComment_CommentObjId='$id'";
$dbc->Execute($sqldelcom);
$sqldel="delete from image  where User_Account='$uid' and  id='$id' ";
$dbc->Execute($sqldel);
}
header("Location:ImageList.php$refer");
}

?>
<?php if($group==null){
$sqlf="select GroupName from ImageGroup where User_Account='$uid'  order by GroupOrder desc limit 0,1";
$rs=$dbc->getRs($sqlf);
if($rs!=null)
{
$g=$rs["GroupName"];
header("Location:ImageList.php?group=$g");
}
}?>

<!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/User_Main.css" rel="stylesheet" type="text/css" />
<link href="../images/photo.css" rel="stylesheet" type="text/css" />
<script src="../js/global.js" language="javascript"></script>
<div id="face" style="display:none; position:absolute; width:260px; height:276px;"></div>
<script>
try{
	if(top!=window){
		document.domain	="www.wu-liao.com";		
	}else{
		top.location.href="/webin.php?refer=%2FImage%2FImageList.php";
	}
}catch(e){}
function showNewMessage(user){
	top.showNewMessage(user);
}

</script>
<script>
/*********Js Function Begin*********/
function AppJsMdyPhoto(photo_id, title, content)
{
	document.form2.photo_id.value = photo_id;
	document.form2.photo_title.value = title;
	document.form2.photo_memo.value = content;
	AppOpenPOP('修改', 'mdy_div', 400, 200);
}
function AppOpenPOP(title, obj_name, w, h)
{
	var elm_popBackground = document.getElementById("popBackgroundLayer");
	var elm_popFrameWork = document.getElementById("popFrameWorkLayer");
	elm_popBackground.style.height = document.body.scrollHeight;
	elm_popBackground.style.width = document.body.scrollWidth;
	elm_popFrameWork.style.width = w;
	elm_popFrameWork.style.height = h;
	srcContentObject = document.getElementById(obj_name);
	if(srcContentObject)
	{
		popContentObject2.innerHTML = srcContentObject.innerHTML;
	}else{
		alert(obj_name + '未找到');
	}
	elm_popBackground.style.display = "block";
	elm_popFrameWork.style.display = "block";
	AppMoveLayer("popFrameWorkLayer");
}
function AppMoveLayer(layerId) {
	var layer = document.getElementById(layerId);
	if (layer) {
		layer.style.position = "absolute";
		var menu = document.getElementById("menu");
		var topPos = 0;
		if (window.screenTop >= 0) {
			topPos = -Math.abs(window.screenTop) + (window.screen.height - layer.offsetHeight) / 2;
		} else {
			topPos = Math.abs(window.screenTop) + (window.screen.height - layer.offsetHeight) / 2;
		}
		if (menu && ((topPos + layer.offsetHeight / 2) < menu.offsetTop)) {
			topPos = menu.offsetTop - layer.offsetHeight / 2 + 20;
		}
		layer.style.top = topPos + "px";
		layer.style.left = (document.documentElement.scrollLeft + (document.documentElement.clientWidth - document.getElementById(layerId).offsetWidth) / 2) + "px";
	}
}
function AppJsDelPhoto(photo_id)
{
	if(haveSecondPassword)
	{
		document.getElementById("second_photo_id").value = photo_id;
		AppOpenPOP('二级密码输入框', 'del_div', 250, 160);
	}
	else
	{
		if(confirm("确定删除这张吗?"))
		{
			window.location.href = "?act=delPhoto&photo_id=" + photo_id + "&refer=%3Fgroup%3D<?php echo $group; ?>%26page%3D<?php echo $page; ?>";
		}
	}
}
function AppJsMovePhoto(photo_id)
{
	if (photo_class.length == 0){
		alert('无法移动到其他分类中,因为您的相册图库中只有一个分类!');
		return ;
	}
	document.form1.photo_id.value = photo_id;
	AppOpenPOP('移动', 'move_div', 400, 200);
}
function AppJsPhotoSort(photo_id, swap)
{
	if(swap>0) {
		var num = window.prompt("向前跳几位", 1);
	}
	else var num = window.prompt("向后跳几位", 1);
		if (num != null){
			if (parseInt(num) == num)
			{
				window.location.href = "?act=photoSort&id=" + photo_id + "&swap=" + (swap * num) + "&group=<?php echo $group; ?>&refer=%3Fgroup%3D<?php echo $group; ?>%26page%3D<?php echo $page; ?>";
			}else{
				alert('请输入数字');
				return;
			}
		}
}
function AppJsSetGoodPhoto(photo_id)
{
	if(confirm("提示:必须是您本人的照片才能设为形象照,其它图片请不要设为形象照。\r\n此操作将替换您以前设置过的形象照!确定执行吗?"))
	{
		window.location.href = "?act=setGoodPhoto&id=" + photo_id + "&refer=%3Fgroup%3D<?php echo $group; ?>%26page%3D<?php echo $page; ?>";
	}
}
function AppClosePOP()
{
	var elm_popBackground = document.getElementById("popBackgroundLayer");
	var elm_popFrameWork = document.getElementById("popFrameWorkLayer");
	popContentObject2 = document.getElementById("popContentLayer");
	srcContentObject.innerHTML = popContentObject2.innerHTML;
	popContentObject2.innerHTML = '';
	elm_popBackground.style.display = "none";
	elm_popFrameWork.style.display = "none";
}
function AppCreatePOP()
{
	var layerContainer = '<div id="popBackgroundLayer"></div><div id="popFrameWorkLayer"  style="width:100%"><div id="popContentLayer" align="center"></div></div>';
	document.write(layerContainer);
	popContentObject2 = document.getElementById("popContentLayer");
}
/*********Js Function End*********/
function RecommendPhoto(url, id){
	window.location.href="?act=recommend&url="+url+"&id="+id;
}
function UnrecommendPhoto(url, id){
	window.location.href="?act=unrecommend&url="+url+"&id="+id;
}
</script>
</head>

<body>
<div id="top">
<div id="logo"><a href="/User/Main.php"></a></div>
<div id="topr">
<div id="exit"><?php require("../menu.php"); ?>
<div id="menu">
<div class="m2">
<div class="mg"><a href="/User/Main.php">用户管理中心</a></div>
<div class="mh"><a href="/Diary/DiaryList.php">日记文集</a></div>
<div class="ma"><a href="/Photo/PhotoList.php">相册</a></div>
<div class="ma" id="do4"><a href="ImageList.php">图库</a></div>
<div class="mb"><a href="/Music/MusicList.php">音乐</a></div>
<div class="mc"><div id="ms"><a href="/Memo/MemoList.php"><img src="../images/suo2.gif" width="10" height="12" />&nbsp;秘密记事本</a></div>
</div>
<div class="me"><a href="/Fav/FavList.php">网址收藏夹</a></div>
<div class="mf"><a href="/Addr/AddrList.php">通讯录</a></div>
</div>
</div>
</div>
<div id="nav">
<div id="navt">如果您发现网上有好看的图片,请不要记了收藏哟</div>
</div>


<div id="mjx"></div>
<div id="main">
<div id="left">
<div id="leph">
<div class="phff">
<div class="phtt">
图库分类</div>
<?php 
$sql1="select * from ImageGroup where User_Account='$uid' order by GroupOrder desc";
$result=$dbc->query($sql1);
while ($row=@mysql_fetch_array($result)) {

?>

<?php if ($row["GroupName"]==$group){?>
<div class="phl1"><div class="phz "><a href="ImageList.php?group=<?php echo $row["GroupName"]; ?>" title="<?php echo $row["GroupName"]; ?>"><?php echo $row["GroupName"]; ?></a></div></div><?php }else{?><div class="phl2 "><a href="ImageList.php?group=<?php echo $row["GroupName"]; ?>" title="<?php echo $row["GroupName"]; ?>"><?php echo $row["GroupName"]; ?></a></div><?php }?>

<?php }?> <div class=phl2 style='font-size:12px;color:red'><div class="phz" ><a href='/FixGroup.php' target=_blank></a></div></div></div>
<div class="mxle" ><a href="ImageGroup.php">分类管理</a></div><div class="mxle"><a href="ImageCommentToMe.php">评论管理</a></div><div class="mxle"><a href="ImageBg.php">背景设置</a></div></div>
</div>

<div id="right">
<div id="a4n">
<br/><br/>
<div class="anphg">
<!--<div class="a4"><img src="/i/jy/i/gjsc.gif" width="12" height="12" /> <a href="/Image/ImageUploadAdvanced.php?group=%B7%E7%BE%B0">高级上传</a></div>-->
<div class="a4"><img src="../images/jdsc.gif" width="12" height="12" /> <a href="ImageUploadSimple.php?group=<?php echo $group; ?>">普通上传</a></div>
<!--
<div class="a4"><img src="/i/jy/i/pai.gif" width="15" height="13" /> <a href="/Photo/PhotoUploadSnap.php?group=%B7%E7%BE%B0">在线拍照</a></div>-->
<div class="a4"><img src="../images/zhuan.gif" width="15" height="13" /> <a href="ImageUploadWeb.php?group=<?php echo $group; ?>">网上传图</a></div>
</div>
</div>
<div id="fenle">

<?php 
if ($group=="")
{
$sql="select * from image where User_Account='$uid' order by MyOrder desc,Up_AddDate desc";
}
else
{
$sql="select * from image where User_Account='$uid' and Image_Group='$group' order by MyOrder desc, Up_AddDate  desc";
}
$news = $dbc->getGopageRs($sql,$maxline);
  //echo "$sql";
$gopage = new GoPage($dbc->tpages,$dbc->total);//建立翻页程序
$backurl = "ImageList.php?group=$proup&".$dbc->getParameter();
if ($dbc->num_rows==0)
{?>
<tr><td colspan=7><br /><br /><br />暂无记录!<br /><br /><br /><br /><br /></td></tr>
<?php
}
for($i=0;$i<$dbc->num_rows;$i++)
{
?>

<div class="tupi">
<DIV> <?php echo $news[$i]["Image_Title"]; ?>  </DIV>
<div class="phim">
<a href="../home/show_image.php?id=<?php echo $news[$i]["id"]; ?>&user=<?php echo $news[$i]["User_Account"]; ?>" target=_blank>
<img alt="<?php date("Y-m-d",$news[$i]["Up_AddDate"]);?>" src="../User/<?php echo $news[$i]["Image_Sma_Url"]; ?>" onload="if (this.width>148) this.width=148;if (this.height > 118) this.height=118;"  class="photo">
</a>
</div>
<div class="zppx">
<a href="#" class="swxx"></a>排序:<a href="javascript:AppJsPhotoSort(<?php echo $news[$i]["id"]; ?>,1)">↑</a>&nbsp;<a href="javascript:AppJsPhotoSort(<?php echo $news[$i]["id"]; ?>,-1)">↓</a>
</div>
<div class="caozuo">
<a href="javascript:AppJsMdyPhoto('<?php echo $news[$i]["id"]; ?>', '<?php echo $news[$i]["Image_Title"]; ?>', '<?php echo $news[$i]["Memo"]; ?>')">改</a>&nbsp;&nbsp;<a href="javascript:AppJsDelPhoto(<?php echo $news[$i]["id"]; ?>)">删</a>&nbsp;&nbsp;<a href="javascript:AppJsMovePhoto(<?php echo $news[$i]["id"]; ?>)">移</a>
</div>
</div>
<?php }?>


</div>
<!-- 相片修改提示内容 -->
<div id="mdy_div" style="display: none">
<div id="PhotoModifyLayer">
<div>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="3" height="3"><img src="../images/czs.gif" width="3" height="3" /></td>
<td background="../images/css.gif"></td>
<td width="3" height="3"><img src="../images/cys.gif" width="3" height="3" /></td>
</tr>
<tr>
<td background="../images/czz.gif"></td>
<td bgcolor="#ebebeb"><table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td align="right"><a href="#" onclick="AppClosePOP()"><img src="../images/close.gif" width="16" height="14" border="0" /></a></td>
</tr>
<tr>
<td><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<div style="width:350px;height:250px">
<fieldset align="center" valign="middle" style="height:92%;width:95%;border:2px groove #ffffff">
<legend align="left" style="color:#000000;font-weight:bold">修改</legend>
<TABLE>
<FORM NAME="form2" METHOD="POST" ACTION="?act=mdyPhoto">
<TR>
<TD>标题:</TD>
<TD>
<INPUT TYPE="text" NAME="photo_title" value="" style="width:270px"><INPUT TYPE="hidden" NAME="group" value="<?php echo $group; ?>" style="width:270px">
</TD>
</TR>
<TR>
<TD>简介:</TD>
<TD>
<TEXTAREA  NAME="photo_memo" style="width:270px;height:135px"></TEXTAREA>
</TD>
</TR>
<TR>
<TD></TD>
<TD>
<INPUT TYPE="submit" value="确定" style="width:70px;background:#d4d0c8;border:2px outset #FFFFFF">
<INPUT TYPE="button" value="取消" style="width:70px;background:#d4d0c8;border:2px outset #FFFFFF" onclick="AppClosePOP()">
<INPUT TYPE="hidden" name="photo_id" id="photo_id" value="">
<INPUT TYPE="hidden" name="refer" id="refer" value="?refer=%3Fgroup%3D<?php echo $group; ?>%26page%3D<?php echo $page; ?>">
</TD>
</TR>
</FORM>
</TABLE>
</fieldset>
</div>
</td>
</table></td>
</tr>
</table></td>
<td background="../images/cyy.gif"></td>
</tr>
<tr>
<td width="3" height="3"><img src="../images/czx.gif" width="3" height="3" /></td>
<td background="../images/cxx.gif"></td>
<td width="3" height="3"><img src="../images/cyx.gif" width="3" height="3" /></td>
</tr>
</table>
</div>
</div>
</div>
<!-- 相片修改提示内容_结束 -->
<!-- 二级密码提示内容 -->
<div id="del_div" style="display: none">
<form action='?act=delPhoto&refer=%3Fgroup%3D<?php echo $group; ?>%26page%3D<?php echo $page; ?>' method="POST">
<input name="photo_id" id="second_photo_id" value="" type="hidden" />
<div id="SecondPasswordLayer">
<div>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="3" height="3"><img src="../images/czs.gif" width="3" height="3" /></td>
<td background="../images/css.gif"></td>
<td width="3" height="3"><img src="../images/cys.gif" width="3" height="3" /></td>
</tr>
<tr>
<td background="../images/czz.gif"></td>
<td bgcolor="#ebebeb"><table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td align="right"><a href="#" onclick="AppClosePOP()"><img src="../images/close.gif" width="16" height="14" border="0" /></a></td>
</tr>
<tr>
<td><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<div style="width:300px;height:150px">
<fieldset align="center" valign="middle"  style="height:85%;width:85%;border:2px groove #ffffff">
<legend align="left" style="color:#000000;font-weight:bold">此操作需要二级密码才能执行</legend>
<table width="179" border="0" align="center">
<tr>
<td height="10" colspan="2"></td>
</tr>
<tr>
<td width="85" height="30" align="left">输入二级密码:</td>
<td width="84" align="left"><input name="second_pass" type="password" size="10" /></td>
</tr>
<tr>
<td height="25" colspan="2"></td>
</tr>
<tr>
<td height="20" colspan="2" align="center"><input type="submit" name="Submit" value="确定" style="width:70px;background:#d4d0c8;border:2px outset #FFFFFF" onclick="" /> &nbsp;
<input type="button" name="Cancel" value="取消" style="width:70px;background:#d4d0c8;border:2px outset #FFFFFF" onclick="AppClosePOP()" /></td>
</tr>
</table>
</fieldset>
</div>
</td>
</tr>
</table></td>
</tr>
</table></td>
<td background="../images/cyy.gif"></td>
</tr>
<tr>
<td width="3" height="3"><img src="../images/czx.gif" width="3" height="3" /></td>
<td background="../images/cxx.gif"></td>
<td width="3" height="3"><img src="../images/cyx.gif" width="3" height="3" /></td>
</tr>
</table>
</div>
</div>

<script language="javascript">
window.onscroll = function() {
	AppMoveLayer("popFrameWorkLayer");
}
</script>
</form>
</div>
<!-- 二级密码提示内容:结束 -->
<!-- 相片移动提示内容 -->
<div id="move_div" style="display: none">
<div id="PhotoMoveLayer">
<div>
<table width="85%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="3" height="3"><img src="../images/czs.gif" width="3" height="3" /></td>
<td background="../images/css.gif"></td>
<td width="3" height="3"><img src="../images/cys.gif" width="3" height="3" /></td>
</tr>
<tr>
<td background="../images/czz.gif"></td>
<td bgcolor="#ebebeb"><table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td align="right"><a href="#" onclick="AppClosePOP()"><img src="../images/close.gif" width="16" height="14" border="0" /></a></td>
</tr>
<tr>
<td><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<div style="width:300px;height:130px">
<fieldset align="center" valign="middle" style="height:85%;width:94%;border:2px groove #ffffff">
<legend align="left" style="color:#000000;font-weight:bold">转移到其他分类</legend>
<TABLE>
<FORM NAME="form1" METHOD="POST" ACTION="?act=movePhoto">
<TR>
<TD style="padding-top:15px">转移到分类:</TD>
<TD style="padding-top:15px">
<SELECT NAME="group_list" id="group_list">
</SELECT>
</TD>
</TR>
<TR>
<TD STYLE="height:15px" COLSPAN="2"></TD>
</TR>
<TR>
<TD colspan="2" align="center">
<INPUT TYPE="submit" value="确定" style="width:70px;background:#d4d0c8;border:2px outset #FFFFFF">
<INPUT TYPE="button" value="取消" style="width:70px;background:#d4d0c8;border:2px outset #FFFFFF" onclick="AppClosePOP()">
<INPUT TYPE="hidden" name="photo_id" id="photo_id" value="">
<INPUT TYPE="hidden" name="refer" id="refer" value="?group=<?php echo $group; ?>&page=<?php echo $page; ?>">
</TD>
</TR>
</FORM>
</TABLE>
</fieldset>
</div></td>
</tr>
<tr>
<td style="height:5px"></td>
</tr>
</table></td>
</tr>
</table></td>
<td background="../images/cyy.gif"></td>
</tr>
<tr>
<td width="3" height="3"><img src="../images/czx.gif" width="3" height="3" /></td>
<td background="../images/cxx.gif"></td>
<td width="3" height="3"><img src="../images/cyx.gif" width="3" height="3" /></td>
</tr>
</table>
</div>
</div>
</div>
<!-- 相片移动提示内容_结束 -->

<SCRIPT LANGUAGE="JavaScript">
<!--
var obj1 = document.getElementById("group_list");
//分类列表;
<?php 
$sql1="select * from ImageGroup where User_Account='$uid' order by GroupOrder desc";
$result=$dbc->query($sql1);
while ($row=@mysql_fetch_array($result)) {
if ($group !=$row["GroupName"])
{
?>
<?php $Str_photo_class=$Str_photo_class.'"'.$row["GroupName"].'",';?>
<?php } }?>
var photo_class = new Array(<?php echo substr($Str_photo_class,0,strlen($Str_photo_class)-1); ?>);
for(var i = 0; i<photo_class.length ; i++)
{
var option1 = new Option();
option1.text = photo_class[i];
option1.value = photo_class[i];
obj1.options[obj1.options.length] = option1;
}
//-->
</SCRIPT>

<script>
AppCreatePOP();
var haveSecondPassword = false;
window.onscroll = function() {
	AppMoveLayer("popFrameWorkLayer");
}
</script>
<BR/>
<div class="fenye">
<?=$gopage->style(3)?>&nbsp;&nbsp;</div>
<BR/>
</div>
</div>
</div>
<div id="bottom">
<div id="baidu" style="color:#a0a0a0;"><?php require("../foot.php"); ?></div>
</div>

</body>
</html>