<!-- #include file=../inc/BBSsetup.asp -->
<!-- #include file=../inc/Board_popfun.asp -->
<!-- #include file=../inc/Limit_fun.asp -->
<!-- #include file=inc/UserTopic.asp -->
<!--#include file="xgcity_community_head.asp" -->
<%
dim Assort_id
Assort_id=0
%>
<script>
if(self!=top){top.location=self.location;}
function switchSysBar(){
if (switchPoint.innerText==3){
switchPoint.innerText=4
document.all("frmTitle").style.display="none"
}else{
switchPoint.innerText=3
document.all("frmTitle").style.display=""
}}
</script>
<table border="0" cellPadding="0" cellSpacing="0" height="100%" width="100%">
<tbody>
  <tr>
    <td height="100%" align="left" vAlign="top" noWrap id="frmTitle">
    <iframe frameBorder="0" id="carnoc" name="carnoc" scrolling="no" src="../left.asp?Assort_id=<%=Assort_id%>" style="HEIGHT: 100%; VISIBILITY: inherit; WIDTH: 92px; Z-INDEX: 2">
    </iframe>    </td>
    <td style="WIDTH: 9pt" >
    <table border="0" cellPadding="0" cellSpacing="0" height="100%">
	<tbody>
      <tr>
        <td style="HEIGHT: 100%" onclick="switchSysBar()" background="../images/left/bg.gif" style=CURSOR:hand; title=开启/关闭左边导航栏>
<font style=COLOR:#ffffff;CURSOR:hand;FONT-FAMILY:Webdings;FONT-SIZE:9pt;>
<SPAN id=switchPoint>3</SPAN></font></td>
      </tr>
	  </tbody>
    </table>
    </td>
    <td align="left" valign="top" style="WIDTH: 100%">
<%
DEF_BBS_HomeUrl = "../"
Dim GBL_ID
initDatabase
GBL_CHK_TempStr = ""
GBL_ID = GBL_UserID

Dim Sdm_FromUser,Sdm_ToUser,Sdm_Title,Sdm_Content,Smd_ToUserID
Sdm_FromUser = GBL_CHK_User

SiteHead(DEF_SiteNameString & " - 社员社员区")
UpdateOnlineUserAtInfo GBL_board_ID,"发送短信息"
GBL_CHK_TempStr=""
If GBL_ID < 0 Then GBL_ID = 0
If GBL_ID=0 or Sdm_FromUser = "" Then
	GBL_CHK_TempStr = GBL_CHK_TempStr & "你没有登录<br>" & VbCrLf
End If

Dim ReplyMessageID
ReplyMessageID = Left(Request("ReplyMessageID"),14)
If isNumeric(ReplyMessageID) = 0 or ReplyMessageID = "" or InStr(ReplyMessageID,",") Then ReplyMessageID = 0
ReplyMessageID = Fix(cCur(ReplyMessageID))
If ReplyMessageID < 0 Then ReplyMessageID = 0

Dim ModifyMessageID
ModifyMessageID = Left(Request("ModifyMessageID"),14)
If isNumeric(ModifyMessageID) = 0 or ModifyMessageID = "" or InStr(ModifyMessageID,",") Then ModifyMessageID = 0
ModifyMessageID = Fix(cCur(ModifyMessageID))
If ModifyMessageID < 0 Then ModifyMessageID = 0

SdM_ToUser = Request("SdM_ToUser")
UserTopicTopInfo
If ModifyMessageID > 0 Then
	DisplayUserNavigate("编辑短信息")
Else
	If Sdm_ToUser <> "" Then
		DisplayUserNavigate("给<font color=008800 class=GreenFont>" & htmlencode(Sdm_ToUser) & "</font>发消息")
	Else
		DisplayUserNavigate("发送短信息")
	End If
End If
%><Br><%
If GBL_CHK_Flag = 1 Then
	CheckUserAnnounceLimit
	If GBL_CHK_OnlineTime < DEF_NeedOnlineTime and DEF_NeedOnlineTime > 0 and CheckSupervisorUserName = 0 Then
		GBL_CHK_TempStr = "社区限制在线时间(经验)" & Fix(DEF_NeedOnlineTime/60) & "分以上社员才能使用此功能。<br>" & VbCrLf
	End If
	If ModifyMessageID > 0 Then GetMessageValue(ModifyMessageID)
	If GBL_CHK_TempStr = "" Then
		If Request.Form("submitFlag")<>"" Then
			CheckSubmitFormData
			If GBL_CHK_TempStr = "" Then
				WriteNewMessageToDatabase
				Response.Write "<br>" & GBL_CHK_TempStr
			Else
				Response.Write "<br>		<font color=ff0000 class=RedFont>" & GBL_CHK_TempStr & "</font>" & VbCrLf
				NewMessageForm
			End If
		Else
			If ReplyMessageID > 0 and ModifyMessageID = 0 Then GetMessageValue(ReplyMessageID)
			NewMessageForm
		End If
	Else%>
		<table width=96%>
		<tr>
			<td>
				<%
				Response.Write "<br><b>" & GBL_CHK_TempStr%>
			</td>
		</tr>
		</table>
	<%End If
Else%>
	<table width=96%>
	<tr>
	<td>
	<%
	If Request("submitflag")="" Then
		Response.Write "<br><b>请先登录</b>"
	Else
		Response.Write "<br><p align=left><font color=ff0000 class=RedFont><b>" & GBL_CHK_TempStr & "</b></font>"
	End If
	DisplayLoginForm
	Response.Write "</p>"%>
	</td>
	</tr>
	</table>
<%End If
UserTopicBottomInfo
closeDataBase
SiteBottom
If GBL_ShowBottomSure = 1 Then Response.Write GBL_SiteBottomString

Function NewMessageForm

	Dim TempN
%>
	
	<br>
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr> 
		<td> 
			<div align="center">
				<b>
					<%If ModifyMessageID > 0 Then
						Response.Write "编辑"
					Else
						Response.Write "发送新的"
					End If%>短信息</b>（加“<font color="#CC0000" class=RedFont><b>*</b></font>”号为必填项）
			</div>
		</td>
		<td> 
		</td>
	</tr>
	</table>

	<script language="javascript">
	
	var ValidationPassed = true;
	function submitonce(theform)
	{<%If DEF_EnableAttestNumber > 2 Then%>
		
		if(theform.ForumNumber.value=="")
		{
			alert("请输入验证码!\n");
			ValidationPassed = false;
			theform.ForumNumber.focus();
			return;
		}
		else
		{ValidationPassed = true;
		}<%End If%>

		if (document.all||document.getElementById)
		{
			for (i=0;i<theform.length;i++)
			{
				var tempobj=theform.elements[i];
				if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
				tempobj.disabled=true;
			}
		}
	}
	function ctlkey()
	{
		if(event.ctrlKey && window.event.keyCode==13){submitonce(document.LeadBBSFm);if(ValidationPassed)document.LeadBBSFm.submit();}
		if(event.altKey && (window.event.keyCode==83 || window.event.keyCode==115)){submitonce(document.LeadBBSFm);if(ValidationPassed)document.LeadBBSFm.submit();}
	}
	var ie = (document.all)? true:false
	if (ie)
	{
		window.document.onkeydown=ctlkey;
	}
	function smilie(smilietext)
	{
		smilietext=smilietext;
		if (document.LeadBBSFm.SdM_Content.createTextRange && document.LeadBBSFm.SdM_Content.caretPos)
		{
			var caretPos = document.LeadBBSFm.SdM_Content.caretPos;
			caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? smilietext + ' ' : smilietext;document.LeadBBSFm.SdM_Content.focus();
		}
		else
		{
			//document.LeadBBSFm.SdM_Content.value+=smilietext;document.LeadBBSFm.SdM_Content.focus();
		}
	}
	function storeCaret (textEl)
	{
		if (textEl.createTextRange) 
		textEl.caretPos = document.selection.createRange().duplicate(); 
	}
	</script>
	<form method="post" action="SendMessage.asp" id="LeadBBSFm" name="LeadBBSFm" onSubmit="submitonce(this);return ValidationPassed;">
	<table border=0 cellpadding=5 cellspacing=1 width=95% bgcolor="<%=DEF_BBS_Color%>" class=TBone>
	
	<tr bgcolor="<%=DEF_BBS_LightestColor%>" class=TBBG9> 
		<td>
			发送者</td>
		<td valign=top>
			<%=Sdm_FromUser%>
			<input name=submitFlag value="<%=Second(time)&minute(time)%>" type=hidden>
			<input name=ModifyMessageID value="<%=ModifyMessageID%>" type=hidden>
		</td>
	</tr>
	<%If DEF_EnableAttestNumber > 2 Then%>
	<tr bgcolor="<%=DEF_BBS_LightestColor%>" class=TBBG9> 
		<td>验证码</TD>
		<TD>
			<TABLE border=0 cellpadding="0" cellspacing="0">
			<TR>
				<td><input name=ForumNumber maxlength=4 size=4 value="<%=htmlencode(Request("RndNumber"))%>" class=fminpt></td>
				<td>&nbsp;请在框中输入<img src=<%=DEF_BBS_HomeUrl%>User/number.asp?n=<%=timer%> align=absmiddle></td>
				</TD>
			</TR>
			</TABLE>
		</td>
	</tr>
				<%End If%>
	<tr bgcolor="<%=DEF_BBS_LightestColor%>" class=TBBG9>
		<td>
			<%If CheckSupervisorUserName = 0 Then%><font color="#CC0000" class=RedFont><b>*</b></font><%End If%>接收人</td>
		<td valign=top><%If ModifyMessageID > 0 Then
				Response.Write htmlencode(SdM_ToUser)
				If SdM_ToUser = "" Then Response.Write "此为公告，无接收人"
			Else%>
			<input class=fminpt name=SdM_ToUser value="<%=htmlencode(SdM_ToUser)%>" size=20 maxlength=20> <%
				DisplayFriendList
				If CheckSupervisorUserName = 1 Then%>不填此项表示发布公告<%Else%>(必须填写)<%End If
			End If%>
		</td>
	</tr>
	<tr bgcolor="<%=DEF_BBS_LightestColor%>" class=TBBG9>
		<td align=left width=70><font color="#CC0000" class=RedFont><b>*</b></font>信息标题</td>
		<td height=24 valign=top>
			<input class=fminpt name=SdM_Title value="<%=htmlencode(SdM_Title)%>" size=60 maxlength=50>
		</td>
	</tr>
	<tr bgcolor="<%=DEF_BBS_LightestColor%>" class=TBBG9>
		<td align=left width=70>短消息内容<br><br><a href="javascript:smilie('[IMGA][/IMGA]');">支持[IMG]标<br>签插入图片</td>
		<td height=24 valign=top>
			<textarea cols=58 name="SdM_Content" rows=10" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" class=fmtxtra><%If SdM_Content<>"" Then Response.Write VbCrLf & Htmlencode(SdM_Content)%></textarea>
			<script language=javascript>
			<!--
				document.LeadBBSFm.SdM_Content.focus();
			//-->
			</script>
		</td>
	</tr><%If DEF_UBBiconNumber > 0 Then%>
	<tr bgcolor="<%=DEF_BBS_LightestColor%>" class=TBBG9>
		<td align=left width=70>插入表情</td>
		<td height=24 valign=top>
			&nbsp;<%
			Dim Temp_N
			For Temp_N = 1 to DEF_UBBiconNumber%><a href="javascript:smilie('[em<%=Right("0" & Temp_N,2)%>]');"><img src="../images/UBBicon/em<%=Right("0" & Temp_N,2)%>.GIF" width="20" height="20" align="absmiddle" border=0></a>
			<%Next%>
		</td>
	</tr><%End If%>
	</table>
	<br>
	<table width="153" border="0" cellspacing="2" cellpadding="2" align="CENTER">
	<tr align="center">
		<td width="88">
			<div align="CENTER">
				<input type="submit" name="Submit" value="提交" class=fmbtn>
			</div>
		</td>
		<td width="88"> 
			<input type="reset" name="reset" value="清除" class=fmbtn>
			</td>
	</tr>
	</table>
	</form>
