?? list.asp
字號:
<%
'////////////////////////////////////////////////////////////////
'/////文 件 名:/list.asp
'/////程序名稱:短消息程序+通知程序
'/////所屬模塊:公共
'/////輸入接口:1、Session變量:
'///// <1>:Session("id"):當(dāng)前用戶名稱
'///// <2>:oconn:系統(tǒng)數(shù)據(jù)庫連接
'///// <3>:Session("conn2"):系統(tǒng)郵件數(shù)據(jù)庫連接
'///// <4>:Session("num"):收件箱中暫存郵件數(shù)
'///// 2、Request 變量:
'///// <1>:Request("op"):操作標志
'///// <2>:Request("vtext"):短消息內(nèi)容
'///// <3>:Request("vname")短消息接受者列表
'///// 3、Include File:
'///// <1>:css.asp 樣式表
'/////創(chuàng)建日期:2002-2002-6-24
'/////創(chuàng) 建 人:羅向東
'/////修改記錄:
'///// 2002-7-24 羅向東 代碼歸整
'////////////////////////////////////////////////////////////////
Option Explicit
response.write("<html><head><title>短消息</title><meta http-equiv='Content-Type' content='text/html; charset=gb2312'>")
Dim temptime,fromYear,fromMonth,fromSecond,fromDay,fromMinute,fromHour,x(5),fixstr,t,i,te,strr,online,offline,onname,offname,Record,shijian,shijian1,shijian2,RefreshTime
'on error resume next
'更新在線列表
function fmt(str,width)
fmt=right(string(width,"0") & str ,width)
end function
temptime = now()
fromYear = year(temptime)
fromMonth = fmt(month(temptime),2)
fromDay = fmt(day(temptime),2)
fromMinute= fmt(Minute(Time()),2)
fromHour = fmt(Hour(Time()),2)
shijian=fromYear & fromMonth & fromDay & fromHour & fromMinute
x(1)=cint(fromMinute)-3
x(2)=cint(fromHour)
x(3)=cint(fromDay)
x(4)=cint(fromMonth)
x(5)=cint(fromYear)
if x(1)<0 then
x(1)=x(1)+60
x(2)=x(2)-1
if x(2)<0 then
x(2)=x(2)+24
x(3)=x(3)-1
if x(3)<0 then
x(3)=x(3)+30
x(4)=x(4)-1
if x(4)<0 then
x(4)=x(4)+12
x(5)=x(5)-1
end if
end if
end if
end if
for i=5 to 1 step -1
shijian1=shijian1+fmt(x(i),2)
next
shijian1=left(fromYear,2)+shijian1
oconn.execute "update [user] set online='t',utime='" & shijian & "' where vname='" & Session("id") & "'"
oconn.execute "update [user] set online='f' where utime<'" & shijian1 & "'"
'讀取人員在線狀態(tài)列表
set Record = Server.CreateObject("ADODB.Recordset")
Record.open "select [vname],[online] from [user] order by hudpnumber",oconn,1,1
online=0
offline=0
while not Record.eof
if Record("online")="t" then
online=online+1
onname=onname & "<option value='" & Record("vname") & "'>" & Record("vname")
else
offline=offline+1
offname=offname & "<option style='color:gray' value='" & Record("vname") & "'>" & Record("vname")
end if
Record.movenext
wend
Record.close
response.write("</head><script language=javascript>function reloadthis()" + vbcrlf +"{")
if request("op")="cmdSendmsg" then
response.write("window.location.href='list.asp';}")
else
response.write("window.location.reload(true);}")
end if
response.write("window.setTimeout('reloadthis()'," & Session("RefreshTime")*1000 & ");")
%>
function sms(toname)//發(fā)送短消息
{
var a=open("../message/message.asp?opFlag=cmdSend&sendto=" + toname ,"", "left=200,width=400,height=200,top=100");
/*
if(msg!=null)
{
document.all.vtext.value=msg
document.all.vname.value=toname
document.all.op.value='cmdSendmsg'
document.all.msgform.submit()
}
*/
document.all.selectxx.selectedIndex=0
};
function smss()//群發(fā)消息
{
return_value=showModalDialog("../public/userlist.asp?muilt=yes","","dialogWidth:25;dialogHeight:16;dialogTop:250;dialogLeft:260;status:no;scrollbars:no;help:no");
if((typeof(return_value)=="undefined") ||(return_value=="*") || (return_value==""))
return;
else
{
var str1="";
var str2="";
tmpstr=return_value.split("*");
str1=tmpstr[0];
str2=tmpstr[1];
sms(str1);
}
};
</script>
<body name=mainb scroll=no style="background:#000000;" bgcolor="#000000" leftmargin="0" topmargin="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%" class=vtext>
<tr bgcolor=ffffff>
<td name=sel nowrap align="right" >
<select name="selectxx" id="selectxx" style="<%=session("vinputtext")%>;display:none;font-size:12px;width:120" onChange="javascript:sms(document.all.selectxx.value);" >
<option style="background:4444ff; color:white">--在線<%=online%>人--</option>
<%=onname%>
<option style="background:4444ff;color:white">--離線<%=offline%>人--</option>
<%=offname%>
</select>
<a href="javascript:smss()"><font color="#FFFFFF"><img src="../images/man.gif" width="16" height="16" border="0" alt="消息群發(fā)" align="absmiddle">
</font></a></td>
</tr>
</table>
<div id="Layer1" align="center"
onMouseOver="if(document.readyState=='complete'){document.all.selectxx.style.display='';if(document.activeElement.name!='selectxx') document.all.selectxx.focus()}"
onMouseOut="if(document.readyState=='complete'){document.all.selectxx.style.display='none'}" style="background:0;border:0 solid #888888;position:absolute; width:120px; height:17px; z-index:1; left:1px; top: 1px">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class=vtext>
<tr bgcolor=ffffff>
<td align=center><font color="#FFFFFF" style="font-size:12px" >--在線<b><%=online%></b>人--</font></td>
</tr>
</table>
</div>
<%
response.write("<form name=tempform method=post action=../mail/mailbox.asp?mailbox=recived target=main></form><form style='display:no' name='msgform' method='post' action='../main/list.asp'> <input type='hidden' name='vtext'> <input type='hidden' name='vname'> <input type='hidden' name='op'></form>")
response.write("<script language=javascript>var xx;function checkmsg(){window.clearTimeout(xx);")
'檢測收到的短消息
Record.open "select * from message where vread='f' and vname='" & Session("id") & "'",oconn,1,1
while not Record.eof
strr="var a=open('../message/message.asp?opFlag=cmdRecived&id=" & Record("id") & "','','width=400,height=200,top=100,left=200');"
response.write(strr)
Record.movenext
wend
Record.close
'檢測新郵件
Dim nu
Record.open "select iread from recived"+Session("id")+" where iread='f'",Session("conn2"),1,1
nu=cint(Record.recordcount)
if Session("num")< nu then
strr=strr+" if(confirm('"+Session("id")+",您的信箱有了新郵件,現(xiàn)在就要查看嗎?')){document.all.tempform.submit()};"
Session("num")=nu
response.write(strr)
end if
Record.Close
Record.open "select * from remind where vstate='未提醒' and vowner='" + Session("id") +"' and vremindtime<='" & fromYear & "-" & fromMonth & "-" & fromDay & " " & fromHour & ":" & fromMinute & "'",oconn,1,3
nu=cint(Record.recordcount)
if nu>0 then
strr=vbcrlf & " alert('" & Session("id") & ",您的一項日程安排時間到了。\n\n時間:" & Record("vtime") & "\n標題:" & Record("vtitle") & "\n內(nèi)容:" & Record("vtext") & "');"
Record("vstate")="<font color=blue>已提醒</font>"
Record.update
response.write(strr)
end if
Record.Close
set Record=nothing
response.write("};xx=window.setTimeout('checkmsg()',1000);</script>")
%>
</body></html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -