欢迎光临
我们一直在努力

XMLHTTP+Javascript+Asp写得聊天室,无刷新实现(四)

建站超值云服务器,限时71元/月

########say.asp##############

<% option explicit

dim f,t,sc,cl,e,w,sj

response.contenttype="text/xml"

f=request.form ("f")

t=request.form ("t")

sc=request.form ("sc")

cl=request.form ("cl")

e=request.form("e")

w=request.form("w")

w="0"

发言时间

sj=gettime()

if request.servervariables("request_method")="post" then

sc="<f>"&trim(f)&"</f><t>"&trim(t)&"</t><e>"&e&"</e><sc>"&trim(sc)&"</sc><cl>"&trim(cl)&"</cl><sj>"&sj&"</sj>"

else

response.end

end if

dim c_info,c_lid,c_ip,u_lid,newlid,u_name,i

application.lock

c_info=application("c_info")

c_lid=application("c_lid")+1

application("c_lid")=c_lid

c_ip=(c_info(0)+6) mod 240

c_info(0)=c_ip

c_info(c_ip)=c_lid

c_info(c_ip+1)=f

c_info(c_ip+2)=t

c_info(c_ip+3)=w

c_info(c_ip+4)=""

c_info(c_ip+5)=sc "<f>"&trim(f)&"</f><t>"&trim(t)&"</t><e>"&e&"</e><sc>"&trim(sc)&"</sc><cl>"&trim(cl)&"</cl><sj>"&sj&"</sj>"

application("c_info")=c_info

application.unlock

u_lid=session("u_lid")

newlid=u_lid

u_name=session("u_name")

&application("c_lid")&"%"&c_info(0)

response.write "<?xml version=""1.0""?><msg>"

for i=c_info(0)+6 to 240 step 6

if (c_info(i)>u_lid) and ((c_info(i+1)=u_name) or (c_info(i+2)=u_name) or (c_info(i+2)="大家") or (c_info(i+3)="0")) then

response.write c_info(i+5)

if (newlid<c_info(i)) then newlid=c_info(i)

end if

next

for i=1 to c_info(0) step 6

if (c_info(i)>u_lid) and ((c_info(i+1)=u_name) or (c_info(i+2)=u_name) or (c_info(i+2)="大家") or (c_info(i+3)="0")) then

response.write c_info(i+5)

if (newlid<c_info(i)) then newlid=c_info(i)

end if

next

response.write "</msg>"

session("u_lid")=newlid

function gettime()

dim y,m,d,h,n,s

y=year(date())

m=month(date())

d=day(date())

h=hour(time())

n=minute(time())

s=second(time()) 当为是一位的 时候在前面加0

if len(m)=1 then m="0" & m

if len(d)=1 then d="0" & d

if len(h)=1 then h="0" & h

if len(n)=1 then n="0" & n

if len(s)=1 then s="0" & s

gettime=y&"/"&m&"/"&d &" " & h&":"& n&":"&s

end function%>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » XMLHTTP+Javascript+Asp写得聊天室,无刷新实现(四)
分享到: 更多 (0)

相关推荐

  • 暂无文章