<%
End Function

Function CheckSubmitFormData

	If ModifyMessageID = 0 Then SdM_ToUser = Trim(Request.Form("SdM_ToUser"))
	SdM_Title = Trim(Request.Form("SdM_Title"))
	SdM_ConTent = Request.Form("SdM_ConTent")
	
	If DEF_EnableAttestNumber > 2 Then
		If CheckRndNumber = 0 Then
			GBL_CHK_TempStr = "<b><font color=ff0000>验证码填写错误!</font></b><br>"
			GBL_CHK_Flag = 0
			Exit Function
		End If
	End If

	If SdM_ToUser <> "" Then
		If ModifyMessageID = 0 Then 
			If CheckUserNameExist(SdM_ToUser) = 0 Then
				Exit Function
			ElseIf CheckMessageOver(SdM_ToUser) = 1 Then
				GBL_CHK_TempStr = GBL_CHK_TempStr & "错误，接收人“<b>" & SdM_ToUser & "</b>”收件箱己满，发送失败!<br>" & VbCrLf
				Exit Function
			End If
		End If
	Else
		If CheckSupervisorUserName = 0 Then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "错误，必须填写接收人!<br>" & VbCrLf
			Exit Function
		Else
			If SdM_Title = "" Then
				GBL_CHK_TempStr = GBL_CHK_TempStr & "你是管理员, 现在发布的是公告信息, 请填写信息标题!<br>" & VbCrLf
				Exit Function
			End If
			If inStr(Lcase(SdM_Title),"<script") or inStr(Lcase(SdM_Title),"</script") Then
				GBL_CHK_TempStr = GBL_CHK_TempStr & "你是管理员, 发布的公告标题不能使用JS代码!<br>" & VbCrLf
				Exit Function
			End If
		End If
	End If

	If len(SdM_Title) > 50 Then
		GBL_CHK_TempStr = GBL_CHK_TempStr & "错误，信息标题请不要超过50个字. <br>" & VbCrLf
		Exit Function
	End if

	If SdM_Title = "" Then
		GBL_CHK_TempStr = GBL_CHK_TempStr & "错误，信息标题必须填写. <br>" & VbCrLf
		Exit Function
	End if

	If CheckSupervisorUserName = 1 Then
		If Len(SdM_Content) > DEF_MaxTextLength * 4 then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "错误，内容不能超过" & DEF_MaxTextLength * 2 & "个字!<br>" & VbCrLf
			Exit Function
		End If
	Else
		If Len(SdM_Content) > DEF_MaxTextLength then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "错误，内容不能超过" & DEF_MaxTextLength / 2 & "个字!<br>" & VbCrLf
			Exit Function
		End If
	End If

	If ModifyMessageID = 0 Then 
		Dim Temp
		Temp = CheckIsRestSpaceTime(SdM_Title,Left(SdM_Content & "",100))
		If Temp = 1 and CheckSupervisorUserName = 0 Then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "不能连续发太多的消息，请休息" & DEF_RestSpaceTime & "秒钟后再发短消息!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		Else
			If Temp = 2 Then
				GBL_CHK_TempStr = GBL_CHK_TempStr & "请不要发重复的消息!<br>"
				GBL_CHK_Flag = 0
				Exit Function
			End If
		End If
	Else
		If GBL_CHK_LastWriteTime < DEF_WriteEventSpace Then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "您在修改资料的过程中提交得太频，请稍候再作提交! <br>" & VbCrLf
			GBL_CHK_Flag = 0
			Exit Function
		End If
	End If

End Function

Function CheckRndNumber

	If DEF_EnableAttestNumber = 0 Then
		CheckRndNumber = 1
		Exit Function
	End If

	Dim RndNumber
	RndNumber = Left(Session(DEF_MasterCookies & "RndNum") & "",4)
	If RndNumber = "" or isNumeric(RndNumber) = 0 Then
		'RndNumber = 0
		Randomize
		RndNumber = Fix(Rnd*9999)+1
		Session(DEF_MasterCookies & "RndNum") = RndNumber
	End If
	RndNumber = cCur(RndNumber)
	
	Dim ForumNumber
	ForumNumber = Left(Request.Form("ForumNumber"),4)
	If isNumeric(ForumNumber) = False Then ForumNumber = 0
	ForumNumber = Fix(cCur(ForumNumber))
	If RndNumber = ForumNumber and RndNumber > 0 Then
		CheckRndNumber = 1
	Else
		CheckRndNumber = 0
	End If
	Randomize
	Session(DEF_MasterCookies & "RndNum") = Fix(Rnd*9999)+1

End Function

Function WriteNewMessageToDatabase

	Dim SQL
	SdM_Content = Replace(SdM_Content & "","\" & VbCrLf,"\\" & VbCrLf & VbCrLf)

	If ModifyMessageID = 0 Then
		SQL = "inSert into LeadBBS_InfoBox(FromUser,ToUser,Title,Content,IP,SendTime,ReadFlag)" & _
			" Values('" & Replace(SdM_fromUser,"'","''") & "','" & Replace(SdM_ToUser,"'","''") & "','" & Replace(SdM_Title,"'","''") & "'" & _
			",'" & Replace(SdM_Content,"'","''") & "','" & GBL_IPAddress & "'," & GetTimeValue(DEF_Now) & ",0)"
		con.Execute(SQL)
		GBL_DBNum = GBL_DBNum + 1
		
		If SdM_ToUser = "" Then ReloadPubMessageInfo
	
		GBL_CHK_TempStr = "<p align=left>&nbsp; &nbsp; <font color=008800 class=GreenFont>成功发送消息给"
		If SdM_toUser = "" Then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "所有社员。</font><br>" & VbCrLf
		Else
			GBL_CHK_TempStr = GBL_CHK_TempStr & SdM_toUser & "。</font><br>" & VbCrLf
			Con.Execute("Update LeadBBS_User Set MessageFlag=1 where ID=" & Smd_ToUserID)
			GBL_DBNum = GBL_DBNum + 1
			If GBL_UserID = cCur(Smd_ToUserID) Then UpdateSessionValue 6,1,0
		End If
	Else
		SQL = "Update LeadBBS_InfoBox set Title='" & Replace(SdM_Title,"'","''") & "',Content='" & Replace(SdM_Content,"'","''") & "' where ID=" & ModifyMessageID
		con.Execute(SQL)
		GBL_DBNum = GBL_DBNum + 1
		
		If SdM_ToUser = "" Then ReloadPubMessageInfo
	
		GBL_CHK_TempStr = "<p align=left>&nbsp; &nbsp; <font color=008800 class=GreenFont>成功编辑短消息"

		If CheckSupervisorUserName = 0 Then
			Con.ExeCute("Update LeadBBS_User Set LastWriteTime=" & GetTimeValue(DEF_Now) & " where ID=" & GBL_UserID)
			UpdateSessionValue 13,GetTimeValue(DEF_Now),0
			GBL_DBNum = GBL_DBNum + 1
		End If
	End If

End Function

Function CheckMessageOver(username)

	Dim Rs,tmp
	Set Rs = Con.ExeCute("Select count(*) from LeadBBS_InfoBox where ToUser='" & Replace(username,"'","''") & "'")
	GBL_DBNum = GBL_DBNum + 1
	If Rs.Eof Then
		CheckMessageOver = 0
	Else
		tmp = Rs(0)
		If isNull(tmp) Then tmp = 0
		tmp = cCur(tmp)
		If tmp > LMT_MaxMessageNumber Then
			CheckMessageOver = 1
		Else
			CheckMessageOver = 0
		End If
	End if
	Rs.Close
	Set Rs = Nothing

End Function

Rem 检测某社员名ID是否存在
Function CheckUserNameExist(UserName)

	Dim UserLimit
	Dim Rs
	Set Rs = Con.ExeCute("Select top 1 ID,UserName,UserLimit from LeadBBS_User where UserName='" & Replace(UserName,"'","''") & "'")
	GBL_DBNum = GBL_DBNum + 1
	If Rs.Eof Then
		CheckUserNameExist = 0
		Smd_ToUserID = 0
		GBL_CHK_TempStr = "错误，找不到接收人“<b>" & SdM_ToUser & "</b>”，请确认是否存在此人!<br>" & VbCrLf
		Rs.Close
		Set Rs = Nothing
		Exit Function
	Else
		Smd_ToUserID = Rs(0)
		Sdm_ToUser = Rs(1)
		UserLimit = Rs(2)
	End if
	Rs.Close
	Set Rs = Nothing
	If GetBinaryBit(UserLimit,13) = 1 Then
		Set Rs = Con.ExeCute("Select top 1 ID from LeadBBS_FriendUser where FriendUserID=" & GBL_UserID & " and UserID=" & Smd_ToUserID)
		If Rs.Eof Then
			GBL_CHK_TempStr = htmlencode(Sdm_ToUser) & " 已经设置成仅允许接收好友的短消息，请勿打扰。<br>" & VbCrLf
			CheckUserNameExist = 0
		Else
			CheckUserNameExist = 1
		End If
		Rs.Close
		Set Rs = Nothing
	Else
		CheckUserNameExist = 1
	End If

End Function


Function GetMessageValue(MessageID)

	Dim Rs,SQL
	'If Request("AllPrinting")="Yesing" Then
		'SQL = "Select top 1 FromUser,SendTime,Title,Content,ToUser,ReadFlag from LeadBBS_InfoBox where ID=" & MessageID
	'Else
		SQL = "Select top 1 FromUser,SendTime,Title,Content,ToUser,ReadFlag from LeadBBS_InfoBox where ID=" & MessageID
	'End If
	Set Rs = Con.ExeCute(SQL)
	GBL_DBNum = GBL_DBNum + 1
	If Rs.Eof Then
		GBL_CHK_TempStr = "错误，找不到这条消息相关资料．"
	Else
		If SdM_FromUser <> Rs(0) and SdM_FromUser <> Rs(4) and Rs(4) <> "" Then
			GBL_CHK_TempStr = "错误，找不到这条消息相关资料．"
			Rs.Close
			Set Rs = Nothing
			Exit Function
		End If
		If Rs(4) = "" and CheckSupervisorUserName = 0 Then
			GBL_CHK_TempStr = "错误，找不到这条消息相关资料．"
			Rs.Close
			Set Rs = Nothing
			Exit Function
		End If
		SdM_Title = Rs(2)
		If ModifyMessageID > 0 Then
			If GBL_CHK_User <> Rs(0) Then
				GBL_CHK_TempStr = "错误，找不到这条消息相关资料．"
				Rs.Close
				Set Rs = Nothing
				Exit Function
			End If
			If (Rs(5) = 1 or Rs(5) = True) Then
				GBL_CHK_TempStr = "此条短消息己阅，无法再编辑．"
				Rs.Close
				Set Rs = Nothing
				Exit Function
			End If
			SdM_Content = Rs(3)
			SdM_ToUser = Rs(4)
			SdM_FromUser = Rs(0)
		Else
			SdM_Content = Replace(Rs(3) & "",VbCrLf,VbCrLf & ">")
			If SdM_Content<>"" Then SdM_Content = ">" & SdM_Content
			SdM_Content = VbCrLf & VbCrLf & VbCrLf & "-----------------------------------------" & VbCrLf & ">[回复" & htmlencode(Rs(0)) & " " & Mid(RestoreTime(Rs(1)),6,11) & "发送的短消息]" & VbCrLf & ">标题：" & SdM_Title & VbCrLf & VbCrLf & SdM_Content & VbCrLf
			If Left(SdM_Title,3) <> "Re:" Then SdM_Title = Left("Re:" & SdM_Title,250)
		End If
	End If
	Rs.Close
	Set Rs = Nothing

End Function


Function CheckIsRestSpaceTime(Form_Title,Form_Content)

	Dim Rs,ndatetime,Temp_ID,Temp_Title,Temp_Content
	Set Rs = Con.ExeCute("Select top 1 SendTime,ID,title,Content from LeadBBS_InfoBox where FromUser='" & Replace(Sdm_FromUser,"'","''") & "' Order by ID DESC")
	GBL_DBNum = GBL_DBNum + 1
	If Rs.Eof Then
		CheckIsRestSpaceTime = 0
		Rs.Close
		Set Rs = Nothing
		Exit Function
	Else
		ndatetime = Rs(0)
		Temp_ID = Rs(1)
		Temp_Title = Rs(2)
		Temp_Content = Left(Rs(3) & "",100)
		Rs.Close
		Set Rs = Nothing
	End if
	
	If DateDiff("s", RestoreTime(ndatetime), DEF_Now) < 0 Then
		CheckIsRestSpaceTime = 0
		Exit Function
	End If
	If DateDiff("s", RestoreTime(ndatetime), DEF_Now) < DEF_RestSpaceTime Then
		CheckIsRestSpaceTime = 1
		con.execute("Update LeadBBS_InfoBox set SendTime=" & GetTimeValue(DEF_Now) & " where id=" & Temp_ID)
		GBL_DBNum = GBL_DBNum + 1
	Else
		If Temp_Title = Form_Title and Temp_Content = Form_Content Then
			CheckIsRestSpaceTime = 2
		Else
			CheckIsRestSpaceTime = 0
		End If
	End If
	

End Function

Sub DisplayFriendList

	Dim SQL,Rs,GetData
	SQL = "select TOP " & DEF_MaxListNum & " T2.UserName from LeadBBS_FriendUser as T1 inner join LeadBBS_User as T2 on T1.FriendUserID=T2.ID where T1.UserID=" & GBL_ID
	Set Rs = Con.ExeCute(SQL)
	GBL_DBNum = GBL_DBNum + 1
	If Not Rs.Eof then
		GetData = Rs.GetRows(DEF_MaxListNum)
		Rs.Close
		Set Rs = Nothing
	Else
		Rs.Close
		Set Rs = Nothing
		Exit Sub
	End If

	Rs = Ubound(GetData,2)
	%>
	<SELECT name=font onchange="if(this.value==''){window.open('SelectFriend.asp','','width=250,height=450 scrollbars=auto,status=no');}else{document.LeadBBSFm.SdM_ToUser.value=this.value;}">
	<OPTION selected value="<%=htmlencode(SdM_ToUser)%>">选择好友</OPTION>
	<%
	For SQL = 0 to Rs
		Response.Write "<option value=""" & htmlencode(GetData(0,SQL)) & """>" & htmlencode(GetData(0,SQL)) & "</option>"
	Next
	If Rs >= DEF_MaxListNum-1 Then Response.Write "<option value="""">更多...</option>"
	%>
	</SELECT>
	<%

End Sub%>
 </td>
  </tr>
  </tbody>
</table>
<script>
if(window.screen.width<'1024'){switchSysBar()}
</script>
