⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 function.asp

📁 一个最新最时尚的采用ASP开发的基于数据库的网络办公系统
💻 ASP
字号:
<%
'********************************************************
'用户登录成功处理
'*******************************************************
Sub UserEnter(userid,flag)
  dim connEnter
  dim strSQL
    
  if trim(userid)="" then
   exit sub
  end if 
  
'会员登录进来啦  
  if flag="1" then
	  session("UserID")=trim(userid)
	  
	  '整理在线用户
	  'if IsExist(trim(userid))=0 then
	  	Application.Lock 
	  	if trim(application("OfficeOnlineUser"))="" then
	    	Application("OfficeOnlineUser")=trim(userid)
	  	else
	    	Application("OfficeOnlineUser")=Application("OfficeOnlineUser") & "," & trim(userid) 
	  	end if
	  	Application.UnLock
	  'end if
	  
	  '将登录用户加入在线用户表
	  strSQL="insert into OnlineUser(UserId,LastDate) values('" & session("userid") & "',now())"
      conn.execute strsql
      
      '从用户表中提取用户最后登录时间
	  set rec=server.createobject("adodb.recordset")
	  strsql="select * from user where UserId='" & userid & "'"
	  rec.open strsql,conn,1,1
	  
	  if not rec.eof then
	  '用户信息提取
	   session("lastdate")=rec("LastDate")
	   session("UserName")=rec("Name")
	   session("ZZID")=rec("ZZID")
	   session("ZWID")=rec("ZWID")
	   session("Face")=rec("Face")
	   session("Right")=rec("Right")	   
	   rec.close
	   set rec=nothing
	  end if 
	  
	  '将用户表中最后登录时间进行修改
      strSQL="update user set lastdate=now() where UserId='" & userid & "'"  
      conn.execute strsql
      
  end if
END Sub

'******************
'用户退出系统处理
'******************
Sub UserExit(uid)
  dim temp
  dim user
  
  temp=""
  if trim(uid)="" then
   exit sub
  end if 
  
    '*****************************
    user=split(application("OfficeOnlineUser"),",") '获得在线用户列表
    for i=0 to ubound(user) '获得非空的在线用户列表
     if trim(user(i))<>"" and trim(user(i))<>trim(uid) then
	  if trim(temp)="" then
	 	temp=user(i)
	  else
		temp=temp+","+user(i)
      end if
     end if
    next
      Application.Lock 
      application("OfficeOnlineUser")=temp '重新整理在线用户列表
      Application.UnLock 
    '********************      

END Sub

'******************
'在线用户整理
'******************
Sub OnlineUser()
 dim temp,i
 
 temp=""
 
if trim(application("OfficeOnlineUser"))<>"" then

	'提取在线用户数据库,对application("OfficeOnlineUser")赋初始值
	set rec=server.createobject("adodb.recordset")
	strsql="select * from OnlineUser "
	rec.open strsql,conn,1,1

	If rec.RecordCount>0 Then
		Do While Not rec.Eof 
			temp=temp+","+rec("UserId")
		rec.MoveNext
		Loop
		rec.close
	End If
	
end if

  Application.Lock 
  application("OfficeOnlineUser")=temp '重新整理在线用户列表
  Application.UnLock 
  
  '统计在线用户个数
	nowcount=0
	i=0
	user2=split(application("OfficeOnlineUser"),",") '获得在线用户列表
	
	for i=0 to ubound(user2) '获得非空的在线用户列表
 		if trim(user2(i))<>"" then
		nowcount=nowcount+1 '统计在线人数
 	end if
	next

  	Application.Lock 
  	application("OfficeOnlineUserCount")=nowcount '统计在线用户个数
  	Application.UnLock 
  	
End Sub

'******************
'取得组织名称
'******************
Function GetZZName(ZZID)
	
	if trim(ZZID)="" then
   		exit Function
  	end if 
  	
  	'从组织表中提取组织名称
	set rec=server.createobject("adodb.recordset")
	strsql="select Name from Organise where Id=" & ZZID & ""
	rec.open strsql,conn,1,1
  	
  	If Not rec.Eof Then
  		GetZZName=rec("Name")
  	Else
  		GetZZName=""
  	End IF

  	rec.close
End Function

