common.asp 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179
  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
  2. <%
  3. Response.Buffer = True
  4. Response.ExpiresAbsolute = Now() - 1
  5. Response.Expires = 0
  6. Response.CacheControl = "no-cache"
  7. Response.AddHeader "Pragma", "No-Cache"
  8. Server.ScriptTimeOut = 1800
  9. %>
  10. <!--#include file="conn.asp"-->
  11. <%
  12. '版本号
  13. Const sysVersion = "2.9.3"
  14. '页面标题
  15. Const systemPageTitle = "isP-CMS中央管理平台"
  16. '打开关闭系统验证码
  17. Const useSiteManageCode = false
  18. '系统验证码
  19. Const SiteManageCode = "ssss"
  20. '打开关闭随机验证码
  21. Const useCheckCode = false
  22. '系统开始日期,关系到日志查询的开始日期
  23. Const startdate = "2010-10-22"
  24. '页面刷新频率,单位ms
  25. Const refreshRate = 10000
  26. '打开关闭 菜单管理 和 设备管理
  27. Const showAdmin = false
  28. '打开关闭 用户管理
  29. Const showUserAdmin = false
  30. '打开关闭用户日志,开启此项须确保数据库中有t_user_log表存在
  31. Const useUserLog = false
  32. '日志报表选项=============================================
  33. '是否允许多项选择
  34. Const multiple = false
  35. '允许多项选择时限制同时选择数量
  36. Const reportNum = 3
  37. '选择日期限制
  38. Const dateLimit = 5
  39. '默认是否开启报警音
  40. Const openSound = true
  41. '是否开启短信查询
  42. Const allowSmsSearch = true
  43. '是否开启电话查询
  44. Const allowTelSearch = true
  45. '是否开启Email查询
  46. Const allowEmailSearch = false
  47. '是否打开历史记录查询
  48. Const allowHistoryDataSearch = false
  49. Dim Action, ComeUrl
  50. Dim FoundErr, ErrMsg
  51. Dim strFiles, tUsed
  52. dim strInstallDir
  53. Dim regEx, Match, Match2, Matches, Matches2
  54. Set regEx = New RegExp
  55. regEx.IgnoreCase = True
  56. regEx.Global = True
  57. regEx.MultiLine = True
  58. ComeUrl = FilterJs(Trim(Request("ComeUrl")))
  59. If ComeUrl = "" Then
  60. ComeUrl = FilterJs(Trim(Request.ServerVariables("HTTP_REFERER")))
  61. End If
  62. Action = ReplaceBadChar(Trim(Request("Action")))
  63. Dim DatePart_D, DatePart_Y, DatePart_M, DatePart_W, DatePart_H, DatePart_Now
  64. DatePart_D = "'d'"
  65. DatePart_Y = "'yyyy'"
  66. DatePart_M = "'m'"
  67. DatePart_W = "'ww'"
  68. DatePart_H = "'h'"
  69. DatePart_Now = "Now()"
  70. Dim FileName, strFileName, MaxPerPage, CurrentPage, totalPut
  71. Dim SearchType, strField, Keyword
  72. If Request("page") <> "" Then
  73. CurrentPage = oCLng(Request("page"))
  74. Else
  75. CurrentPage = 1
  76. End If
  77. If request("MaxPerPage")<>"" and IsNumeric(request("MaxPerPage")) then
  78. MaxPerPage = Fix(CDbl(request("MaxPerPage")))
  79. else
  80. MaxPerPage = 20
  81. end if
  82. Call OpenConn
  83. Dim UserTrueIP
  84. UserTrueIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
  85. If UserTrueIP = "" Then UserTrueIP = Request.ServerVariables("REMOTE_ADDR")
  86. UserTrueIP = ReplaceBadChar(UserTrueIP)
  87. Function GetRndPassword(PasswordLen)
  88. Dim Ran, i, strPassword
  89. strPassword = ""
  90. For i = 1 To PasswordLen
  91. Randomize
  92. Ran = CInt(Rnd * 2)
  93. Randomize
  94. If Ran = 0 Then
  95. Ran = CInt(Rnd * 25) + 97
  96. strPassword = strPassword & UCase(Chr(Ran))
  97. ElseIf Ran = 1 Then
  98. Ran = CInt(Rnd * 9)
  99. strPassword = strPassword & Ran
  100. ElseIf Ran = 2 Then
  101. Ran = CInt(Rnd * 25) + 97
  102. strPassword = strPassword & Chr(Ran)
  103. End If
  104. Next
  105. GetRndPassword = strPassword
  106. End Function
  107. Function CheckBadChar(strChar)
  108. Dim strBadChar, arrBadChar, i
  109. strBadChar = "@@,+,',%,^,&,?,(,),<,>,[,],{,},/,\,;,:," & Chr(34) & ",--"
  110. arrBadChar = Split(strBadChar, ",")
  111. If strChar = "" Then
  112. CheckBadChar = False
  113. Else
  114. For i = 0 To UBound(arrBadChar)
  115. If InStr(strChar, arrBadChar(i)) > 0 Then
  116. CheckBadChar = False
  117. Exit Function
  118. End If
  119. Next
  120. End If
  121. CheckBadChar = True
  122. End Function
  123. Function ReplaceBadChar(strChar)
  124. If strChar = "" Or IsNull(strChar) Then
  125. ReplaceBadChar = ""
  126. Exit Function
  127. End If
  128. Dim strBadChar, arrBadChar, tempChar, i
  129. strBadChar = "+,',%,^,&,?,(,),<,>,[,],{,},/,\,;,:," & Chr(34) & "," & Chr(0) & ",--"
  130. arrBadChar = Split(strBadChar, ",")
  131. tempChar = strChar
  132. For i = 0 To UBound(arrBadChar)
  133. tempChar = Replace(tempChar, arrBadChar(i), "")
  134. Next
  135. tempChar = Replace(tempChar, "@@", "@")
  136. ReplaceBadChar = tempChar
  137. End Function
  138. Dim ScriptName
  139. ScriptName = Trim(Request.ServerVariables("SCRIPT_NAME"))
  140. UserTrueIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
  141. If UserTrueIP = "" Then UserTrueIP = Request.ServerVariables("REMOTE_ADDR")
  142. UserTrueIP = ReplaceBadChar(UserTrueIP)
  143. Function GetScriptName()
  144. Dim ScriptName
  145. ScriptName = Trim(Request.ServerVariables("SCRIPT_NAME"))
  146. If InStr(ScriptName, "?") > 0 Then
  147. ScriptName = Left(ScriptName, InStr(ScriptName, "?"))
  148. End If
  149. GetScriptName = ScriptName
  150. End Function
  151. Function GetPostString()
  152. Dim PostString, PostItem
  153. PostString = ""
  154. If Request.Form <> "" Then
  155. PostString = PostString & "Request.Form"
  156. For Each PostItem In Request.Form
  157. PostString = PostString & PostItem & "=" & Request.Form(PostItem) & "&"
  158. Next
  159. If Right(PostString, 1) = "&" Then PostString = Left(PostString, Len(PostString) - 1)
  160. End If
  161. If Request.QueryString <> "" Then
  162. If PostString <> "" Then PostString = PostString & vbCrLf
  163. PostString = PostString & "Request.QueryString"
  164. For Each PostItem In Request.QueryString
  165. PostString = PostString & PostItem & "=" & Request.QueryString(PostItem) & "&"
  166. Next
  167. If Right(PostString, 1) = "&" Then PostString = Left(PostString, Len(PostString) - 1)
  168. End If
  169. GetPostString = PostString
  170. End Function
  171. Function oCLng(ByVal str1)
  172. If IsNumeric(str1) Then
  173. oCLng = Fix(CDbl(str1))
  174. Else
  175. oCLng = 0
  176. End If
  177. End Function
  178. Public Sub ShowJS_Main(ItemName)
  179. Response.Write "<SCRIPT language=javascript>" & vbCrLf
  180. Response.Write "function unselectall(){" & vbCrLf
  181. Response.Write " if(document.myform.chkAll.checked){" & vbCrLf
  182. Response.Write " document.myform.chkAll.checked = document.myform.chkAll.checked&0;" & vbCrLf
  183. Response.Write " }" & vbCrLf
  184. Response.Write "}" & vbCrLf
  185. Response.Write "function CheckAll(form){" & vbCrLf
  186. Response.Write " for (var i=0;i<form.elements.length;i++){" & vbCrLf
  187. Response.Write " var e = form.elements[i];" & vbCrLf
  188. Response.Write " if (e.Name != 'chkAll'&&e.disabled==false)" & vbCrLf
  189. Response.Write " e.checked = form.chkAll.checked;" & vbCrLf
  190. Response.Write " }" & vbCrLf
  191. Response.Write " }" & vbCrLf
  192. Response.Write "function ConfirmDel(){" & vbCrLf
  193. Response.Write " if(document.myform.Action.value=='Del'){" & vbCrLf
  194. Response.Write " if(confirm('&#x786E;&#x5B9A;&#x8981;&#x5220;&#x9664;&#x9009;&#x4E2D;&#x7684;" & ItemName & "&#x5417;&#xFF1F;'))" & vbCrLf
  195. Response.Write " return true;" & vbCrLf
  196. Response.Write " else" & vbCrLf
  197. Response.Write " return false;" & vbCrLf
  198. Response.Write " }" & vbCrLf
  199. Response.Write "}" & vbCrLf
  200. Response.Write "</SCRIPT>" & vbCrLf
  201. End Sub
  202. Function oHTMLEncode(ByVal fString)
  203. If IsNull(fString) Or Trim(fString) = "" Then
  204. oHTMLEncode = ""
  205. Exit Function
  206. End If
  207. fString = Replace(fString, ">", "&gt;")
  208. fString = Replace(fString, "<", "&lt;")
  209. fString = Replace(fString, Chr(32), "&nbsp;")
  210. fString = Replace(fString, Chr(9), "&nbsp;")
  211. fString = Replace(fString, Chr(34), "&quot;")
  212. fString = Replace(fString, Chr(39), "&#39;")
  213. fString = Replace(fString, Chr(13), "")
  214. fString = Replace(fString, Chr(10) & Chr(10), "</P><P>")
  215. fString = Replace(fString, Chr(10), "<BR>")
  216. oHTMLEncode = fString
  217. End Function
  218. Function ShowPage(sfilename, totalnumber, MaxPerPage, CurrentPage, ShowTotal, ShowAllPages, strUnit, ShowMaxPerPage)
  219. Dim TotalPage, strTemp, strUrl, i
  220. If totalnumber = 0 Or MaxPerPage = 0 Or IsNull(MaxPerPage) Then
  221. ShowPage = ""
  222. Exit Function
  223. End If
  224. If totalnumber Mod MaxPerPage = 0 Then
  225. TotalPage = totalnumber \ MaxPerPage
  226. Else
  227. TotalPage = totalnumber \ MaxPerPage + 1
  228. End If
  229. If CurrentPage > TotalPage Then CurrentPage = TotalPage
  230. strTemp = ""
  231. If ShowTotal = True Then
  232. strTemp = strTemp & "&#x5171; <b>" & totalnumber & "</b> " & strUnit & "&nbsp;&nbsp;&nbsp;"
  233. End If
  234. If ShowMaxPerPage = True Then
  235. strUrl = JoinChar(sfilename) & "MaxPerPage=" & MaxPerPage & "&"
  236. Else
  237. strUrl = JoinChar(sfilename)
  238. End If
  239. If CurrentPage = 1 Then
  240. strTemp = strTemp & "&#x9996;&#x9875; | &#x4E0A;&#x4E00;&#x9875; |"
  241. Else
  242. strTemp = strTemp & "<a href='" & strUrl & "page=1'>&#x9996;&#x9875;</a> |"
  243. strTemp = strTemp & " <a href='" & strUrl & "page=" & (CurrentPage - 1) & "'>&#x4E0A;&#x4E00;&#x9875;</a> | "
  244. End If
  245. strTemp = strTemp & " "
  246. If ShowAllPages = True Then
  247. Dim Jmaxpages
  248. If (CurrentPage - 4) <= 0 Or TotalPage < 10 Then
  249. Jmaxpages = 1
  250. Do While (Jmaxpages < 10)
  251. If Jmaxpages = CurrentPage Then
  252. strTemp = strTemp & "<font color=""FF0000"">" & Jmaxpages & "</font> "
  253. Else
  254. If strUrl <> "" Then
  255. strTemp = strTemp & "<a href=""" & strUrl & "page=" & Jmaxpages & """>" & Jmaxpages & "</a> "
  256. End If
  257. End If
  258. If Jmaxpages = TotalPage Then Exit Do
  259. Jmaxpages = Jmaxpages + 1
  260. Loop
  261. ElseIf (CurrentPage + 4) >= TotalPage Then
  262. Jmaxpages = TotalPage - 8
  263. Do While (Jmaxpages <= TotalPage)
  264. If Jmaxpages = CurrentPage Then
  265. strTemp = strTemp & "<font color=""FF0000"">" & Jmaxpages & "</font> "
  266. Else
  267. If strUrl <> "" Then
  268. strTemp = strTemp & "<a href=""" & strUrl & "page=" & Jmaxpages & """>" & Jmaxpages & "</a> "
  269. End If
  270. End If
  271. Jmaxpages = Jmaxpages + 1
  272. Loop
  273. Else
  274. Jmaxpages = CurrentPage - 4
  275. Do While (Jmaxpages < CurrentPage + 5)
  276. If Jmaxpages = CurrentPage Then
  277. strTemp = strTemp & "<font color=""FF0000"">" & Jmaxpages & "</font> "
  278. Else
  279. If strUrl <> "" Then
  280. strTemp = strTemp & "<a href=""" & strUrl & "page=" & Jmaxpages & """>" & Jmaxpages & "</a> "
  281. End If
  282. End If
  283. Jmaxpages = Jmaxpages + 1
  284. Loop
  285. End If
  286. End If
  287. If CurrentPage >= TotalPage Then
  288. strTemp = strTemp & "| &#x4E0B;&#x4E00;&#x9875; | &#x5C3E;&#x9875;"
  289. Else
  290. strTemp = strTemp & " | <a href='" & strUrl & "page=" & (CurrentPage + 1) & "'>&#x4E0B;&#x4E00;&#x9875;</a> |"
  291. strTemp = strTemp & "<a href='" & strUrl & "page=" & TotalPage & "'> &#x5C3E;&#x9875;</a>"
  292. End If
  293. If ShowMaxPerPage = True Then
  294. strTemp = strTemp & "&nbsp;&nbsp;&nbsp;<Input type='text' name='MaxPerPage' size='3' maxlength='4' value='" & MaxPerPage & "' onKeyPress=""if (event.keyCode==13) window.location='" & JoinChar(sfilename) & "page=" & CurrentPage & "&MaxPerPage=" & "'+this.value;"">" & strUnit & "/&#x9875;"
  295. Else
  296. strTemp = strTemp & "&nbsp;<b>" & MaxPerPage & "</b>" & strUnit & "/&#x9875;"
  297. End If
  298. If ShowAllPages = True Then
  299. strTemp = strTemp & "&nbsp;&nbsp;&#x8F6C;&#x5230;&#x7B2C;<Input type='text' name='page' size='3' maxlength='5' value='" & CurrentPage & "' onKeyPress=""if (event.keyCode==13) window.location='" & strUrl & "page=" & "'+this.value;"">&#x9875;"
  300. End If
  301. ShowPage = strTemp
  302. End Function
  303. Function JoinChar(ByVal strUrl)
  304. If strUrl = "" Then
  305. JoinChar = ""
  306. Exit Function
  307. End If
  308. If InStr(strUrl, "?") < Len(strUrl) Then
  309. If InStr(strUrl, "?") > 1 Then
  310. If InStr(strUrl, "&") < Len(strUrl) Then
  311. JoinChar = strUrl & "&"
  312. Else
  313. JoinChar = strUrl
  314. End If
  315. Else
  316. JoinChar = strUrl & "?"
  317. End If
  318. Else
  319. JoinChar = strUrl
  320. End If
  321. End Function
  322. Sub WriteSuccessMsg(sSuccessMsg, sComeUrl)
  323. Response.Write "<html><head><title>&#x6210;&#x529F;&#x4FE1;&#x606F;</title><meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
  324. Response.Write "<link href='style_admin.css' rel='stylesheet' type='text/css'></head><body><br><br>" & vbCrLf
  325. Response.Write "<table cellpadding=2 cellspacing=1 border=0 width=400 class='border' align=center>" & vbCrLf
  326. Response.Write " <tr align='center' class='title'><td height='22'><strong>&#x606D;&#x559C;&#x4F60;&#xFF01;</strong></td></tr>" & vbCrLf
  327. Response.Write " <tr class='tdbg'><td height='100' valign='top'><br>" & sSuccessMsg & "</td></tr>" & vbCrLf
  328. Response.Write " <tr align='center' class='tdbg'><td>"
  329. If sComeUrl <> "" Then
  330. Response.Write "<a href='" & sComeUrl & "'>&lt;&lt; &#x8FD4;&#x56DE;&#x4E0A;&#x4E00;&#x9875;</a>"
  331. Else
  332. Response.Write "<a href='javascript:window.close();'>&#x3010;&#x5173;&#x95ED;&#x3011;</a>"
  333. End If
  334. Response.Write "</td></tr>" & vbCrLf
  335. Response.Write "</table>" & vbCrLf
  336. Response.Write "</body></html>" & vbCrLf
  337. End Sub
  338. Sub WriteErrMsg(sErrMsg, sComeUrl)
  339. Response.Write "<html><head><title>&#x9519;&#x8BEF;&#x4FE1;&#x606F;</title><meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
  340. Response.Write "<link href='style_main.css' rel='stylesheet' type='text/css'></head><body><br><br>" & vbCrLf
  341. Response.Write "<table cellpadding=2 cellspacing=1 border=0 width=400 class='border' align=center>" & vbCrLf
  342. Response.Write " <tr align='center' class='title'><td height='22'><strong>&#x9519;&#x8BEF;&#x4FE1;&#x606F;</strong></td></tr>" & vbCrLf
  343. Response.Write " <tr class='tdbg'><td height='100' valign='top'><b>&#x4EA7;&#x751F;&#x9519;&#x8BEF;&#x7684;&#x53EF;&#x80FD;&#x539F;&#x56E0;&#xFF1A;</b>" & sErrMsg & "</td></tr>" & vbCrLf
  344. Response.Write " <tr align='center' class='tdbg'><td>"
  345. If sComeUrl <> "" Then
  346. Response.Write "<a href='javascript:history.go(-1)'>&lt;&lt; &#x8FD4;&#x56DE;&#x4E0A;&#x4E00;&#x9875;</a>"
  347. Else
  348. Response.Write "<a href='javascript:window.close();'>&#x3010;&#x5173;&#x95ED;&#x3011;</a>"
  349. End If
  350. Response.Write "</td></tr>" & vbCrLf
  351. Response.Write "</table>" & vbCrLf
  352. Response.Write "</body></html>" & vbCrLf
  353. End Sub
  354. Function IsValidID(Check_ID)
  355. Dim FixID, i
  356. If IsNull(Check_ID) Or Check_ID = "" Then
  357. IsValidID = False
  358. Exit Function
  359. End If
  360. FixID = Replace(Check_ID, "|", "")
  361. FixID = Replace(FixID, ",", "")
  362. FixID = Replace(FixID, "-", "")
  363. FixID = Trim(Replace(FixID, " ", ""))
  364. If FixID = "" Or IsNull(FixID) Then
  365. IsValidID = False
  366. Else
  367. For i = 1 To Len(FixID) Step 100
  368. If Not IsNumeric(Mid(FixID, i, 100)) Then
  369. IsValidID = False
  370. Exit Function
  371. End If
  372. Next
  373. IsValidID = True
  374. End If
  375. End Function
  376. Function FilterJS(ByVal strInput)
  377. If IsNull(strInput) Or Trim(strInput) = "" Then
  378. FilterJS = ""
  379. Exit Function
  380. End If
  381. Dim reContent
  382. ' 替换掉HTML字符实体(Character Entities)名字和分号之间的空白字符,比如:&auml ;替换成&auml;
  383. regEx.Pattern = "(&#*\w+)[\x00-\x20]+;"
  384. strInput = regEx.Replace(strInput, "$1;")
  385. ' 将无分号结束符的数字编码实体规范成带分号的标准形式
  386. regEx.Pattern = "(&#x*[0-9A-F]+);*"
  387. strInput = regEx.Replace(strInput, "$1;")
  388. ' 将&nbsp; &lt; &gt; &amp; &quot;字符实体中的 & 替换成 &amp; 以便在进行HtmlDecode时保留这些字符实体
  389. 'RegEx.Pattern = "&(amp|lt|gt|nbsp|quot);"
  390. 'strInput = RegEx.Replace(strInput, "&amp;$1;")
  391. ' 将HTML字符实体进行解码,以消除编码字符对后续过滤的影响
  392. 'strInput = HtmlDecode(strInput);
  393. ' 将ASCII码表中前32个字符中的非打印字符替换成空字符串,保留 9、10、13、32,它们分别代表 制表符、换行符、回车符和空格。
  394. regEx.Pattern = "[\x00-\x08\x0b-\x0c\x0e-\x19]"
  395. strInput = regEx.Replace(strInput, "")
  396. oldhtmlString = ""
  397. Do While oldhtmlString <> strInput
  398. oldhtmlString = strInput
  399. regEx.Pattern = "(<[^>]+src[\x00-\x20]*=[\x00-\x20]*[^>]*?)&#([^>]*>)" '过虑掉 src 里的 &#
  400. strInput = regEx.Replace(strInput, "$1&amp;#$2")
  401. regEx.Pattern = "(<[^>]+style[\x00-\x20]*=[\x00-\x20]*[^>]*?)&#([^>]*>)" '过虑掉style 里的 &#
  402. strInput = regEx.Replace(strInput, "$1&amp;#$2")
  403. regEx.Pattern = "(<[^>]+style[\x00-\x20]*=[\x00-\x20]*[^>]*?)\\([^>]*>)" '替换掉style中的 "\"
  404. strInput = regEx.Replace(strInput, "$1/$2")
  405. Loop
  406. ' 替换以on和xmlns开头的属性,动易系统的几个JS需要保留
  407. regEx.Pattern = "on(load\s*=\s*""*'*resizepic\(this\)'*""*)"
  408. strInput = regEx.Replace(strInput, "off$1")
  409. regEx.Pattern = "on(mousewheel\s*=\s*""*'*return\s*bbimg\(this\)'*""*)"
  410. strInput = regEx.Replace(strInput, "off$1")
  411. regEx.Pattern = "(<[^>]+[\x00-\x20""'/])(on|xmlns)([^>]*)>"
  412. strInput = regEx.Replace(strInput, "$1pe$3>")
  413. regEx.Pattern = "off(load\s*=\s*""*'*resizepic\(this\)'*""*)"
  414. strInput = regEx.Replace(strInput, "on$1")
  415. regEx.Pattern = "off(mousewheel\s*=\s*""*'*return\s*bbimg\(this\)'*""*)"
  416. strInput = regEx.Replace(strInput, "on$1")
  417. ' 替换javascript
  418. regEx.Pattern = "([a-z]*)[\x00-\x20]*=[\x00-\x20]*([`'""]*)[\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:"
  419. strInput = regEx.Replace(strInput, "$1=$2nojavascript...")
  420. ' 替换vbscript
  421. regEx.Pattern = "([a-z]*)[\x00-\x20]*=[\x00-\x20]*([`'""]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:"
  422. strInput = regEx.Replace(strInput, "$1=$2novbscript...")
  423. '替换style中的注释部分,比如:<div style="xss:expres/*comment*/sion(alert(x))">
  424. regEx.Pattern = "(<[^>]+style[\x00-\x20]*=[\x00-\x20]*[^>]*?)/\*[^>]*\*/([^>]*>)"
  425. strInput = regEx.Replace(strInput, "$1$2")
  426. ' 替换expression
  427. regEx.Pattern = "(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([`'""]*).*[eeE][xxX][ppP][rrR][eeE][ssS][ssS][iiI][ooO][nnN][\x00-\x20]*[\(\(][^>]*>"
  428. strInput = regEx.Replace(strInput, "$1>")
  429. ' 替换behaviour
  430. regEx.Pattern = "(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([`'""]*).*behaviour[^>]*>>"
  431. strInput = regEx.Replace(strInput, "$1>")
  432. ' 替换behavior
  433. regEx.Pattern = "(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([`'""]*).*behavior[^>]*>>"
  434. strInput = regEx.Replace(strInput, "$1>")
  435. ' 替换script
  436. regEx.Pattern = "(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([`'""]*).*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:*[^>]*>"
  437. strInput = regEx.Replace(strInput, "$1>")
  438. ' 替换namespaced elements 不需要
  439. regEx.Pattern = "</*\w+:\w[^>]*>"
  440. strInput = regEx.Replace(strInput, " ")
  441. Dim oldhtmlString
  442. oldhtmlString = ""
  443. Do While oldhtmlString <> strInput
  444. oldhtmlString = strInput
  445. '实行严格过滤
  446. regEx.Pattern = "</*(applet|meta|xml|blink|link|style|script|embed|object|iframe|frame|frameset|ilayer|layer|bgsound|title|base)[^>]*>?"
  447. strInput = regEx.Replace(strInput, " ")
  448. '过滤掉SHTML的Include包含文件漏洞
  449. regEx.Pattern = "<!--\s*#include[^>]*>"
  450. strInput = regEx.Replace(strInput, "noshtml")
  451. 'If FilterLevel > 0 Then
  452. ' '实行严格过滤
  453. ' RegEx.Pattern = "</*(embed|object)[^>]*>"
  454. ' strInput = RegEx.Replace(strInput, "")
  455. 'End If
  456. Loop
  457. FilterJS = strInput
  458. End Function
  459. Private Function IsOptionSelected(Compare1, Compare2)
  460. If Compare1 = Compare2 Then
  461. IsOptionSelected = " selected"
  462. Else
  463. IsOptionSelected = ""
  464. End If
  465. End Function
  466. Function IsObjInstalled(strClassString)
  467. On Error Resume Next
  468. IsObjInstalled = False
  469. Err = 0
  470. Dim xTestObj
  471. Set xTestObj = CreateObject(strClassString)
  472. If Err.Number = 0 Then IsObjInstalled = True
  473. Set xTestObj = Nothing
  474. Err = 0
  475. End Function
  476. Dim ClassID, ClassName, RootID, Depth, ParentID, ParentPath, Child, arrChildID, ClassPicUrl, ItemCount, ItemID
  477. Sub GetClass()
  478. ClassName = ""
  479. ParentID = 0
  480. ParentPath = "0"
  481. Child = 0
  482. arrChildID = ""
  483. If ClassID > 0 Then
  484. Dim tClass
  485. Set tClass = Conn.Execute("select * from Class where ChannelID=" & ChannelID & " and ClassType=1 " & " and ClassID=" & ClassID & "")
  486. If tClass.BOF And tClass.EOF Then
  487. FoundErr = True
  488. ErrMsg = ErrMsg & "<li>找不到指定的区域</li>"
  489. Else
  490. ClassName = tClass("ClassName")
  491. ParentID = tClass("ParentID")
  492. Child = tClass("Child")
  493. arrChildID = tClass("arrChildID")
  494. ClassPicUrl = tClass("ClassPicUrl")
  495. End If
  496. tClass.Close
  497. Set tClass = Nothing
  498. End If
  499. End Sub
  500. Dim ChannelID, ChannelName, ChannelShortName, ChannelItemUnit, ChannelPicUrl, ChannelUrl, UploadDir
  501. Dim ModuleType, ModuleName, SheetName
  502. Dim MaxFileSize
  503. ChannelID = oCLng(Trim(Request("ChannelID")))
  504. Sub GetChannel(tChannelID)
  505. Dim sqlChannel, rsChannel
  506. ModuleType = 0
  507. ChannelItemUnit = ""
  508. ChannelPicUrl = ""
  509. If tChannelID > 0 Then
  510. sqlChannel = "select * from Channel where ChannelID=" & tChannelID
  511. Set rsChannel = Conn.Execute(sqlChannel)
  512. If rsChannel.BOF And rsChannel.EOF Then
  513. FoundErr = True
  514. ErrMsg = ErrMsg & "找不到指定的频道"
  515. Else
  516. If rsChannel("Disabled") = True Then
  517. FoundErr = True
  518. ErrMsg = ErrMsg & "<li>此频道已经被管理员禁用!</li>"
  519. End If
  520. ChannelName = rsChannel("ChannelName")
  521. ChannelPicUrl = rsChannel("ChannelPicUrl")
  522. ChannelShortName = rsChannel("ChannelShortName")
  523. ChannelItemUnit = rsChannel("ChannelItemUnit")
  524. UploadDir = rsChannel("UploadDir")
  525. MaxFileSize = rsChannel("MaxFileSize")
  526. Select Case ChannelID
  527. Case 1
  528. ModuleName = "Article"
  529. SheetName = "article"
  530. Case 2
  531. ModuleName = "Product"
  532. SheetName = "product"
  533. Case 3
  534. ModuleName = "Soft"
  535. SheetName = "soft"
  536. Case 5
  537. ModuleName = "Fragment"
  538. SheetName = "fragment"
  539. Case 6
  540. ModuleName = "User"
  541. SheetName = "user"
  542. Case 7
  543. ModuleName = "GBook"
  544. SheetName = "gbook"
  545. Case 8
  546. ModuleName = "FriendLink"
  547. SheetName = "friendlink"
  548. End Select
  549. End If
  550. rsChannel.Close
  551. Set rsChannel = Nothing
  552. End If
  553. End Sub
  554. Function nohtml(ByVal str)
  555. If IsNull(str) Or Trim(str) = "" Then
  556. nohtml = ""
  557. Exit Function
  558. End If
  559. regEx.Pattern = "(\<.[^\<]*\>)"
  560. str = regEx.Replace(str, "")
  561. regEx.Pattern = "(\<\/[^\<]*\>)"
  562. str = regEx.Replace(str, "")
  563. regEx.Pattern = "\[NextPage(.*?)\]"
  564. str = regEx.Replace(str, "")
  565. str = Replace(str, "'", "")
  566. str = Replace(str, Chr(34), "")
  567. str = Replace(str, vbCrLf, "")
  568. str = Trim(str)
  569. nohtml = str
  570. End Function
  571. Function FoundInArr(strArr, strItem, strSplit)
  572. Dim arrTemp, arrTemp2, i, j
  573. FoundInArr = False
  574. If IsNull(strArr) Or IsNull(strItem) Or Trim(strArr) = "" Or Trim(strItem) = "" Then
  575. Exit Function
  576. End If
  577. If IsNull(strSplit) Or strSplit = "" Then
  578. strSplit = ","
  579. End If
  580. If InStr(Trim(strArr), strSplit) > 0 Then
  581. If InStr(Trim(strItem), strSplit) > 0 Then
  582. arrTemp = Split(strArr, strSplit)
  583. arrTemp2 = Split(strItem, strSplit)
  584. For i = 0 To UBound(arrTemp)
  585. For j = 0 To UBound(arrTemp2)
  586. If LCase(Trim(arrTemp2(j))) <> "" And LCase(Trim(arrTemp(i))) <> "" And LCase(Trim(arrTemp2(j))) = LCase(Trim(arrTemp(i))) Then
  587. FoundInArr = True
  588. Exit Function
  589. End If
  590. Next
  591. Next
  592. Else
  593. arrTemp = Split(strArr, strSplit)
  594. For i = 0 To UBound(arrTemp)
  595. If LCase(Trim(arrTemp(i))) = LCase(Trim(strItem)) Then
  596. FoundInArr = True
  597. Exit Function
  598. End If
  599. Next
  600. End If
  601. Else
  602. If LCase(Trim(strArr)) = LCase(Trim(strItem)) Then
  603. FoundInArr = True
  604. End If
  605. End If
  606. End Function
  607. Public Function RadioValue(compvalue, showvalue)
  608. If compvalue = showvalue Then
  609. RadioValue = "value='" & showvalue & "' checked"
  610. Else
  611. RadioValue = "value='" & showvalue & "'"
  612. End If
  613. End Function
  614. '**************************************************
  615. '函数名:XmlText
  616. '作 用:从语言包中读取指定节点的值
  617. '参 数:iBigNode ---- 大节点
  618. ' iSmallNode ---- 小节点
  619. ' DefChar ---- 默认值
  620. '返回值:语言包中指定节点的值
  621. '**************************************************
  622. Function XmlText(ByVal iBigNode, ByVal iSmallNode, ByVal DefChar)
  623. Dim LangRoot, LangSub
  624. If IsNull(iBigNode) Or IsNull(iSmallNode) Then
  625. XmlText = DefChar
  626. Else
  627. Set LangRoot = XmlDoc.getElementsByTagName(iBigNode)
  628. If LangRoot.Length = 0 Then
  629. XmlText = DefChar
  630. Else
  631. Set LangSub = LangRoot(0).getElementsByTagName(iSmallNode)
  632. If LangSub.Length = 0 Then
  633. XmlText = DefChar
  634. Else
  635. XmlText = LangSub(0).text
  636. End If
  637. End If
  638. Set LangRoot = Nothing
  639. End If
  640. End Function
  641. '===============================================================================================================================================
  642. '=====报警系列===================================================================================================================================
  643. '===============================================================================================================================================
  644. '空调自启动--------------------------------------------------------------------------------------------------------------------------------------
  645. function status_AirSinceTheStart(varname)
  646. if checkAllowedAlarm(varname) = 0 then exit function
  647. dim strAirSinceTheStart
  648. if sqlSumLog(varname) = 10000 then
  649. strAirSinceTheStart = "<img src='images/statusOffline.png' />"
  650. elseif sqlVar(varname) = 10000 then
  651. strAirSinceTheStart = "<img src='images/statusOffline.png' />"
  652. else
  653. strAirSinceTheStart = "<img src='images/statusNormal.png' />"
  654. if sqlSumLog(varname) <> sqlVar(varname) then strAirSinceTheStart = "<img src='images/statusAlarm.gif' />"
  655. end if
  656. status_AirSinceTheStart = strAirSinceTheStart
  657. end function
  658. function status_AirSinceTheStart_noCheck(varname)
  659. dim strAirSinceTheStart
  660. if sqlSumLog(varname) = 10000 then
  661. strAirSinceTheStart = "<img src='images/statusOffline.png' />"
  662. elseif sqlVar(varname) = 10000 then
  663. strAirSinceTheStart = "<img src='images/statusOffline.png' />"
  664. else
  665. strAirSinceTheStart = "<img src='images/statusNormal.png' />"
  666. if sqlSumLog(varname) <> sqlVar(varname) then strAirSinceTheStart = "<img src='images/statusAlarm.gif' />"
  667. end if
  668. status_AirSinceTheStart_noCheck = strAirSinceTheStart
  669. end function
  670. '---------------------------------------------------------------------------------------------------------------------------------
  671. '漏水,单变量
  672. function status_Leak(var1,offLine,normal,alarm)
  673. if checkAllowedAlarm(var1) = 0 then exit function
  674. dim strLeak
  675. if sqlSumLog(var1) = 10000 then
  676. strLeak = "<img src='images/"&offLine&".gif' />"
  677. elseif sqlVar(var1) = 10000 then
  678. strLeak = "<img src='images/"&offLine&".gif' />"
  679. else
  680. strLeak = "<img src='images/"&normal&".gif' />"
  681. if sqlSumLog(var1) <> sqlVar(var1) then strLeak = "<img src='images/"&alarm&".gif' />"
  682. end if
  683. status_Leak = strLeak
  684. end function
  685. '漏水,不定位,双参数
  686. function status_Leak2(var1,var2,offLine,normal,alarm)
  687. if checkAllowedAlarm(var1) = 0 and checkAllowedAlarm(var1) = 0 then exit function
  688. dim strLeak
  689. if sqlSumLog(var1) = 10000 or sqlSumLog(var2) = 10000 then
  690. strLeak = "<img src='images/"&offLine&".gif' />"
  691. else
  692. strLeak = "<img src='images/"&normal&".gif' />"
  693. if sqlSumLog(var1) <> sqlVar(var1) or sqlSumLog(var2) <> sqlVar(var2) then strLeak = "<img src='images/"&alarm&".gif' />"
  694. end if
  695. status_Leak2 = strLeak
  696. end function
  697. '------------------------------------------------------------------------------------------------------------------------------------------------
  698. '温度
  699. function status_Temp(varconn,varname)
  700. if checkAllowedAlarm(varconn) = 0 and checkAllowedAlarm(varname) = 0 then exit function
  701. dim strTemp
  702. if sqlSumLog(varconn) = 10000 or sqlSumLog(varconn) <> sqlVar(varconn) then
  703. strTemp = "<span style='color:gray;'>-</span>"
  704. elseif sqlSumLog(varname) = 10000 then
  705. strTemp = "-"
  706. else
  707. if sqlVarUp(varname) = 0 and sqlVarLow(varname) = 0 then
  708. strTemp = FormatNumber(sqlSumLog(varname),1,-1)
  709. else
  710. if sqlSumLog(varname) < sqlVarLow(varname) then
  711. strTemp = "<span style='color:red;background:url(images/alertBg.gif)'>" & FormatNumber(sqlSumLog(varname),1,-1) & "</span>"
  712. elseif sqlSumLog(varname) > sqlVarUp(varname) then
  713. strTemp = "<span style='color:red;background:url(images/alertBg.gif)'>" & FormatNumber(sqlSumLog(varname),1,-1) & "</span>"
  714. else
  715. strTemp = FormatNumber(sqlSumLog(varname),1,-1)
  716. end if
  717. end if
  718. end if
  719. status_Temp = strTemp ' & " ℃"
  720. end function
  721. '湿度
  722. function status_rsHumidity(varconn,varname)
  723. if checkAllowedAlarm(varconn) = 0 and checkAllowedAlarm(varname) = 0 then exit function
  724. dim strHumidity
  725. if sqlSumLog(varconn) = 10000 or sqlSumLog(varconn) <> sqlVar(varconn) then
  726. strHumidity = "<span style='color:gray;'>-</span>"
  727. elseif sqlSumLog(varname) = 10000 then
  728. strHumidity = "-"
  729. else
  730. if sqlVarUp(varname) = 0 and sqlVarLow(varname) = 0 then
  731. strHumidity = FormatNumber(sqlSumLog(varname),1,-1)
  732. else
  733. if sqlSumLog(varname) < sqlVarLow(varname) then
  734. strHumidity = "<span style='color:red;background:url(images/alertBg.gif)'>" & FormatNumber(sqlSumLog(varname),1,-1) & "</span>"
  735. elseif sqlSumLog(varname) > sqlVarUp(varname) then
  736. strHumidity = "<span style='color:red;background:url(images/alertBg.gif)'>" & FormatNumber(sqlSumLog(varname),1,-1) & "</span>"
  737. else
  738. strHumidity = FormatNumber(sqlSumLog(varname),1,-1)
  739. end if
  740. end if
  741. end if
  742. status_rsHumidity = strHumidity ' & "<span style='margin-left:-3px;'> %</span>"
  743. end function
  744. '-------------------------------------------------------------------------------------------------------------------------------------------------------
  745. 'CRAC状态
  746. function statusCRAC()
  747. dim strstatusCRAC, arrVar, i
  748. if sqlSumLog("Air_3") = 10000 then '无数据显示离线
  749. strstatusCRAC = "<img src='images/statusOffline.gif'>"
  750. elseif sqlSumLog("Air_3") <> sqlVar("Air_3") then '有数据与normalstate不等显示离线
  751. strstatusCRAC = "<img src='images/statusOffline.gif'>"
  752. else
  753. strstatusCRAC = "<img src='images/statusNormal.gif'>" '否则显示正常
  754. '判断是否有报警
  755. arrVar = Array("Air_9","Air_10","Air_34","Air_35","Air_11","Air_12","Air_13","Air_14","Air_15","Air_16","Air_17","Air_18","Air_23","Air_24","Air_CommStatus")
  756. for i = 0 to ubound(arrVar)
  757. if checkAllowedAlarm(arrVar(i)) = 1 and sqlSumLog(arrVar(i)) <> 10000 and sqlSumLog(arrVar(i)) <> sqlVar(arrVar(i)) then strstatusCRAC = "<img src='images/statusAlarm.gif'>"
  758. next
  759. end if
  760. statusCRAC = strstatusCRAC
  761. end function
  762. 'CRAC-EmersonCM-市委1.1
  763. function statusCRACEmersonCM(statusOpen,statusCom,var1,var2,var3,var4,var5,var6,var7,var8,var9)
  764. dim strstatusCRAC, arrVar, i
  765. if sqlSumLog(statusOpen) = 10000 then '无数据显示离线
  766. strstatusCRAC = "<img src='images/statusOffline.gif'>"
  767. elseif sqlSumLog(statusOpen) <> sqlVar(statusOpen) then '有数据与normalstate不等显示离线
  768. strstatusCRAC = "<img src='images/statusOffline.gif'>"
  769. elseif sqlSumLog(statusCom) = 10000 then '无数据显示离线
  770. strstatusCRAC = "<img src='images/statusOffline.gif'>"
  771. elseif sqlSumLog(statusCom) <> sqlVar(statusCom) then '有数据与normalstate不等显示离线
  772. strstatusCRAC = "<img src='images/statusOffline.gif'>"
  773. else
  774. strstatusCRAC = "<img src='images/statusNormal.gif'>" '否则显示正常
  775. '判断是否有报警
  776. arrVar = Array(var1,var2,var3,var4,var5,var6,var7,var8,var9)
  777. for i = 0 to ubound(arrVar)
  778. if checkAllowedAlarm(arrVar(i)) = 1 and sqlSumLog(arrVar(i)) <> 10000 and sqlSumLog(arrVar(i)) <> sqlVar(arrVar(i)) then strstatusCRAC = "<img src='images/statusAlarm.gif'>"
  779. next
  780. end if
  781. statusCRACEmersonCM = strstatusCRAC
  782. end function
  783. 'CRAC-EmersonCM-市委3.5
  784. function statusDME30003(statusOpen,statusCom,statusCom2,var1,var2,var3,var4,var5,var6)
  785. dim strstatusCRAC, arrVar, i
  786. if sqlSumLog(statusOpen) = 10000 then '无数据显示离线
  787. strstatusCRAC = "<img src='images/statusOffline.gif'>"
  788. elseif sqlSumLog(statusOpen) <> sqlVar(statusOpen) then '有数据与normalstate不等显示离线
  789. strstatusCRAC = "<img src='images/statusOffline.gif'>"
  790. elseif sqlSumLog(statusCom) = 10000 then '无数据显示离线
  791. strstatusCRAC = "<img src='images/statusOffline.gif'>"
  792. elseif sqlSumLog(statusCom) <> sqlVar(statusCom) then '有数据与normalstate不等显示离线
  793. strstatusCRAC = "<img src='images/statusOffline.gif'>"
  794. elseif sqlSumLog(statusCom2) = 10000 then '无数据显示离线
  795. strstatusCRAC = "<img src='images/statusOffline.gif'>"
  796. elseif sqlSumLog(statusCom2) <> sqlVar(statusCom2) then '有数据与normalstate不等显示离线
  797. strstatusCRAC = "<img src='images/statusOffline.gif'>"
  798. else
  799. strstatusCRAC = "<img src='images/statusNormal.gif'>" '否则显示正常
  800. '判断是否有报警
  801. arrVar = Array(var1,var2,var3,var4,var5,var6)
  802. for i = 0 to ubound(arrVar)
  803. if checkAllowedAlarm(arrVar(i)) = 1 and sqlSumLog(arrVar(i)) <> 10000 and sqlSumLog(arrVar(i)) <> sqlVar(arrVar(i)) then strstatusCRAC = "<img src='images/statusAlarm.gif'>"
  804. next
  805. end if
  806. statusDME30003 = strstatusCRAC
  807. end function
  808. 'DME3000
  809. function statusDME3000(statusOpen,var1,var2,var3,var4,var5,var6)'statusCom,statusCom2,
  810. dim strstatusCRAC, arrVar, i
  811. if statusOpen <> "" and sqlSumLog(statusOpen) = 10000 then '无数据显示离线
  812. strstatusCRAC = "<img src='images/statusOffline.gif'>"
  813. elseif statusOpen <> "" and sqlSumLog(statusOpen) <> sqlVar(statusOpen) then '有数据与normalstate不等显示离线
  814. strstatusCRAC = "<img src='images/statusOffline.gif'>"
  815. ' elseif statusCom <> "" and sqlSumLog(statusCom) = 10000 then '无数据显示离线
  816. ' strstatusCRAC = "<img src='images/statusOffline.gif'>"
  817. ' elseif statusCom <> "" and sqlSumLog(statusCom) <> sqlVar(statusCom) then '有数据与normalstate不等显示离线
  818. ' strstatusCRAC = "<img src='images/statusOffline.gif'>"
  819. ' elseif statusCom2 <> "" and sqlSumLog(statusCom2) = 10000 then '无数据显示离线
  820. ' strstatusCRAC = "<img src='images/statusOffline.gif'>"
  821. ' elseif statusCom2 <> "" and sqlSumLog(statusCom2) <> sqlVar(statusCom2) then '有数据与normalstate不等显示离线
  822. ' strstatusCRAC = "<img src='images/statusOffline.gif'>"
  823. else
  824. strstatusCRAC = "<img src='images/statusNormal.gif'>" '否则显示正常
  825. '判断是否有报警
  826. arrVar = Array(var1,var2,var3,var4,var5,var6)
  827. for i = 0 to ubound(arrVar)
  828. if checkAllowedAlarm(arrVar(i)) = 1 and sqlSumLog(arrVar(i)) <> 10000 and sqlSumLog(arrVar(i)) <> sqlVar(arrVar(i)) then strstatusCRAC = "<img src='images/statusAlarm.gif'>"
  829. next
  830. end if
  831. statusDME3000 = strstatusCRAC
  832. end function
  833. 'CRAC-EmersonCM-市委3.4
  834. function statusAC(statusOpen,statusCom)
  835. dim strstatusCRAC, arrVar, i
  836. if sqlSumLog(statusOpen) = 10000 then '无数据显示离线
  837. strstatusCRAC = "<img src='images/statusOffline.gif'>"
  838. elseif sqlSumLog(statusOpen) <> sqlVar(statusOpen) then '有数据与normalstate不等显示离线
  839. strstatusCRAC = "<img src='images/statusOffline.gif'>"
  840. elseif sqlSumLog(statusCom) = 10000 then '无数据显示离线
  841. strstatusCRAC = "<img src='images/statusOffline.gif'>"
  842. elseif sqlSumLog(statusCom) <> sqlVar(statusOpen) then '有数据与normalstate不等显示离线
  843. strstatusCRAC = "<img src='images/statusOffline.gif'>"
  844. else
  845. strstatusCRAC = "<img src='images/statusNormal.gif'>" '否则显示正常
  846. end if
  847. statusAC = strstatusCRAC
  848. end function
  849. 'Emerson P1030
  850. function statusP1030(statusOpen,statusCom,var1,var2)
  851. dim strstatusCRAC, arrVar, i
  852. if statusOpen <> -1 and sqlSumLog(statusOpen) = 10000 then '无数据显示离线
  853. strstatusCRAC = "<img src='images/statusOffline.gif'>"
  854. elseif statusOpen <> -1 and sqlSumLog(statusOpen) <> sqlVar(statusOpen) then '有数据与normalstate不等显示离线
  855. strstatusCRAC = "<img src='images/statusOffline.gif'>"
  856. elseif statusCom <> "" and sqlSumLog(statusCom) = 10000 then '无数据显示离线
  857. strstatusCRAC = "<img src='images/statusOffline.gif'>"
  858. elseif statusCom <> "" and sqlSumLog(statusCom) <> sqlVar(statusCom) then '有数据与normalstate不等显示离线
  859. strstatusCRAC = "<img src='images/statusOffline.gif'>"
  860. ' elseif statusCom2 <> -1 and sqlSumLog(statusCom2) = 10000 then '无数据显示离线
  861. ' strstatusCRAC = "<img src='images/statusOffline.gif'>"
  862. ' elseif statusCom2 <> -1 and sqlSumLog(statusCom2) <> sqlVar(statusCom2) then '有数据与normalstate不等显示离线
  863. ' strstatusCRAC = "<img src='images/statusOffline.gif'>"
  864. else
  865. strstatusCRAC = "<img src='images/statusNormal.gif'>" '否则显示正常
  866. '判断是否有报警
  867. arrVar = Array(var1,var2)
  868. for i = 0 to ubound(arrVar)
  869. if checkAllowedAlarm(arrVar(i)) = 1 and sqlSumLog(arrVar(i)) <> 10000 and (sqlSumLog(arrVar(i)) < sqlVarLow(arrVar(i)) or sqlSumLog(arrVar(i)) > sqlVarUp(arrVar(i))) then strstatusCRAC = "<img src='images/statusAlarm.gif'>"
  870. next
  871. end if
  872. statusP1030 = strstatusCRAC
  873. end function
  874. 'UPS-------------------------------------------------------------------------------------------------------------------------------------------------------
  875. 'UPS-MGE-市委1.1
  876. function statusUPSMGE(statusCom,var1,var2,var3)
  877. dim strstatusUPS, arrVar, i
  878. if sqlSumLog(statusCom) = 10000 then '无数据显示离线
  879. strstatusUPS = "<img src='images/statusOffline.gif'>"
  880. elseif sqlSumLog(statusCom) <> sqlVar(statusCom) then '有数据与normalstate不等显示离线
  881. strstatusUPS = "<img src='images/statusOffline.gif'>"
  882. else
  883. strstatusUPS = "<img src='images/statusNormal.gif'>" '否则显示正常
  884. '判断是否有报警
  885. arrVar = Array(var1,var2,var3)
  886. for i = 0 to ubound(arrVar)
  887. if checkAllowedAlarm(arrVar(i)) = 1 and sqlSumLog(arrVar(i)) <> 10000 and sqlSumLog(arrVar(i)) <> sqlVar(arrVar(i)) then strstatusUPS = "<img src='images/statusAlarm.gif'>"
  888. next
  889. end if
  890. statusUPSMGE = strstatusUPS
  891. end function
  892. 'UPS-APC_Smart-市委3.4
  893. function statusUPSAPCSmart(statusCom,var1,var2)
  894. dim strstatusUPS, arrVar, i
  895. if sqlSumLog(statusCom) = 10000 then '无数据显示离线
  896. strstatusUPS = "<img src='images/statusOffline.gif'>"
  897. elseif sqlSumLog(statusCom) <> sqlVar(statusCom) then '有数据与normalstate不等显示离线
  898. strstatusUPS = "<img src='images/statusOffline.gif'>"
  899. else
  900. strstatusUPS = "<img src='images/statusNormal.gif'>" '否则显示正常
  901. '判断是否有报警
  902. if checkAllowedAlarm(var1) = 1 and sqlSumLog(var1) <> 10000 and sqlSumLog(var1) <> sqlVar(var1) then strstatusUPS = "<img src='images/statusAlarm.gif'>"
  903. if checkAllowedAlarm(var2) = 1 and sqlSumLog(var2) <> 10000 and (sqlSumLog(var2) = 3 or sqlSumLog(var2) = 6 or sqlSumLog(var2) = 9 or sqlSumLog(var2) = 10) then strstatusUPS = "<img src='images/statusAlarm.gif'>"
  904. end if
  905. statusUPSAPCSmart = strstatusUPS
  906. end function
  907. 'UPS-MGE-市委3.5
  908. function statusUHK2L41U112(statusOpen,statusCom,var1,var2,var3,var4,var5,var6,var7,var8,var9,var10)
  909. dim strstatusUPS, arrVar, i
  910. if sqlSumLog(statusOpen) = 10000 then '无数据显示离线
  911. strstatusUPS = "<img src='images/statusOffline.gif'>"
  912. elseif sqlSumLog(statusOpen) <> sqlVar(statusOpen) then '有数据与normalstate不等显示离线
  913. strstatusUPS = "<img src='images/statusOffline.gif'>"
  914. elseif sqlSumLog(statusCom) = 10000 then '无数据显示离线
  915. strstatusUPS = "<img src='images/statusOffline.gif'>"
  916. elseif sqlSumLog(statusCom) <> sqlVar(statusCom) then '有数据与normalstate不等显示离线
  917. strstatusUPS = "<img src='images/statusOffline.gif'>"
  918. else
  919. strstatusUPS = "<img src='images/statusNormal.gif'>" '否则显示正常
  920. '判断是否有报警
  921. arrVar = Array(var1,var2,var3,var4,var5,var6,var7,var8,var9,var10)
  922. for i = 0 to ubound(arrVar)
  923. if checkAllowedAlarm(arrVar(i)) = 1 and sqlSumLog(arrVar(i)) <> 10000 and sqlSumLog(arrVar(i)) <> sqlVar(arrVar(i)) then strstatusUPS = "<img src='images/statusAlarm.gif'>"
  924. next
  925. end if
  926. statusUHK2L41U112 = strstatusUPS
  927. end function
  928. 'UPS-MGE-市委3.5
  929. function statusUL33(var1,var2,var3,var4,var5)
  930. dim strstatusUPS, arrVar, i
  931. strstatusUPS = "<img src='images/statusNormal.gif'>" '否则显示正常
  932. '判断是否有报警
  933. arrVar = Array(var1,var2,var3,var4,var5)
  934. for i = 0 to ubound(arrVar)
  935. if checkAllowedAlarm(arrVar(i)) = 1 and sqlSumLog(arrVar(i)) <> 10000 and sqlSumLog(arrVar(i)) <> sqlVar(arrVar(i)) then strstatusUPS = "<img src='images/statusAlarm.gif'>"
  936. next
  937. statusUL33 = strstatusUPS
  938. end function
  939. 'UPS_APC
  940. function statusUPS_APC(var1, var2)
  941. dim strUPS, check1, check2
  942. check1 = checkAllowedAlarm(var1)
  943. check2 = checkAllowedAlarm(var2)
  944. if check1 = 0 and check2 = 0 then exit function
  945. strUPS = "<img src='images/statusNormal.gif'>"
  946. if check1 = 1 then
  947. if sqlSumLog(var1) = 10000 then strUPS = "<img src='images/statusOffline.gif'>"
  948. if sqlSumLog(var1) = 3 or sqlSumLog(var1) = 6 or sqlSumLog(var1) = 7 or sqlSumLog(var1) = 9 or sqlSumLog(var1) = 10 then strUPS = "<img src='images/statusAlarm.gif'>"
  949. end if
  950. if check2 = 1 then
  951. if sqlSumLog(var2) <> 10000 and sqlSumLog(var2) = 3 then strUPS = "<img src='images/statusAlarm.gif'>"
  952. end if
  953. statusUPS_APC = strUPS
  954. end function
  955. '--------------------------------------------------------------------------------------------------------------------------------------------------------
  956. '机房电压异常报警/干结点信号
  957. function statusVoltage(varname)
  958. if checkAllowedAlarm(varname) = 0 then exit function
  959. dim strVoltage
  960. strVoltage = "<img src='images/statusNormal.gif'>"
  961. if sqlSumLog(varname) = 10000 then strVoltage = "<img src='images/statusOffline.gif'>"
  962. if sqlSumLog(varname) <> 10000 and sqlSumLog(varname) <> sqlVar(varname) then strVoltage = "<img src='images/statusAlarm.gif'>"
  963. statusVoltage = strVoltage
  964. end function
  965. function statusVoltage2(varconn,varname)
  966. if checkAllowedAlarm(varconn) = 0 and checkAllowedAlarm(varname) = 0 then exit function
  967. dim strVoltage
  968. if sqlSumLog(varconn) = 10000 or sqlSumLog(varconn) <> sqlVar(varconn) then
  969. strVoltage = "<img src='images/statusOffline.gif'>"
  970. else
  971. if sqlSumLog(varname) = 10000 then
  972. strVoltage = "<img src='images/statusOffline.gif'>"
  973. elseif sqlSumLog(varname) <> 10000 and sqlSumLog(varname) <> sqlVar(varname) then
  974. strVoltage = "<img src='images/statusAlarm.gif'>"
  975. else
  976. strVoltage = "<img src='images/statusNormal.gif'>"
  977. end if
  978. end if
  979. statusVoltage2 = strVoltage
  980. end function
  981. '网络状态,市委,如果勾选不报警则显示常绿
  982. function statusVoltage3(varname)
  983. if checkAllowedAlarm(varname) = 0 then
  984. strVoltage = "<img src='images/statusNormal.gif'>"
  985. else
  986. dim strVoltage
  987. strVoltage = "<img src='images/statusNormal.gif'>"
  988. if sqlSumLog(varname) = 10000 then strVoltage = "<img src='images/statusOffline.gif'>"
  989. if sqlSumLog(varname) <> 10000 and sqlSumLog(varname) <> sqlVar(varname) then strVoltage = "<img src='images/statusAlarm.gif'>"
  990. end if
  991. statusVoltage3 = strVoltage
  992. end function
  993. '灯光
  994. function statusLight(varname)
  995. 'if checkAllowedAlarm(varname) = 0 then exit function
  996. dim strLight
  997. if sqlSumLog(varname) = 10000 then
  998. strLight = "<img src='images/statusOffline.gif'>"
  999. elseif sqlSumLog(varname) <> 10000 and sqlSumLog(varname) = 1 then
  1000. strLight = "<img src='images/statusLight.gif'>"
  1001. else
  1002. strLight = "<img src='images/statusOffline.gif'>"
  1003. end if
  1004. statusLight = strLight
  1005. end function
  1006. '从t_summary_log读取当前值,没有值则返回10000,否则返回当前值
  1007. function sqlSumLog(varname)
  1008. dim rsSqlSumLog
  1009. set rsSqlSumLog = conn.execute("select curr_value from t_summary_log where varname = '"&varname&"'")
  1010. if rsSqlSumLog.bof and rsSqlSumLog.eof then
  1011. sqlSumLog = 10000
  1012. elseif rsSqlSumLog(0) = -1 then
  1013. sqlSumLog = 10000
  1014. else
  1015. sqlSumLog = rsSqlSumLog(0)
  1016. end if
  1017. rsSqlSumLog.close
  1018. set rsSqlSumLog = nothing
  1019. end function
  1020. '从t_dev_variant读取normalstate,没有值则返回10000,否则返回当前值
  1021. function sqlVar(varname)
  1022. dim rsSqlVar
  1023. set rsSqlVar = conn.execute("select normalstate from t_dev_variant where varname = '"&varname&"'")
  1024. if rsSqlVar.bof and rsSqlVar.eof then
  1025. sqlVar = 10000
  1026. else
  1027. sqlVar = rsSqlVar(0)
  1028. end if
  1029. rsSqlVar.close
  1030. set rsSqlVar = nothing
  1031. end function
  1032. '从t_dev_variant读取下限,没有值则返回10000,否则返回当前值
  1033. function sqlVarLow(varname)
  1034. dim rsSqlVar
  1035. set rsSqlVar = conn.execute("select lowerlimit from t_dev_variant where varname = '"&varname&"'")
  1036. if rsSqlVar.bof and rsSqlVar.eof then
  1037. sqlVarLow = 10000
  1038. else
  1039. sqlVarLow = rsSqlVar(0)
  1040. end if
  1041. rsSqlVar.close
  1042. set rsSqlVar = nothing
  1043. end function
  1044. '从t_dev_variant读取上限,没有值则返回10000,否则返回当前值
  1045. function sqlVarUp(varname)
  1046. dim rsSqlVar
  1047. set rsSqlVar = conn.execute("select upperlimit from t_dev_variant where varname = '"&varname&"'")
  1048. if rsSqlVar.bof and rsSqlVar.eof then
  1049. sqlVarUp = 10000
  1050. else
  1051. sqlVarUp = rsSqlVar(0)
  1052. end if
  1053. rsSqlVar.close
  1054. set rsSqlVar = nothing
  1055. end function
  1056. function checkAllowedAlarm(varname)
  1057. dim rsCheck
  1058. set rsCheck = conn.execute("select boolreserved2 from t_dev_variant where varname = '"&varname&"'")
  1059. if rsCheck.bof and rsCheck.eof then
  1060. checkAllowedAlarm = 0
  1061. else
  1062. checkAllowedAlarm = rsCheck(0)
  1063. end if
  1064. rsCheck.close
  1065. set rsCheck = nothing
  1066. end function
  1067. %>