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

    <?php
include("../User/CheckLogined.php");
include("../include/dbclass.php");
include("../include/global.php");
require_once "../include/page.php";
$dbc=new DbConn();
$uid=$_COOKIE["uid"];
$page=(int)$_GET["page"];
$key=$_GET["key"];
$maxline = 10;
if ($_GET["action"]=="replyComment")
{
$page=$_GET["page"];
$id=$_POST["id"];
$memo=$_POST["memo"];

$sql="update ImageComment set ImageComment_Replay='$memo',ImageComment_Replay_Readed='1' where id='$id'";
$dbc->Execute($sql);

header("Location:ImageCommentToMe.php?page=$page");
}
if($_GET["action"]=="delComment")
{
$id=$_GET["id"];
$key=$_GET["key"];
$page=$_GET["page"];
if(strlen(strrchr(strtolower($id), ','))>0)
{
	$split_img = explode(',',$id);
	$extcount = count($split_img);
		for($i=0;$i<$extcount;$i++)
		{
		$newid=$split_img[$i];
		//echo $newid;
		$sql="delete from ImageComment where ImageComment_UserName='$uid' and id='$newid'";
		$dbc->Execute($sql);
		}
header("Location:ImageCommentToMe.php?page=$page&key=$key");
}
else
{
$sql="delete from ImageComment where ImageComment_UserName='$uid' and id='$id'";
$dbc->Execute($sql);
header("Location:ImageCommentToMe.php?page=$page&key=$key");
}

}
?>
<!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" />
<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%2FImageCommentToMe.php";
	}
}catch(e){}
function showNewMessage(user){
	top.showNewMessage(user);
}

</script>
<script>
/*********Js Function Begin*********/
function AppCheckReplyForm(obj){
	return AppCheckStrLength(obj.memo.value, 2,500);
}
function AppCheckStrLength(str,min, max){
	len = str.replace(/^\s*/i,'').length;
	if (len < min ){
		alert("输入的字符不能少于"+min+"个");
		return false;
	}
	if (len > max){
		alert("输入的字符不能多于"+max+"个");
		return false;
	}
	return true;
}
function AppCtrlEnterCommentToMe(form, button){
	var obj = form;
	if( (event.ctrlKey && event.keyCode == 13) || (event.altKey && event.keyCode == 83))
	{
		obj.memo.value=obj.memo.value.replace(/^\s*/i,'');
		if(AppCheckReplyForm(obj)){
			obj.submit();
		}
		else{
			event.returnValue=false;
		}
	}
}
function AppRenewLen(obj, max){
	str = obj.value;
	if(str.length>max)
	{
		obj.value=str.substring(0,max);//
		document.getElementById('zishu').innerHTML="<font color=red><b>0</b></font>";
		alert("输入的字符不能多于 "+max+" 个!");
	}
	else
	{
		var j=max - str.length;
		document.getElementById('zishu').innerHTML=j;
	}
}
function AppHideReplyInput()
{
	if(current_id > 0)
	{
		AppGetObject('reform_'+current_id).style.display = 'none';
		AppGetObject('reform_'+current_id).innerHTML = '';
		current_id = 0;
	}
}
function AppGetObject(id)
{
	if(document.getElementById)
	{
		return document.getElementById(id);
	}
	else if(document.all)
	{
		return document.all[id];
	}
	else if(document.layers)
	{
		return document.layers[id];
	}
}
function AppShowReplyInput(i)
{
	AppHideReplyInput();
	current_id = i;
	AppGetObject('reform_'+i).innerHTML = reply_code;
	AppGetObject('reform_'+i).style.display = '';
	AppGetObject('ping_id').value = i;
	AppGetObject('memo').focus();
	try {
		top.init();
	} catch (e) {};
	return false;
}
/*********Js Function End*********/
String.prototype.length2 = function() {
	if (this == " ")
		return 1;
	var cArr = this.match(/[^x80-xff]/ig);
	return this.length + (cArr == null ? 0 : cArr.length);
}
</script>
<script src="../js/face.js" language="JavaScript">
</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"><a href="/Image/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 include("../ToMeMenu.php"); ?>
</div>
</div>
</div>
<div id="right">
<div id="a4n">
<div class="anphg">
<div class="a5" id="l">别人给我图片的评论</div>
<div class="a5"><a href="ImageCommentToOther.php">我给别人图片的评论</a><?php
$sql="select id from ImageComment where ImageComment_Replay_Readed='1' and ImageComment_Name='$uid'";
$rs=$dbc->getRs($sql);
if ($rs !=null)
{
?>
<span style='margin-left:2px;color:red'>(新)</span><?php } ?></div>
</div>
<div id="txss">
<form>
<div class="txyy">用户名:
<input name="key" type="text" class="text"  value="<?php echo $key; ?>"/>
<input name="Submit" type="submit" class="btn" value="搜 索" />
</div>
</form>
</div>
</div>
<div id="fenle">
<div class="plhf" id="reform" style="display:none;">
<form name=form2 action="?action=replyComment&page=<?php echo $page; ?>" method="POST" onsubmit="return AppCheckReplyForm(this)">
<table width=100%><tr><td width=200>
<div class="plhf1">回复内容&nbsp;
<input type="hidden" name="id" value="" id="ping_id">
<input name="Submit2" type="button" class="btn" value="插入表情" onClick="showFace('face','memo')" />
</div></td><td>
<div style="width:200px;text-align:right">还可以输入 <span id=zishu>500</span> 个字</nobr></div>
</td></tr></table>
<div class="plhf2">
<textarea id="memo" name="memo" cols="75" rows="3" onKeydown="AppCtrlEnterCommentToMe(form2,false);" onKeyUp="AppRenewLen(this, 500);"  onPaste="AppRenewLen(this, 500);"  onChange="AppRenewLen(this, 500);" onBlur="AppRenewLen(this, 500);"></textarea>
</div>
<div class="plhf3">
<input name="Submit3" type="submit" class="btn" value="回 复" />
<input name="Submit32" type="button" onclick="AppHideReplyInput();" class="btn" value="关 闭" />
</div>
</form>
</div>

