www.gusucode.com > 仿51.com的php源码 1.1 > User/LeaveWordToMe.php

    <?php
include("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;
$deferentparameter="&key=".$key;
if ($_GET["action"]=="replyComment")
{
$page=$_GET["page"];
$id=$_POST["id"];
$memo=$_POST["memo"];
$key=$_GET["key"];
$sql="update guestbook set Replay_Memo='$memo',Replayed='1' where id='$id'";
$dbc->Execute($sql);
header("Location:LeaveWordToMe.php?page=$page&key=$key");
}

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 guestbook where UserName='$uid' and id='$newid'";
		$dbc->Execute($sql);
		}
header("Location:LeaveWordToMe.php?page=$page&key=$key");
}
else
{
$sql="delete from guestbook where UserName='$uid' and id='$id'";
$dbc->Execute($sql);
header("Location:LeaveWordToMe.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>
try{
	if(top!=window){
		document.domain	="www.wu-liao.com";		
	}else{
		top.location.href="/webin.php?refer=%2FUser%2FLeaveWordToMe.php";
	}
}catch(e){}
function showNewMessage(user){
	top.showNewMessage(user);
}

</script>
<script src="../js/global.js" language="javascript"></script>
<div id="face" style="display:none; position:absolute; width:260px; height:276px;"></div>


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

</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">
<link href="../images/sz.css" rel="stylesheet" type="text/css">
<script src="../js/face.js" language="JavaScript"></script>
<div class="anphg">
<div class="a5" id="l">别人给我的留言</div>
<div class="a5"><a href="LeaveWordToOther.php">我给别人的留言</a><?php
$sql="select id from guestbook where Replayed='1' and User_Account='$uid'";
$rs=$dbc->getRs($sql);
if ($rs !=null)
{
?>
<span style='margin-left:2px;color:red'>(新)</span><?php } ?></div>
</div>
<div id="txss" style="background:#ffffff">
<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">
<script language="javascript">
String.prototype.length2 = function() {
	if (this == " ")
		return 1;
	var cArr = this.match(/[^x80-xff]/ig);
	return this.length + (cArr == null ? 0 : cArr.length);
}
function deleteItemConfirm(id, msg)
{
	if(confirm(msg))
	{
		window.self.location="?action=del&id=" + id + "&page=";
	}
}
</script>
<div class="plhf" id="reform" style="display:none;">
<form name=form2 action="?action=replyComment&page=<?php echo $page; ?>&key=<?php echo $key; ?>" 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 create_user_face(User){
	var sSex=(eval(User+"_sex") == "先生")?"../images/boy.gif":"../images/girl.gif";
	document.write("<img src='"+sSex+"' align='absmiddle'>");
}
function create_user_vip(User){
	var sSex=(eval(User+"_vip") ==0)?"../i/novip.jpg":"../i/ivip.gif";
	document.write("<img src='"+sSex+"' align='absmiddle'>");
}
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; ?>&key=<?php echo $key; ?>";
		}
	}
	else
	{
		alert('选择不能为空!');
	}
	return false;
}
</script>

<script src="../js/face.js" language="JavaScript"></script>
<div id="face" style="display:none; position:absolute; width:260px; height:276px;"></div>

<div id="fenle">
<div class="olcz"><a href="MyAccessRight.php">如何防骚扰?点此查看</a><br/>提示:留言人有权删除他给您的留言.所以,当您看到留言减少时,属正常现象.</div>
<form name="form3" id="form3" action="?page=" method="post"><input type="Hidden" name="memo3" value=""></form>
<form name="form1" method="post" action="?action=dellist&page=">
<input type="Hidden" name="arg">
</form>
<!-- BEGIN FieldView:UcLeaveWordToMe -->

<?php
//更新数据库把没有看的都设为看了
$sqlread="update guestbook set Readed='1' where UserName='$uid'";
$dbc->Execute($sqlread);

if($key=="")
{
$sql="select * from guestbook where UserName='$uid' order by Guest_AddDate desc";
}
else
{
$sql="select * from  guestbook where User_Account like '%$key%' and UserName='$uid' order by Guest_AddDate desc";
}

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


