script language="vbscript" runat="server">
sub Application_Onstart '对当前在线人数及访问总量的初始化.
Application("online")=0
Application("counter")=0
End Sub
Sub session_Onstart
session.timeout=5 '设置网页到期时间为5分钟
application.lock
application("online")=application("online")+1
application("counter")=application("counter")+1
application.unlock
End Sub
Sub session_OnEnd
Application.lock
Application("online")=Application("online")-1
Application.unlock
End Sub
/script>
%
'增加当前人数限制处理,提示学员,并发送邮件
'参数说明
'Subject : 邮件标题
'MailAddress : 发件服务器的地址,如smtp.163.com
'Email : 收件人邮件地址
'Sender : 发件人姓名
'Content : 邮件内容
'Fromer : 发件人的邮件地址
Sub SendAction(subject, email, sender, content)
Set JMail = Server.CreateObject("JMail.Message")
JMail.Charset = "gb2312" ' 邮件字符集,默认为"US-ASCII"
JMail.From = strMailUser ' 发送者地址
JMail.FromName = sender' 发送者姓名
JMail.Subject =subject
JMail.MailServerUserName = strMailUser' 身份验证的用户名
JMail.MailServerPassword = strMailPass ' 身份验证的密码
JMail.Priority = 3'发送邮件类型 1为特级 3为普通
JMail.AddRecipient(email)
JMail.Body = content
JMail.Send(strMailAddress)
End Sub
Dim title,strEmail,strMailAdress,strSender,strContent
Dim strMailAddress,strMailPass,strMailUser,JMail
if application("online")>=1 then
'调用此Sub的例子
title = Request("title")
strContent = "您好,当前在线人数为"application("online")
strSender = Request("Name") '发信人姓名
strEmail = "a375267603@163.com" '收信人邮箱,可以改为 其它的邮箱
strMailAddress = "mail.cdce.cn" '发件服务器地址 例:smtp.163.com(为163服务器地址)
strMailUser = "zenghai@cdce.cn" '发件人用户名
strMailPass = "8888" '发件账户密码
Call SendAction (title,strEmail,strSender,strContent)
strShowMessage = "模块名称:verifyStudent[超出人数限制]|详细信息: 当前登录考试系统的人数已经超出服务器的限制【" application ("online") "】,请您稍后再登录!"
end if
%>