'******************
'取得职务名称
'******************
Function GetZWName(ZWID)
	
	if trim(ZWID)="" then
   		exit Function
  	end if 
  	
  	'从职务表中提取职务名称
	set rec=server.createobject("adodb.recordset")
	strsql="select Name from Business where Id=" & ZWID & ""
	rec.open strsql,conn,1,1
  	
  	If Not rec.Eof Then
  		GetZWName=rec("Name")
  	Else
  		GetZWName=""
  	End IF

  	rec.close
End Function

'******************
'取得用户姓名
'******************
Function GetUserName(UserId)
	
	if trim(UserId)="" then
   		exit Function
  	end if 
  	
  	'从员工表中提取用户姓名
	set rec=server.createobject("adodb.recordset")
	strsql="select Name from User where UserId='" & UserId & "'"
	rec.open strsql,conn,1,1
  	
  	If Not rec.Eof Then
  		GetUserName=rec("Name")
  	Else
  		GetUserName=""
  	End IF

  	rec.close
End Function

'******************
'取得用户头像值
'******************
Function GetUserFace(UserId)
	
	if trim(UserId)="" then
   		exit Function
  	end if 
  	
  	'从员工表中提取用户姓名
	set rec=server.createobject("adodb.recordset")
	strsql="select Face from User where UserId='" & UserId & "'"
	rec.open strsql,conn,1,1
  	
  	If Not rec.Eof Then
  		GetUserFace=rec("Face")
  	Else
  		GetUserFace=1
  	End IF

  	rec.close
End Function

'******************
'检测即时信息
'******************
Function GetMsgId(UserId)

	set recMsg=server.CreateObject("ADODB.recordset")
	strSQL="select * from Msg where ReadFlag=0 and Receive='" & UserId & "' order by Id asc"
	recMsg.Open strSQL,conn,1,1

	if recMsg.RecordCount>0 then
   		GetMsgId=recMsg("Id")
   		strSQL="update Msg set ReadFlag=1 where Id=" & recMsg("Id") & ""
		conn.execute strsql
	else
   		GetMsgId=0   
	end if
	
	recMsg.close
	set recMsg=nothing

End Function

'******************
'检测用户是否已清除记录
'******************
Sub MsgClear(FromUserId,ToUserId)

	set recMsg=server.CreateObject("ADODB.recordset")
	strSQL="select * from Msg where Send ='"&FromUserId&"' and Receive='" & ToUserId & "' and ReadFlag=1 or Send ='"&ToUserId&"' and Receive='" & FromUserId & "' and ReadFlag=1 order by Id desc"
	recMsg.Open strSQL,conn,1,1
	
	If Not recMsg.Eof Then
		Do While Not recMsg.eof
		
			if recMsg("ClearFlag")="0" then
		   		strSQL="update Msg set ClearFlag='"&FromUserId&"' where Id=" & recMsg("Id") & ""
				conn.execute strsql
			elseif recMsg("ClearFlag")<>"0" then 
		   		strSQL="Delete From Msg  where Id=" & recMsg("Id") & ""
				conn.execute strsql
			end if
		recMsg.MoveNext
		Loop
		recMsg.close
		set recMsg=nothing
	End If

End Sub

'******************
'检测用户帐号是否已经开通或被锁定
'******************
Function CheckUserIdBegin(Uid)

	set rsUser=server.CreateObject("ADODB.recordset")
	strSQL="select Flag from User where UserId='"&Uid&"'"
	rsUser.Open strSQL,conn,1,1
	
	CheckUserIdBegin=rsUser("Flag")
   	rsUser.Close
 
End Function

'******************
'检测用户是否已设置快捷方式
'******************
Function CheckUserIdQuick(Uid)

	set rsQuick=server.CreateObject("ADODB.recordset")
	strSQL="select * from QuickSelect where UserId='"&Uid&"'"
	rsQuick.Open strSQL,conn,1,1
	
	If Not rsQuick.eof Then
		CheckUserIdQuick=1
	Else
		CheckUserIdQuick=0
	End If
   	rsQuick.Close
 
End Function

'******************
'从快捷方式列表中提取快捷方式字符串及相应位置的值
'******************	
Function GetUserIdQuick(Uid,Position)

	set rsQuick=server.CreateObject("ADODB.recordset")
	strSQL="select * from QuickSelect where UserId='"&Uid&"'"
	rsQuick.Open strSQL,conn,1,1
	
	If Not rsQuick.eof Then
		GetUserIdQuick=Mid(rsQuick("QuickList"),Position,1)
	ELse
		GetUserIdQuick=0
	End If
	rsQuick.close
	
End Function
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -