Cls_Public.asp
资源名称:haohj.rar [点击查看]
上传用户:angela
上传日期:2022-05-11
资源大小:853k
文件大小:29k
源码类别:
外挂编程
开发平台:
ASP/ASPX
- <%
- '=====================================================================
- ' 作者声明:转载请保留版权信息,鄙视不要脸的人
- '=====================================================================
- ' 程序名称:蓝宇网游发布系统
- ' 软件版本:Version 3.3.0 Sp1
- ' 程序作者:ジ蓝ゞ宇 QQ:18159079
- '=====================================================================
- ' 联系方式:Tel:13203117383,QQ:18159079
- ' 程序开发:ジ蓝ゞ宇 QQ:18159079
- ' 官方网站:蓝宇网络(http://hi.baidu.com/hezeyu)
- '=====================================================================
- ' Copyright 2004-2007 蓝宇 - QQ:18159079.
- '=====================================================================
- Class cls_TeGqMain
- Dim WebName, WebUrl, Renovates, Copyright, IndexGame, Webmaster , rs2
- Dim sfUlock, JzUlock, sfLook, mirsfID, mirsfday, sf_hot, sf_top
- Dim bg_1, bg_2, bg_3, bg_4, bg_1_1, bg_2_2, bg_3_3, bg_4_4, IsNews
- Dim sfhits, hottime_1, hottime_2, finePage, TabWidth,ShowHtml, ServerDir
- Dim MaxPerPage, AdminPage, ssign, WebKeywords, GetUserip, sfIsUlock, jzIsUlock
- Dim Indexsf1, Indexsf2, Indexsf3, Indexsf4, Indexsf5, SiteVersion
- '================================================
- '作 用:页面顶部
- '================================================
- Public Function Head()
- Response.Write "<html>" & vbCrLf
- Response.Write "<HEAD>" & vbCrLf
- Response.Write "<title>" & start & "," & webname & "</title>" & vbCrLf
- Response.Write "<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">" & vbCrLf
- Response.Write "<META NAME =""keywords"" CONTENT=""" & WebKeywords & """>" & vbCrLf
- Response.Write "<META NAME=""description"" CONTENT=""" & Renovates & """>" & vbCrLf
- Response.Write "<META name=""AUTHOR"" content=""" & webname & """>" & vbCrLf
- Response.Write "<link rel='stylesheet' href='/images/style.css' type='text/css'>" & vbCrLf
- Response.Write "</HEAD>" & vbCrLf
- Response.Write "<BODY>" & vbCrLf
- %>
- <table width="1002" border="0" align="center" cellpadding="0" cellspacing="0">
- <tr>
- <td height="47" colspan="3" background="/images/863sf_cn_r1_c1.gif"> </td>
- </tr>
- <tr>
- <td width="252" height="123" rowspan="2" background="/images/863sf_cn_r2_c1.gif"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="252" height="123">
- <param name="movie" value="/images/top_12.swf" />
- <param name="quality" value="high" />
- <param name="wmode" value="transparent" />
- <embed src="/images/top_12.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="252" height="123"></embed>
- </object></td>
- <td width="59" height="30"><img src="/images/863sf_cn_r2_c2.gif" width="75" height="30" /></td>
- <td width="675" height="30" valign="bottom" background="/images/863sf_cn_r2_c3.gif"><table width="670" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="348" valign="bottom"><table border="0" cellspacing="0" cellpadding="2">
- <tr><form method=post action="/search.asp" target="_blank">
- <td align="center"><input type="text" name="key" class="Input1" onBlur="if (value ==''){value='请输入要搜索的私服'}" onmouseover=this.focus() onfocus=this.select() onClick="if(this.value=='请输入要搜索的私服')this.value=''" maxLength=18 size=25 value=请输入要搜索的私服></td>
- <td align="center">
- <SELECT name=otype type=radio >
- <OPTION value=name selected class=Input1>服务器名</OPTION>
- <OPTION value=ip>服务器IP</OPTION>
- <OPTION value=sdate>开放时间</OPTION>
- <OPTION value=QQ>客服QQ</OPTION>
- <OPTION value=xingzhi>版本介绍</OPTION>
- <OPTION value=homepage>官方网站</OPTION>
- </SELECT> </td>
- <td align="center" nowrap>
- <input name="image" type="image" src="/images/search.gif" align="absmiddle" width="76" height="21"> </td>
- </form>
- </tr>
- </table></td>
- <td width="173" align="center"><a href="#" onclick="javascript:this.style.behavior='url(#default#homepage)';this.setHomePage(window.location.href);return false;">设置首页</a> | <a href="#" onclick="window.external.addFavorite(window.document.location.href,document.title);return false;">加入收藏</a> </td>
- <td width="149"></td>
- </tr>
- </table></td>
- </tr>
- <tr>
- <td height="93" colspan="2" background="/images/863sf_cn_r3_c2.gif"><table width="100%" height="90" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="68%" align="center"><table width="470" border="0" cellpadding="0" cellspacing="0">
- <tbody>
- <tr>
- <td class="M_Menu" align="middle" height="22"><span
- class="STYLE11"><img src="/images/863sf_cn_Index_010.gif" width="6" height="9" /> <a href="<%=WebUrl%>"><strong>传奇私服</strong></a> <img src="/images/863sf_cn_Index_010.gif" width="6" height="9" /> <a href="/jzindex.html" target="_blank">家族基地</a> <img src="/images/863sf_cn_Index_010.gif" width="6" height="9" /> <a href="/jzadd.html" target="_blank">发布家族</a> <img src="/images/863sf_cn_Index_010.gif" width="6" height="9" /> <a href="/Soft.html" target="_blank">外挂下载</a> <img src="/images/863sf_cn_Index_010.gif" width="6" height="9" /> <a href="/add.html" target="_blank"><font color="#ffff00">发布游戏</font></a> <img src="/images/863sf_cn_Index_010.gif" width="6" height="9" /> </span><font
- color="#ffff00"><a href="/advertise.html"
- target="_blank">广告价格</a></font></td>
- </tr>
- <tr>
- <td background="/images/863sf_t1_c8.gif" height="2"></td>
- </tr>
- <tr>
- <td class="M_Menu" align="middle" height="22"><span
- class="STYLE11"><img src="/images/863sf_cn_Index_010.gif" width="6" height="9" /> <a href="mianze.htm" target="_blank">免责申明</a> <img src="/images/863sf_cn_Index_010.gif" width="6" height="9" /> <a href="/sf.html" target="_blank">私服小偷</a> <img src="/images/863sf_cn_Index_010.gif" width="6" height="9" /> <a href="http://www.863sf.com" target="_blank">免费电影</a> <img src="/images/863sf_cn_Index_010.gif" width="6" height="9" /> <a href="http://image.baidu.com/i?ct=201326592&cl=2&lm=-1&tn=baiduimage&pv=&word=非主流美女&z=0" target="_blank">美女图片</a> <img src="/images/863sf_cn_Index_010.gif" width="6" height="9" /> <a href="/Article.html" target="_blank">技术文章</a> <img src="/images/863sf_cn_Index_010.gif" width="6" height="9" /> </span><a
- href="/advertise.html" target="_blank"><font
- color="#ffff00">宣传优势</font></a></td>
- </tr>
- <tr>
- <td background="/images/863sf_t1_c8.gif" height="2"></td>
- </tr>
- <tr>
- <td class="M_Menu" align="middle" height="22"><span
- class="STYLE11"><img src="/images/863sf_cn_Index_010.gif" width="6" height="9" /> <a href="zhange.asp" target="_blank">家族战歌</a> <img src="/images/863sf_cn_Index_010.gif" width="6" height="9" /> <a href="/link.asp" target="_blank">友情连接</a> <img src="/images/863sf_cn_Index_010.gif" width="6" height="9" /> <a href="http://hi.baidu.com/hezeyu" target="_blank">阻业建站</a> <img src="/images/863sf_cn_Index_010.gif" width="6" height="9" /> <a href="/more.asp" target="_blank">更多游戏</a> <img src="/images/863sf_cn_Index_010.gif" width="6" height="9" /> <a href="http://www.haohj.com" target="_blank">好合击</a> <img src="/images/863sf_cn_Index_010.gif" width="6" height="9" /> </span><a
- href="/advertise.html" target="_blank"><font
- color="#ffff00">宣传优势</font></a></td>
- </tr>
- <tr>
- <td background="/images/863sf_t1_c8.gif" height="2"></td>
- </tr>
- </tbody>
- </table></td>
- <td width="32%" align="center"><img src="/ad/add.gif" width="200" height="80" /></td>
- </tr>
- </table></td>
- </tr>
- </table>
- <table width="1002" border="0" align="center" cellpadding="0" cellspacing="0">
- <tr>
- <td width="69"><img src="/images/863_top_r1_c1.gif" width="69" height="35" /></td>
- <td width="653" background="/images/863_top_r1_c2.gif"><table width="100%" height="20" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td valign="middle" class="TopName"><font color=#ffff00><b> <%=IsNews%></b></font></td>
- </tr>
- </table></td>
- <td width="95"><a href="/jzadd.html"><img src="/images/863_top_r1_c3.gif" alt="发布家族" width="95" height="35" border="0" /></a></td>
- <td width="94"><a href="/add.html"><img src="/images/863_top_r1_c4.gif" alt="发布私服" width="94" height="35" border="0" /></a></td>
- <td width="91"><a href="/advertise.html" target="_blank"><img src="/images/863_top_r1_c5.gif" alt="广告联系" width="91" height="35" border="0" /></a></td>
- </tr>
- </table>
- <table width="1002" border="0" align="center" cellpadding=0 cellspacing=0 class=tableBorder1>
- <tr>
- <td height="3" bgcolor="#FF0000" ></td>
- </tr>
- <tr>
- <td valign="bottom" bgcolor="#FF0000" ><div align="center"><script src=/adfile/top.js></script></div></td>
- </tr>
- </table>
- <SCRIPT language=javascript src="ads.js"></SCRIPT>
- <% End Function
- '================================================
- '作 用:页面低部
- '================================================
- Public Function Footer()
- %>
- <TABLE height=28 cellSpacing=2 cellPadding=0 width=1004 align=center
- bgColor=#ff6666 border=0>
- <TBODY>
- <TR vAlign=center align=middle bgColor=#CC3300 height=24>
- <% Dim i,rs3
- sql="select * from Gq_menu where menupass=true and menufoot=true order by menuid asc"
- set rs3=server.createobject("adodb.recordset")
- rs3.open sql,conn,1,1
- i=0
- do while not rs3.eof
- if rs3("menuopen")=true then
- Response.Write "<TD><a class=NavT href='"&rs3("menuurl")&"' Title='"&rs3("menucontent")&"' target=_blank>"&rs3("menutitle")&"</a></TD> " & vbCrLf
- else
- Response.Write "<TD><a class=NavT href='"&rs3("menuurl")&"' Title='"&rs3("menucontent")&"'>"&rs3("menutitle")&"</a></TD> " & vbCrLf
- end if
- i=i+1
- if i>=10 then exit do
- rs3.movenext
- loop
- if rs3.eof and rs3.bof then
- end if
- rs3.close
- set rs3=nothing%></TR></TBODY></TABLE>
- <STYLE type=text/css>.style2 {
- COLOR: #ffffff
- }
- </STYLE>
- <table width="1004" border="0" align="center" cellpadding="0" cellspacing="0">
- <tr>
- <td height="121" background="/images/foot.gif"><table width="100%" height="121" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="247" align="center"> </td>
- <td width="757"><%=Copyright%></td>
- </tr>
- </table></td>
- </tr>
- </table>
- </BODY></HTML>
- <%End Function
- '================================================
- '作 用:防注入
- '================================================
- Public Function CheckInfuse(ByVal str, ByVal strLen)
- Dim strUnsafe, arrUnsafe
- Dim i
- If Trim(str) = "" Then
- CheckInfuse = ""
- Exit Function
- End If
- str = Left(str, strLen)
- On Error Resume Next
- strUnsafe = "'|^|;|and|exec|insert|select|delete|update|count|*|%|chr|mid|master|truncate|char|declare"
- If Trim(str) <> "" Then
- If Len(str) > strLen Then
- Response.Write "<Script Language=JavaScript>alert('安全系统提示↓nn您提交的字符数超过了限制!');history.back(-1)</Script>"
- CheckInfuse = ""
- Response.End
- End If
- arrUnsafe = Split(strUnsafe, "|")
- For i = 0 To UBound(arrUnsafe)
- If InStr(1, str, arrUnsafe(i), 1) > 0 Then
- Response.Write "<Script Language=JavaScript>alert('安全系统提示↓nn请不要在参数中包含非法字符!');history.back(-1)</Script>"
- CheckInfuse = ""
- Response.End
- End If
- Next
- End If
- CheckInfuse = Trim(str)
- Exit Function
- If Err.Number <> 0 Then
- Err.Clear
- Response.Write "<Script Language=JavaScript>alert('安全系统提示↓nn请不要在参数中包含非法字符!');history.back(-1)</Script>"
- CheckInfuse = ""
- Response.End
- End If
- End Function
- Public Sub PreventInfuse()
- On Error Resume Next
- Dim SQL_Nonlicet, arrNonlicet
- Dim PostRefer, GetRefer, Sql_DATA
- SQL_Nonlicet = "'|;|^|and|exec|insert|select|delete|update|count|*|%|chr|mid|master|truncate|char|declare"
- arrNonlicet = Split(SQL_Nonlicet, "|")
- If Request.Form <> "" Then
- For Each PostRefer In Request.Form
- For Sql_DATA = 0 To UBound(arrNonlicet)
- If InStr(1, Request.Form(PostRefer), arrNonlicet(Sql_DATA), 1) > 0 Then
- Response.Write "<Script Language=JavaScript>alert('安全系统提示↓nn请不要在参数中包含非法字符!');history.back(-1)</Script>"
- Response.End
- End If
- Next
- Next
- End If
- If Request.QueryString <> "" Then
- For Each GetRefer In Request.QueryString
- For Sql_DATA = 0 To UBound(arrNonlicet)
- If InStr(1, Request.QueryString(GetRefer), arrNonlicet(Sql_DATA), 1) > 0 Then
- Response.Write "<Script Language=JavaScript>alert('安全系统提示↓nn请不要在参数中包含非法字符!');history.back(-1)</Script>"
- Response.End
- End If
- Next
- Next
- End If
- End Sub
- '================================================
- '作 用:基本设置信息
- '================================================
- Public Function ReadConfig(ByVal SysID)
- Dim Rs, SQL
- On Error Resume Next
- Set Rs = Server.CreateObject("ADODB.Recordset")
- SQL = "SELECT * from Gq_Config Where ID=" & SysID
- Rs.Open SQL, Conn, 1, 1
- WebName = Rs("SiteName"): WebUrl = Rs("SiteUrl"): Renovates = Rs("Renovates"): Copyright = Rs("Copyright"): IndexGame = Rs("IndexGame")
- ' --------------------------------------------------------------------------------------------------------------------------------------------
- Webmaster = Rs("Webmaster"): sfUlock = Rs("sfUlock"): JzUlock = Rs("JzUlock"): sfLook = Rs("sfLook"): mirsfID = Rs("mirsfID")
- ' --------------------------------------------------------------------------------------------------------------------------------------------
- mirsfday = Rs("mirsfday"): sf_hot = Rs("sf_hot"): sf_top = Rs("sf_top"): bg_1 = Rs("bg_1"): bg_2 = Rs("bg_2"): bg_3 = Rs("bg_3")
- ' --------------------------------------------------------------------------------------------------------------------------------------------
- bg_4 = Rs("bg_4"): bg_1_1 = Rs("bg_1_1"): bg_2_2 = Rs("bg_2_2"): bg_3_3 = Rs("bg_3_3"): bg_4_4 = Rs("bg_4_4"): sfhits = Rs("sfhits")
- ' --------------------------------------------------------------------------------------------------------------------------------------------
- hottime_1 = Rs("hottime_1"): hottime_2 = Rs("hottime_2"): finePage = Rs("finePage"): MaxPerPage = Rs("MaxPerPage"): IsNews = Rs("IsNews")
- ' --------------------------------------------------------------------------------------------------------------------------------------------
- AdminPage = Rs("AdminPage"): ssign = Rs("ssign"): WebKeywords = Rs("WebKeywords"): TabWidth = Rs("TabWidth"): ShowHtml = Rs("ShowHtml")
- ' --------------------------------------------------------------------------------------------------------------------------------------------
- Indexsf1 = Rs("Indexsf1"): Indexsf2 = Rs("Indexsf2"): Indexsf3 = Rs("Indexsf3"): Indexsf4 = Rs("Indexsf4"): Indexsf5 = Rs("Indexsf5")
- GetUserip = CheckStr(getIP): ServerDir = "/": SiteVersion = Rs("SiteVersion")
- sfIsUlock=conn.execute("select count(*) from Gq_sfdata where ulock=0")(0)
- jzIsUlock=conn.execute("select count(*) from Gq_jzdata where ulock=0")(0)
- Sitesflook="go.htm?u=open.asp?action=go&"
- End Function
- Public Function ContentHtml(ByVal strRs)
- Dim strHtmlFine, strHtmlName
- strHtmlFine = year(strRs("Sdate")) & month(strRs("Sdate")) & day(strRs("Sdate"))
- strHtmlName = ServerDir & year(strRs("Sdate")) & month(strRs("Sdate")) & day(strRs("Sdate")) & strRs("ID")
- ContentHtml = strHtmlFine & strHtmlName
- End Function
- '================================================
- '作 用:相对路径转换为绝对路径
- '================================================
- Public Function ChkMapPath(ByVal strPath)
- On Error Resume Next
- Dim fullPath
- strPath = Replace(Replace(Trim(strPath), "//", "/"), "\", "")
- If strPath = "" Then strPath = "."
- If InStr(strPath,":") = 0 Then
- fullPath = Server.MapPath(strPath)
- Else
- strPath = Replace(strPath,"/","")
- fullPath = Trim(strPath)
- If Right(fullPath, 1) = "" Then
- fullPath = Left(fullPath, Len(fullPath) - 1)
- End If
- End If
- ChkMapPath = fullPath
- End Function
- '================================================
- '作 用:计算天数
- '================================================
- Public Function Checkday(toptime,topday)
- If Not Isnull(toptime) Then
- If Cdate(toptime)+topday>=date Then
- Checkday=True
- Else
- Checkday=False
- End if
- Else
- Checkday=False
- End if
- End function
- '================================================
- '作 用:过滤字符
- '================================================
- Public Function CheckStr(ByVal str)
- If IsNull(str) Then
- CheckStr = ""
- Exit Function
- End If
- str = Replace(str, Chr(0), "")
- CheckStr = Replace(str, "'", "''")
- End Function
- Public Function CheckBadstr(str)
- If IsNull(str) Then
- CheckBadstr = vbNullString
- Exit Function
- End If
- str = Replace(str, Chr(0), vbNullString)
- str = Replace(str, Chr(34), vbNullString)
- str = Replace(str, "%", vbNullString)
- str = Replace(str, "@", vbNullString)
- str = Replace(str, "!", vbNullString)
- str = Replace(str, "^", vbNullString)
- str = Replace(str, "=", vbNullString)
- str = Replace(str, "--", vbNullString)
- str = Replace(str, "$", vbNullString)
- str = Replace(str, "'", vbNullString)
- str = Replace(str, ";", vbNullString)
- CheckBadstr = Trim(str)
- End Function
- Public Function ChkNumeric(ByVal CHECK_ID)
- If CHECK_ID <> "" And IsNumeric(CHECK_ID) Then
- CHECK_ID = CLng(CHECK_ID)
- If CHECK_ID < 0 Then CHECK_ID = 0
- Else
- CHECK_ID = 0
- End If
- ChkNumeric = CHECK_ID
- End Function
- '================================================
- '作 用:过滤表单字符
- '================================================
- Public Function ChkFormStr(ByVal str)
- Dim fString
- fString = str
- If IsNull(fString) Then
- ChkFormStr = ""
- Exit Function
- End If
- fString = Replace(fString, "'", "'")
- fString = Replace(fString, Chr(34), """)
- fString = Replace(fString, Chr(13), "")
- fString = Replace(fString, Chr(10), "")
- fString = Replace(fString, Chr(9), "")
- fString = Replace(fString, ">", ">")
- fString = Replace(fString, "<", "<")
- fString = Replace(fString, "%", "%")
- ChkFormStr = Trim(JAPEncode(fString))
- End Function
- Public Function JAPEncode(ByVal str)
- Dim FobWords, i
- On Error Resume Next
- If IsNull(str) Or Trim(str) = "" Then
- JAPEncode = ""
- Exit Function
- End If
- FobWords = Array(92, 304, 305, 430, 431, 437, 438, 12460, 12461, 12462, 12463, 12464, 12465, 12466, 12467, 12468, 12469, 12470, 12471, 12472, 12473, 12474, 12475, 12476, 12477, 12478, 12479, 12480, 12481, 12482, 12483, 12485, 12486, 12487, 12488, 12489, 12490, 12496, 12497, 12498, 12499, 12500, 12501, 12502, 12503, 12504, 12505, 12506, 12507, 12508, 12509, 12510, 12521, 12532, 12533, 65340)
- For i = 1 To UBound(FobWords, 1)
- If InStr(str, ChrW(FobWords(i))) > 0 Then
- str = Replace(str, ChrW(FobWords(i)), "&#" & FobWords(i) & ";")
- End If
- Next
- JAPEncode = str
- End Function
- '================================================
- '作 用:判断连接是否来自外部
- '================================================
- Public Function CheckPost()
- On Error Resume Next
- Dim server_v1, server_v2
- CheckPost = False
- server_v1 = CStr(Request.ServerVariables("HTTP_REFERER"))
- server_v2 = CStr(Request.ServerVariables("SERVER_NAME"))
- If Mid(server_v1, 8, Len(server_v2)) = server_v2 Then
- CheckPost = True
- End If
- End Function
- '================================================
- '作 用:IP获取
- '================================================
- Public Function getIP()
- Dim strIPAddr
- If Request.ServerVariables("HTTP_X_FORWARDED_FOR") = "" Or InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), "unknown") > 0 Then
- strIPAddr = Request.ServerVariables("REMOTE_ADDR")
- ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",") > 0 Then
- strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",")-1)
- ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";") > 0 Then
- strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";")-1)
- Else
- strIPAddr = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
- End If
- getIP = Replace(Trim(Mid(strIPAddr, 1, 30)), "'", "")
- End Function
- '===========================================
- '作 用:数据库连接
- '===========================================
- Public Function Execute(Command)
- If Not IsObject(conn) Then ConnectionDatabase
- On Error Resume Next
- Set Execute = conn.Execute(Command)
- If Err Then
- If IsDeBug = 1 Then
- Response.Write "你执行的语句是:" & Command
- Response.Write "<BR>错误信息为:" & Err.description
- Else
- Response.Write "查询数据的时候发现错误,请检查您的查询代码是否正确。"
- End If
- Err.Clear
- conn.close
- set conn=nothing
- Response.End
- End If
- End Function
- '===========================================
- '作 用:系统分配随机代码
- '===========================================
- Public Function GetRandomCode()
- Dim Ran, i, LengthNum
- LengthNum = 16
- GetRandomCode = ""
- For i = 1 To LengthNum
- Randomize
- Ran = CInt(Rnd * 2)
- Randomize
- If Ran = 0 Then
- Ran = CInt(Rnd * 25) + 97
- GetRandomCode = GetRandomCode & UCase(Chr(Ran))
- ElseIf Ran = 1 Then
- Ran = CInt(Rnd * 9)
- GetRandomCode = GetRandomCode & Ran
- ElseIf Ran = 2 Then
- Ran = CInt(Rnd * 25) + 97
- GetRandomCode = GetRandomCode & Chr(Ran)
- End If
- Next
- End Function
- '===========================================
- '作 用:通用分页
- '===========================================
- Public Function ShowListPage(CurrentPage,Pcount,totalrec,PageNum,strLink,ListName)
- With Response
- .Write "<script>"
- .Write "ShowListPage("
- .Write CurrentPage
- .Write ","
- .Write Pcount
- .Write ","
- .Write totalrec
- .Write ","
- .Write PageNum
- .Write ",'"
- .Write strLink
- .Write "','"
- .Write ListName
- .Write "');"
- .Write "</script>" & vbNewLine
- End With
- End Function
- '================================================
- '作 用:通用HTML分页
- '================================================
- Public Function ShowHtmlPage(CurrentPage,Pcount,totalrec,PageNum,strLink,ExtName,ListName)
- With Response
- .Write "<script>"
- .Write "ShowHtmlPage("
- .Write CurrentPage
- .Write ","
- .Write Pcount
- .Write ","
- .Write totalrec
- .Write ","
- .Write PageNum
- .Write ",'"
- .Write strLink
- .Write "','"
- .Write ExtName
- .Write "','"
- .Write ListName
- .Write "');"
- .Write "</script>" & vbNewLine
- End With
- End Function
- '===========================================
- '作 用:读取文件URL
- '===========================================
- Public Function ReadFileUrl(url)
- On Error Resume Next
- ReadFileUrl = ""
- If url = "" Then Exit Function
- Dim strTemp
- If CheckUrl(url) = 1 Then
- strTemp = Trim(url)
- ElseIf CheckUrl(url) = 2 Then
- strTemp = Trim(url)
- Else
- strTemp = Replace(url, "/", "")
- strTemp = Trim(ServerDir & strTemp)
- End If
- ReadFileUrl = strTemp
- End Function
- '================================================
- '作 用:读取文件内容
- '================================================
- Public Function Readfile(ByVal fromPath)
- On Error Resume Next
- Dim strTemp,fso,f
- If InStr(fromPath, ":") = 0 Then fromPath = Server.MapPath(fromPath)
- Set fso = Server.CreateObject(ServerObject(1))
- If fso.FileExists(fromPath) Then
- Set f = fso.OpenTextFile(fromPath, 1, True)
- strTemp = f.ReadAll
- f.Close
- Set f = Nothing
- End If
- Set fso = Nothing
- Readfile = strTemp
- If Err.Number <> 0 Then Err.Clear
- End Function
- '===========================================
- '作 用:创建文本文件
- '===========================================
- Public Function CreatedTextFile(ByVal fromPath, ByVal body)
- On Error Resume Next
- Dim fso,fff
- If InStr(fromPath, ":") = 0 Then fromPath = Server.MapPath(fromPath)
- Set fso = Server.CreateObject(ServerObject(1))
- Set fff = fso.OpenTextFile(fromPath, 2, True)
- fff.Write body
- fff.Close
- Set fff = Nothing
- Set fso = Nothing
- If Err.Number <> 0 Then Err.Clear
- End Function
- '===========================================
- '作 用:自动生成目录
- '===========================================
- Public Function CreatPathEx(ByVal sPath)
- sPath = Replace(sPath, "/", "")
- sPath = Replace(sPath, "\", "")
- On Error Resume Next
- Dim strHostPath,strPath
- Dim sPathItem,sTempPath
- Dim i,fso
- Set fso = Server.CreateObject(ServerObject(1))
- strHostPath = Server.MapPath("/")
- If InStr(sPath, ":") = 0 Then sPath = Server.MapPath(sPath)
- If fso.FolderExists(sPath) Or Len(sPath) < 3 Then
- CreationPath = True
- Exit Function
- End If
- strPath = Replace(sPath, strHostPath, vbNullString,1,-1,1)
- sPathItem = Split(strPath, "")
- If InStr(LCase(sPath), LCase(strHostPath)) = 0 Then
- sTempPath = sPathItem(0)
- Else
- sTempPath = strHostPath
- End If
- For i = 1 To UBound(sPathItem)
- If sPathItem(i) <> "" Then
- sTempPath = sTempPath & "" & sPathItem(i)
- If fso.FolderExists(sTempPath) = False Then
- fso.CreateFolder sTempPath
- End If
- End If
- Next
- Set fso = Nothing
- If Err.Number <> 0 Then Err.Clear
- CreatPathEx = True
- End Function
- '================================================
- '作 用:FSO删除文件
- '================================================
- Public Function FileDelete(ByVal FilePath)
- FileDelete = False
- On Error Resume Next
- Dim fso
- Set fso = Server.CreateObject(ServerObject(1))
- If FilePath = "" Then Exit Function
- If InStr(FilePath, ":") = 0 Then FilePath = Server.MapPath(FilePath)
- If fso.FileExists(FilePath) Then
- fso.DeleteFile FilePath, True
- FileDelete = True
- End If
- Set fso = Nothing
- If Err.Number <> 0 Then Err.Clear
- End Function
- '================================================
- '作 用:过滤HTML代码
- '================================================
- Public Function HTMLEncode(ByVal fString)
- If Not IsNull(fString) Then
- fString = Replace(fString, ">", ">")
- fString = Replace(fString, "<", "<")
- fString = Replace(fString, Chr(32), " ")
- fString = Replace(fString, Chr(9), " ")
- fString = Replace(fString, Chr(34), """)
- fString = Replace(fString, Chr(39), "'")
- fString = Replace(fString, Chr(13), "")
- fString = Replace(fString, " ", " ")
- fString = Replace(fString, Chr(10), "<br /> ")
- fString = ChkBadWords(fString)
- HTMLEncode = fString
- End If
- End Function
- '================================================
- '作 用:判断ID是否为整数
- '================================================
- Public Function IsInteger(Para)
- On Error Resume Next
- Dim str
- Dim l,i
- If isNUll(para) then
- isInteger=false
- Exit Function
- End If
- str=Cstr(para)
- If trim(str)="" then
- IsInteger=false
- Exit Function
- End If
- l=len(str)
- For i=1 to l
- If mid(str,i,1)>"9" or mid(str,i,1)<"0" then
- isInteger=false
- Exit Function
- End If
- Next
- isInteger=true
- If err.number<>0 then err.clear
- End Function
- '================================================
- '作 用:补足参数
- '================================================
- Public Function Supplemental(para, n)
- Supplemental = ""
- If Not IsNumeric(para) Then Exit Function
- If Len(para) < n Then
- Supplemental = String(n - Len(para), "0") & para
- Else
- Supplemental = para
- End If
- End Function
- Public Function OutputScript(str,url)
- Response.Write "<script language=JavaScript>" & vbCrLf
- Response.Write "alert('" & str & "');"
- Response.Write "location.replace('" & url & "')" & vbCrLf
- Response.Write "</script>" & vbCrLf
- Response.End
- End Function
- Public Function OutHintScript(str)
- Response.Write "<script language=JavaScript>" & vbCrLf
- Response.Write "alert('" & str & "');"
- Response.Write "location.replace('" & Request.ServerVariables("HTTP_REFERER") & "')" & vbCrLf
- Response.Write "</script>" & vbCrLf
- Response.End
- End Function
- Public Function OutAlertScript(str)
- Response.Write "<script language=javascript>" & vbcrlf
- Response.Write "alert('" & str & "');"
- Response.Write "history.back()" & vbcrlf
- Response.Write "</script>" & vbcrlf
- Response.End
- End Function
- End Class
- %>