<script>
var current_id = 0;
var reply_code = AppGetObject('reform').innerHTML;
AppGetObject('reform').innerHTML = '';
</script>

<script>
function selectAll()
{
	var acb_status = document.all("acb").checked;
	var cbs=document.all("cb");
	if(!cbs) return;
		if(cbs.length)
		{
			for(var i=0;i<cbs.length;i++)
			{
				cbs.item(i).checked = acb_status;
			}
		}
	else
		document.all("cb").checked = acb_status;
}
function joinValue()
{
	var cbs=document.all("cb");
	if(!cbs) return;
		document.all("arg").value="";
	if(cbs.length)
	{
		for(var i=0;i<cbs.length;i++)
			if(cbs.item(i).checked)
			{
				document.all("arg").value+=(cbs.item(i).value+",");
			}
		document.all("arg").value=document.all("arg").value.substring(0,document.all("arg").value.length-1);
	}
	else
	{
		if(cbs.checked)
		{
			document.all("arg").value=cbs.value;
		}
	}
}
function init()
{
	var cbs=document.all("cb");
	if(!cbs) return;
		if(!cbs.length && document.all("acb"))
		{
			document.all("acb").disabled=true;
		}
}
function delList()
{
	if(document.all("acb").disabled==true) return;
		joinValue();
	if(document.all("arg").value)
	{
		if(confirm("确认删除所选的评论么?"))
		{
			window.self.location="?action=delComment&id=" + document.all("arg").value + "&page=<?php echo $page; ?>";
		}
	}
	else
	{
		alert('选择不能为空!');
	}
	return false;
}
</script>
<!-- BEGIN FieldView:UcPhotoCommentToMe -->
<?php
//更新数据库把没有看的都设为看了
$sqlread="update ImageComment set ImageComment_Readed='1' where ImageComment_UserName='$uid'";
$dbc->Execute($sqlread);

if($key=="")
{
$sql="select * from ImageComment where ImageComment_UserName='$uid' order by ImageComment_AddDate desc";
}
else
{
$sql="select * from  ImageComment where ImageComment_Name like '%$key%' and ImageComment_UserName='$uid' order by ImageComment_AddDate desc";
}

$news = $dbc->getGopageRs($sql,$maxline);
  //echo "$sql";