<script src='../1e/<?php echo $news[$i]["User_Account"]; ?>/<?php echo $news[$i]["User_Account"]; ?>.js'></script>

	<script>
	var ImgShow='<img src=../images/loadface.gif border=0 width=80 height=90>';
	if(typeof(<?php echo $news[$i]["User_Account"]; ?>_photo)!='undefined')
	{
		var ImgShow='<img src='+<?php echo $news[$i]["User_Account"]; ?>_photo+' border=0 class=photo width=80 onLoad=reloadImage(this)>';
	}
	</script>
	
<table width="570" border="0" cellpadding="0" cellspacing="0" class="lyts">
<tr>
<td height="30" colspan="3" class="lyjp" style="border-bottom:1px dashed #cccccc">
<div class="stlya">
<input type="checkbox" onclick='selectItem(this.parentElement,this.checked)' name='cb' value='<?php echo $news[$i]["id"]; ?>' /><a href='/home.php?user=<?php echo $news[$i]["User_Account"]; ?>' target='_blank' title='点击查看<?php echo $news[$i]["User_Account"]; ?>的个人主页'><?php echo $news[$i]["User_Account"]; ?></a>
</div>
<div class="stlyc"></div>
<div class="stlyb"><script>create_user_face('<?php echo $news[$i]["User_Account"]; ?>');</script>&nbsp&nbsp<script>create_user_vip('<?php echo $news[$i]["User_Account"]; ?>');</script></div>
<div class="stlyd"><span  class="stlyc"><?php echo $news[$i]["Guest_AddDate"]; ?>&nbsp;</span>
<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>&nbsp;
 <a href="#" onclick="javascript: return AppShowReplyInput(<?php echo $news[$i]["id"];?>)" style="color:#0000cc;font-weight:bold">[回复]</a>
</div>
</td>
</tr>
<tr id="div0">
<td width="114" height="120">
<a href='/home.php?user=<?php echo $news[$i]["User_Account"]; ?>' target='_blank' title='点击查看<?php echo $news[$i]["User_Account"]; ?>的个人主页'><script>document.write(ImgShow);</script></a>
</td>
<td width="356">
<div class="mebao"><?php if($news[$i]["Guest_IsHide"]==1){?><font color='#ff0000'>[悄悄话]</font><br/><?php }?><?php echo ubb($news[$i]["Guest_Memo"]); ?><?php if($news[$i]["Replay_Memo"]!=null){?><span id="replay_<?php echo $news[$i]["id"]; ?>"><hr noshade size=1 width='50%' align='left'><strong style='color:#000000;'>回复:<?php echo ubb($news[$i]["Replay_Memo"]); ?></strong></span><?php } ?></div>
</td>
<td width="100">
<a href="#" onclick="window.open('AddFriend.php?user=<?php echo $news[$i]["User_Account"]; ?>', 'AddFriend', 'height=200, width=350, left=100, top=150, screenX=200, screenY=200, toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no, z-look=yes');return false;">加为好友</a><br />
<a onclick="return confirm('确定要将【<?php echo $news[$i]["User_Account"]; ?>】列入黑名单吗?\n以后将不能接收到此会员发送的消息和留言!')" href='MyBlackList.php?act=addBlackList&to=<?php echo $news[$i]["User_Account"]; ?>&refer=close' target='_blank' style='font-size:9pt'>阻止此人</a></td>
</tr>
</table>
<div class="plhf" id="reform_<?php echo $news[$i]["id"]; ?>" style="display:none; text-align:left;"></div>

<?php }?>


<!-- END FieldView:UcLeaveWordToMe -->


<div class="qlcz">
<input type='Checkbox' name='acb' onclick='selectAll()' id="selectall" />
<label for="selectall">全选</label>&nbsp;&nbsp;
<a href="#" onclick='javascript: return delList();'>删除所选留言</a>
</div>


</div>
<!-- 分页 -->
<div class="stsc">
<div class="fenye">
<?=$gopage->style(3)?> &nbsp;&nbsp;&nbsp;</div>
</div>
</div>
</div>
</div>
<div id="bottom">
<div id="baidu" style="color:#a0a0a0;"><?php require("../foot.php"); ?></div>
</div>
</body>
</html>