writepost1.asp

来自「绿叶oa系统办公自动化 2008.工作日志管理,文件管理」· ASP 代码 · 共 284 行

ASP
284
字号
<%server.ScriptTimeout=500%>
<%on error resume next%>
<%  
Response.ExpiresAbsolute=now()-1
Response.CacheControl="no-cache"
%> 
<!--#include file="../../Connections/oavbsconn.asp" -->
<%on error resume next
if request.form("content")="" or len(request.form("content"))>65535then 
	  Response.Write("<script>alert(""您输入的数据不符合要求,过多或没有!"");location=""javascript:history.back()"";</script>")  
	  Response.End
  end if
%>
<%sendto=request("sendto")%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="../../index.asp"
MM_grantAccess=false
If Session("userssdfgfhtrh") <> "" Then
  If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
         (InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
    MM_grantAccess = true
  End If
End If
If Not MM_grantAccess Then
  MM_qsChar = "?"
  If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
  MM_referrer = Request.ServerVariables("URL")
  if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
  MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
  Response.Redirect(MM_authFailedURL)
End If
%>
<!--#include file="../../Connections/ifr/ifrasp.asp" -->
<% if Request.Form("city")=Session("names") then%>
<script language="javascript">

<!--
alert("很抱歉,你不能给自己发送短消息!");history.back()
-->

</script>
<%
response.end 
end if%>



<% if Request.Form("city")="对所有人群发"then%>

<% if Session("levels")="999" then%>
<script language="javascript">

<!--
alert("很抱歉,您无群发消息权限!");history.back()
-->

</script>
<%response.end()%>
<%end if%>

<%
Dim users
Dim users_numRows
Set users = Server.CreateObject("ADODB.Recordset")
users.ActiveConnection = MM_oavbsconn_STRING
users.Source = "SELECT *  FROM usertertggbng  where usersdsfg56<>'请选择接收对象' or usersdsfg56<>'对所有人群发'"
users.CursorType = 0
users.CursorLocation = 2
users.LockType = 1
users.Open()
users_numRows = 0
%>
<%
'  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

Dim users_total
Dim users_first
Dim users_last

' set the record count
users_total = users.RecordCount

' set the number of rows displayed on this page
If (users_numRows < 0) Then
  users_numRows = users_total
Elseif (users_numRows = 0) Then
  users_numRows = 1
End If

' set the first and last displayed record
users_first = 1
users_last  = users_first + users_numRows - 1

' if we have the correct record count, check the other stats
If (users_total <> -1) Then
  If (users_first > users_total) Then
    users_first = users_total
  End If
  If (users_last > users_total) Then
    users_last = users_total
  End If
  If (users_numRows > users_total) Then
    users_numRows = users_total
  End If
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them

If (users_total = -1) Then

  ' count the total records by iterating through the recordset
  users_total=0
  While (Not users.EOF)
    users_total = users_total + 1
    users.MoveNext
  Wend

  ' reset the cursor to the beginning
  If (users.CursorType > 0) Then
    users.MoveFirst
  Else
    users.Requery
  End If

  ' set the number of rows displayed on this page
  If (users_numRows < 0 Or users_numRows > users_total) Then
    users_numRows = users_total
  End If

  ' set the first and last displayed record
  users_first = 1
  users_last = users_first + users_numRows - 1
  
  If (users_first > users_total) Then
    users_first = users_total
  End If
  If (users_last > users_total) Then
    users_last = users_total
  End If

End If
%>
<%
 for i =1 to users_total

Dim Recordset22
Dim Recordset22_numRows

Set Recordset22 = Server.CreateObject("ADODB.Recordset")
Recordset22.ActiveConnection = MM_oavbsconn_STRING
Recordset22.Source = "SELECT * FROM infoall"
Recordset22.CursorType = 0
Recordset22.CursorLocation = 3
Recordset22.LockType = 3
Recordset22.Open()
Recordset22.addnew
Recordset22("sms接收部门")=users("部门")
Recordset22("标题")=request.form("标题")
Recordset22("内容")=request.form("content")
'Recordset2("接收人姓名")=Session("smmsgetnames")
Recordset22("接收人姓名")=users("names")
Recordset22("发送人姓名")=request.form("发送人姓名")
Recordset22("发送人帐号")=request.form("发送人帐号")
Recordset22("入库日期")=request.form("datas")
Recordset22("信息属性")=request.form("信息属性")
Recordset22("sms发送人level")=Session("levels")
Recordset22("发送人部门")=session("bumen")
Recordset22("sms是否为群发")="是"
Recordset22.update
Recordset22_numRows = 0
users.movenext
next
%>
<%else%>
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.Form("接收人帐号") <> "") Then 
  Recordset1__MMColParam = Request.Form("接收人帐号")
End If
%>
<%
Dim Recordset1__MMColParam1
Recordset1__MMColParam1 = "1"
If (Request.Form("接收人帐号") =Session("userssdfgfhtrh") )Then 
 response.Redirect("writefail.asp")
End  if
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_oavbsconn_STRING
Recordset1.Source = "SELECT * FROM usertertggbng WHERE usersdsfg56 = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>

<% if not Recordset1.eof or not Recordset1.bof then 
Session("smmsgetnames")=Recordset1("names")
%>
<%end if%>
<%
	dim mysendto
		mysendto=split(sendto,"|",-1,1)
		for each sendtoinf in mysendto
			userdeptpoint=InStr(sendtoinf,":")
			addflag=false
			if userdeptpoint>0 then
				sendtoinflen=len(sendtoinf)
				recipientusername=right(sendtoinf,sendtoinflen-userdeptpoint)
				recipientuserdept=left(sendtoinf,userdeptpoint-1)
				if recipientusername="所有人" then
					recipientusername="所有人"
					addflag=true
				elseif recipientusername<>"所有人" and instr(sendto,"|"&recipientuserdept&":所有人")<=0 then
					usernamepoint=Instr(recipientusername,"(")
					usernamelen=len(recipientusername)
					recipientusername=left(recipientusername,usernamelen-1)
					recipientusername=right(recipientusername,usernamelen-1-usernamepoint)
					addflag=true
				end if
'next				
Dim Recordset2
Dim Recordset2_numRows
Set Recordset2 = Server.CreateObject("ADODB.Recordset")
Recordset2.ActiveConnection = MM_oavbsconn_STRING
Recordset2.Source = "SELECT * FROM infoall"
Recordset2.CursorType = 0
Recordset2.CursorLocation = 3
Recordset2.LockType = 3
Recordset2.Open()
Recordset2.addnew
Recordset2("sms接收部门")=request.form("bumen")
Recordset2("标题")=request.form("标题")
Recordset2("内容")=request.form("content")
Recordset2("接收人姓名")=recipientusername

'Recordset2("接收人姓名")=request.form("city")

Recordset2("发送人姓名")=request.form("发送人姓名")
Recordset2("发送人帐号")=request.form("发送人帐号")
Recordset2("入库日期")=request.form("datas")
Recordset2("信息属性")=request.form("信息属性")
Recordset2("发送人部门")=session("bumen")
Recordset2("sms发送人level")=Session("levels")
Recordset2("sms是否为群发")="否"
Recordset2.update
Recordset2_numRows = 0


%>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
</head>
<body>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
<%
users.Close()
Set users = Nothing
%>
<%
Session.Contents.Remove("smmsgetnames")
%>
<%end if%>

<%=sendto%>
<%=recipientusername%>

⌨️ 快捷键说明

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