$gopage = new GoPage($dbc->tpages,$dbc->total);//建立翻页程序
$backurl = "ImageCommentToMe.php?".$dbc->getParameter();
for($i=0;$i<$dbc->num_rows;$i++)
{?>

<table width="570" border="0" cellpadding="0" cellspacing="0" class="tb">
<tr class="ptbti">
<td height="20" colspan="4" align="left"><div class="pz"><input type="checkbox" name='cb' value='<?php echo $news[$i]["id"];?>' /> <a href="http://www.wu-liao.com/home.php?user=<?php echo $news[$i]["ImageComment_Name"];?>" target="_blank" style='text-transform: capitalize'><?php echo $news[$i]["ImageComment_Name"];?></a>对我照片的评论</div>
<div class="py"><a onclick="if(confirm('确定要删除这条评论吗?')){return true;}else{return false;}" href="?action=delComment&id=<?php echo $news[$i]["id"];?>&page=<?php echo $page; ?>&key=<?php echo $key; ?>&refer=" style="color:#0000cc;font-weight:bold">[删除]</a> <a href="#" onclick="javascript: return AppShowReplyInput(<?php echo $news[$i]["id"];?>)" style="color:#0000cc;font-weight:bold">[回复]</a></div></td>
</tr>
<tr>
<td width="102" height="120"><div class="plzb"><a href="http://www.51.com/home.php?user=qbx02qbx" target="_blank" style='text-transform: capitalize'><?php echo $news[$i]["ImageComment_Name"];?></a><br />
<script src='../1e/<?php echo $news[$i]["ImageComment_Name"];?>/<?php echo $news[$i]["ImageComment_Name"];?>.js'></script>
	<script>
	var ImgShow='<img src=../images/loadface.gif border=0 width=80 height=90>';
	if(typeof(<?php echo $news[$i]["ImageComment_Name"];?>_photo)!='undefined')
	{
		var ImgShow='<img src='+<?php echo $news[$i]["ImageComment_Name"];?>_photo+' border=0 class=photo width=80 onLoad=reloadImage(this)>';
	}
	</script>
	<a href="http://www.wu-liao.com/home.php?user=<?php echo $news[$i]["ImageComment_Name"];?>" target="_blank"><script>document.write(ImgShow);</script></a></div></td>
<td width="27"><br />
<img src="../images/bei.gif" width="27" height="17" /></td>
<td width="85">[被评照片]<br />
<a href="http://www.wu-liao.com/show_Image.php?id=<?php echo $news[$i]["ImageComment_CommentObjId"];?>&user=<?php echo $news[$i]["ImageComment_UserName"];?>" target="_blank"><img src="../User/<?php echo $news[$i]["ImageComment_Sma_Url"];?>
" width="80"    class="photo" onerror="this.src='../images/norz.gif'"/></a></td>
<td width="350" align="center" valign="top"><div class="plnr" style="width:250px">
<?php echo ubb($news[$i]["ImageComment_Memo"]);?>
</div>
<?php if($news[$i]["ImageComment_Replay"]!=null){?>
<div class="plh">
<hr size="1px" width="100%" />

回复:<?php echo ubb($news[$i]["ImageComment_Replay"]); ?>
<?php }?>

</div>
<div class="ptime">评论时间:<?php echo $news[$i]["ImageComment_AddDate"];?></div>		  </td>
</tr>
</table>
<div class="plhf" id="reform_<?php echo $news[$i]["id"];?>" style="display:none;">		</div>
<?php }?>


<!-- END FieldView:UcPhotoCommentToMe -->

<div class="qlcz">
<input type="Hidden" name="arg"><input type='Checkbox' name='acb' onclick='selectAll()' id="selectall" /><label for="selectall">全选</label>&nbsp;&nbsp;<a href="#" onclick='javascript: return delList();'>删除所选评论</a></div>
<div class="tjfy">
<div class="fenye">
<?=$gopage->style(3)?>&nbsp;&nbsp;</div>
</div>
</div>
</div>
</div>
<div id="bottom">
<div id="baidu" style="color:#a0a0a0;"><?php require("../foot.php"); ?></div>
</div>
</body>
</html>