newasp中main类

网络编程 2025-04-04 17:13www.168986.cn编程入门

原文:

未知的世界:一场心灵的冒险之旅

我们生活在一个充满奇迹和神秘的世界里。每一个日出日落,每一次风吹过,都隐藏着无数的未知等待着我们去发现。今天,让我们一起踏上这场心灵的冒险之旅,勇敢地未知的世界。

第一章:启程的序曲

每一个伟大的家都有一个勇敢的心。他们愿意离开安逸的家园,面对未知的挑战。正是这种勇气,让他们不断前行,发现新的大陆,开拓新的领域。我们同样如此,拥有勇敢的心,愿意踏上这场冒险之旅。

第二章:跨越障碍

在未知的过程中,我们会遇到各种困难和挑战。有时候,我们可能会迷失方向,不知道前方的路在哪里。只要我们坚定信念,勇往直前,就一定能够跨越障碍,找到新的方向。正是这些挑战,让我们变得更加坚强和勇敢。

第三章:收获与发现

在冒险的过程中,我们会收获许多宝贵的经验和知识。每一次新的发现,都会让我们感到兴奋和满足。这些收获不仅让我们更加了解这个世界,还让我们更加了解自己。我们会发现自己的潜力是无限的,只要勇敢面对未知,就一定能够创造奇迹。

第四章:分享与传承

未知的世界不仅仅是为了自己,更是为了与他人分享和传承。我们会将所见的风景、所经历的冒险、所收获的知识分享给更多的人。我们的故事会激励更多的人踏上之旅,共同发现这个美好而神秘的世界。

未知的世界是一场心灵的冒险之旅。让我们勇敢前行,不断跨越障碍,收获知识,分享故事。让我们一起创造更多的奇迹,发现更广阔的世界。

跃入未知的海洋:心灵的壮丽篇章

我们的世界宛如浩瀚的海洋,深邃且神秘。每一次潮起潮落,每一缕飘渺的风,都携带着无尽的奥秘等待我们去揭开面纱。此刻,让我们共同启航,展开这场激荡心灵的大冒险,勇敢地跃入未知的世界。

序章:启程的钟声

伟大的家们心中都燃烧着炽热的勇气。他们舍弃安逸的港湾,迎接未知的挑战。正是这份无畏的勇气,引领他们踏足新大陆,开拓疆界。我们亦如此,怀揣勇气,准备踏上这场冒险之旅。

第一章:乘风破浪

在的旅途中,我们将遭遇无数艰难险阻。或许有时我们会迷失方向,不知前路何在。只要我们坚定信念,勇往直前,便一定能冲破迷雾,找到新的航向。这些挑战将锻炼我们的意志,让我们更加坚韧不拔。

第二章:收获与奇迹

冒险的旅途中,我们将收获无数珍贵的经验和知识。每一次新的发现,都将令我们欣喜若狂。这些收获将让我们更加深刻地了解这个世界,也将让我们更加清晰地认识自己。我们会发现,只要我们勇敢面对未知,我们的潜力便是无穷的。

第三章:分享荣耀

未知的世界不仅是为了自己,更是为了与他人分享这份荣耀。我们将把所见的美景、所经历的冒险、所获得的知识分享给更多的人。我们的故事将激励更多的人踏上的征程,共同揭开这个奇妙世界的神秘面纱。

终章:冒险的韵律

```python

定义一个名为newaspMain_Cls的类

class newaspMain_Cls:

公共成员变量

public membername, memberpass, membergrade, membergroup, memberid

public memberclass, menbernickname, Cookies_Name, CheckPassword

public SiteName, SiteUrl, MasterMail, keywords, Copyright

public InstallDir, IndexName, IsSite, SReadme, IsCloseMail

public SendMailType, MailFrom, MailServer, MailUserName, MailPassword, MailInformPass, ChkSameMail

public CheckUserReg, AdminCheckReg, AddUserPoint, SendRegMessage, FullContQuery, ActionTime

public IsRunTime, UploadClass, UploadFileSize, UploadFileType, ContentKeyword, PreviewSetting

public SApplyLink, FSO_ScriptName, InitTitleColor, SBankPay

public ChinaeBank, VersionID, Badwords, Badwordr, serialcode, passedcode

public ChannelName, ChannelDir, SChannel, ChannelType

public modules, ChannelSkin, HtmlPath, HtmlForm, HtmlPrefix

public IsCreateHtml, HtmlExtName, SUpload, MaxFileSize, UpFileType

public IsAuditing, AppearGrade, ModuleName, BindDomain, DomainName

public PostGrade, LeastString, MaxString, PaginalNum, LeastHotHist, Channel_Setting

public ChannelSetting, ChannelData, ChannelPath

public ChannelModule, ChannelHtmlPath, ChannelHtmlForm, ChannelUseHtml, ChannelHtmlExt, ChannelPrefix

public ThisEdition, CopyrightStr, Version, Values

public startime

public SqlQueryNum ,GetUserip ,CacheName ,Reloadtime

public ScriptName ,Admin_Page ,skinid ,SkinPath ,HtmlCss ,HtmlTop ,HtmlFoot ,HtmlContent ,sHtmlContent

私有成员变量

private Main_Style , Main_Setting , MainStyle , Html_Setting

private LocalCacheName , Cache_Data

private CacheChannel , CacheData

private arrGroupSetting , blnGroupSetting , binUserLong

初始化类的方法,包含错误处理和部分变量初始化等。

def Class_Initialize():

响应与操作

响应之笔舞动命令之舞,编写的是流畅的操作逻辑。若执行过程中出现空白状态,立即执行特定的频道配置重载操作。这是我们的系统管理的核心流程,确保每一次操作都准确无误。以下是详细解读:

配置读取流程

```asp

' 函数名: ExitSub

' 作用: 退出子程序

' 参数: 无

'

Sub ExitSub

End If

Value = Rs.GetRows(1)

Set Rs = Nothing

End Sub

' 过程名: ReadChannel

' 作用: 读取频道设置

' 参数: ChannelID - 频道ID

'

Public Sub ReadChannel(ByVal ChannelID As Integer)

On Error Resume Next

If Not IsNumeric(ChannelID) Then

ChannelID = 1

End If

ChannelID = CLng(ChannelID)

Dim Name As String

Name = "Channel" & ChannelID

If ObjIsEmpty() Then

Call ReloadChannel(ChannelID)

End If

CacheChannel = Value

If CLng(CacheChannel(0, 0)) <> ChannelID Then

Call ReloadChannel(ChannelID)

CacheChannel = Value

End If

ChannelName = CacheChannel(1, 0): ChannelDir = CacheChannel(2, 0): SChannel = CacheChannel(3, 0): ChannelType = CacheChannel(4, 0): modules = CacheChannel(5, 0): ModuleName = CacheChannel(6, 0): BindDomain = CacheChannel(7, 0): DomainName = CacheChannel(8, 0): ChannelSkin = CacheChannel(9, 0): HtmlPath = CacheChannel(10, 0)

HtmlForm = CacheChannel(11, 0): IsCreateHtml = CacheChannel(12, 0): HtmlExtName = CacheChannel(13, 0): HtmlPrefix = CacheChannel(14, 0): SUpload = CacheChannel(15, 0): MaxFileSize = CacheChannel(16, 0): UpFileType = CacheChannel(17, 0): IsAuditing = CacheChannel(18, 0): AppearGrade = CacheChannel(19, 0)

PostGrade = CacheChannel(20, 0): LeastString = CacheChannel(21, 0): MaxString = CacheChannel(22, 0): PaginalNum = CacheChannel(23, 0): LeastHotHist = CacheChannel(24, 0): Channel_Setting = CacheChannel(25, 0)

If CInt(SChannel) = 1 And Not Admin_Page Then

Response.Redirect(InstallDir & "showerr.asp?action=ChanS")

End If

End Sub

' 过程名: LoadChannel

' 作用: 加载频道信息

' 参数: chanid - 频道ID

'

Public Sub LoadChannel(ByVal chanid As Integer)

On Error Resume Next

Dim Rs, SQL, tmpdata

chanid = CLng(chanid)

Dim Name As String

Name = "MyChannel" & chanid

If ObjIsEmpty() Then

SQL = "SELECT ChannelName,ChannelDir,ModuleName,HtmlPath,HtmlForm,IsCreateHtml,HtmlExtName,HtmlPrefix,SUpload,LeastString,MaxString,LeastHotHist FROM NC_Channel WHERE ChannelType<=1 And ChannelID=" & chanid

Set Rs = Execute(SQL)

tmpdata = Rs.GetString(, , "|||", "@@@", "")

tmpdata = Left(tmpdata, Len(tmpdata) - 3)

Set Rs = Nothing

Value = tmpdata

End If

Dim ChannelData() As String

ChannelData = Split(Value, "|||")

ChannelPath = InstallDir & ChannelData(1)

ChannelModule = ChannelData(2)

ChannelHtmlPath = ChannelData(3)

ChannelHtmlForm = ChannelData(4)

ChannelUseHtml = ChannelData(5)

ChannelHtmlExt = ChannelData(6)

ChannelPrefix = ChannelData(7)

End Sub

' 过程名: LoadTemplates

' 作用: 载入模板

' 参数: Page_Mark - StyleID

'

Public Sub LoadTemplates(ByVal ChannelID As Integer, ByVal pageid As Integer, ByVal StyleID As String)

Dim rstmp, TempSkinID

On Error Resume Next

ChannelID = CLng(ChannelID)

pageid = CInt(pageid)

Dim Name As String

Name = "DefaultSkinID"

If ObjIsEmpty() Then

Set rstmp = Execute("SELECT skinid from [NC_Template] where pageid = 0 And isDefault = 1")

Value = rstmp(0)

Set rstmp = Nothing

End If

TempSkinID = Value

If StyleID = 0 Or StyleID = "" Then

skinid = TempSkinID

Else

Set rstmp = Execute("SELECT skinid from [NC_Template] where pageid = 0 And skinid = " & StyleID)

If Not rstmp.EOF Then

skinid = rstmp(0)

Else

skinid = TempSkinID

End If

Set rstmp = Nothing

End If

skinid = CLng(skinid)

Name = "MainStyle" & skinid

If ObjIsEmpty() Then

TemplatesMainCache(skinid)

End If

Main_Style = Value

SkinPath = Main_Style(0, 0)

Main_Setting = Split(Main_Style(2, 0), "|||")

MainStyle = Main_Style(1, 0)

MainStyle = Replace(MainStyle, "{$InstallDir}", ReadInstallDir(BindDomain))

MainStyle = Replace(MainStyle, "{$SkinPath}", SkinPath)

MainStyle = Split(MainStyle, "|||")

HtmlCss = MainStyle(0)

HtmlTop = MainStyle(1)

HtmlFoot = MainStyle(2)

If pageid <> 0 Then

Name = "Templates" & ChannelID & skinid & pageid

If ObjIsEmpty() Then

TemplatesToCache(ChannelID, pageid)

End If

ByValue = Value

End If

End Sub

' 函数名: FormEncode

' 作用: 对提交的表单数据进行过滤

' 参数: str - 原字符串, n - 字符长度

'

Public Function FormEncode(ByVal str As String, ByVal n As Integer) As String

If Not IsNull(str) And Trim(str) <> "" Then

str = Left(str, n)

str = Replace(str, ">", "&gt;")

str = Replace(str, "<", "&lt;")

str = Replace(str, "&62;", "&gt;")

str = Replace(str, "&60;", "&lt;")

str = Replace(str, "'", "&39;")

str = Replace(str, Chr(34), "&quot;")

str = Replace(str, "%", "%")

str = Replace(str, vbNewLine, "")

FormEncode = Trim(str)

Else

FormEncode = ""

End If

End Function

' 函数名: ChkKeyWord

' 作用: 过滤关键字

' 参数: keyword - 关键字

'

Public Function ChkKeyWord(ByVal keyword As String) As String

Dim FobWords() As Variant, i As Integer

On Error Resume Next

FobWords = Array(91, 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, 65339, 65340)

For i = 1 To UBound(FobWords, 1)

If InStr(keyword, ChrW(FobWords(i))) > 0 Then

keyword = Replace(keyword, ChrW(FobWords(i)), "")

End If

Next

keyword = Left(keyword, 100)

FobWords = Array("~", "!", "@", "", "$", "%", "^", "&", "", "(", ")", "_", "+", "=", "`", "[", "]", "{", "}", ";", ":", """", "'", ",", "<", ">", ".", "/", "\", "?", "_")

For i = 0 To UBound(FobWords, 1)

If InStr(keyword, FobWords(i)) > 0 Then

keyword = Replace(keyword, FobWords(i), "")

End If

Next

ChkKeyWord = keyword

End Function

' 函数名: JAPEncode

' 作用: 日文片假名编码

' 参数: str - 原字符

'

Public Function JAPEncode(ByVal str As String) As String

Dim FobWords() As Variant, i As Integer

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

' 函数名: JAPUncode

' 作用: 日文片假名解码

' 参数: str - 原字符

'

Public Function JAPUncode(ByVal str As String) As String

Dim FobWords() As Variant, i As Integer

On Error Resume Next

If IsNull(str) Or Trim(str) = "" Then

JAPUncode = ""

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, "&" & FobWords(i) & ";") > 0 Then

str = Replace(str, "&" & FobWords(i) & ";", ChrW(FobWords(i)))

End If

Next

str = Replace(str, Chr(0), "")

str = Replace(str, "'", "''")

JAPUncode = str

End Function

' 函数名: ChkBadWords

' 作用: 带脏话过滤

'

Public Function ChkBadWords(ByVal str As String) As String

If IsNull(str) Then Exit Function

Dim i As Integer, Bwords() As String, Bwordr() As String

Bwords = Split(Badwords, "|")

Bwordr = Split(Badwordr, "|")

For i = 0 To UBound(Bwords)

If i > UBound(Bwordr) Then

str = Replace(str, Bwords(i), "")

Else

str = Replace(str, Bwords(i), Bwordr(i))

End If

Next

ChkBadWords = str

End Function

' 函数名: HTMLEncode

' 作用: 过滤HTML代码,带脏话过滤

'

Public Function HTMLEncode(ByVal fString As String) As String

If Not IsNull(fString) Then

fString = Replace(fString, ">", "&gt;")

fString = Replace(fString, "<", "&lt;")

fString = Replace(fString, Chr(32), " ")

fString = Replace(fString, Chr(9), " ")

fString = Replace(fString, Chr(34), "&quot;")

fString = Replace(fString, Chr(39), "&39;")

fString = Replace(fString, Chr(13), "")

fString = Replace(fString, " ", "&nbsp;")

fString = Replace(fString, Chr(10), "
")

fString = ChkBadWords(fString)

HTMLEncode = fString

End If

End Function

安全系统提示:防范非法字符入侵

在历史的长河中,我们的网站始终与时俱进,不断进步。与此我们也深知网络安全的重要性,特别是对于数据的保护。今天,让我们深入一个关键话题:如何有效预防非法字符入侵我们的系统参数。每当用户在提交表单或传递参数时,我们必须确保这些操作的安全性。为此,我们编写了一系列的安全措施来阻止非法字符的入侵。

在关键的函数执行过程中,我们的系统首先会检查传入的字符串参数是否包含潜在的危险字符。这些危险字符包括但不限于 `' `、`;`、`^`、`and`、`exec` 等,它们可能被恶意用户利用来执行SQL注入或其他形式的攻击。这些特定的字符组合被视为风险极高,因此系统会进行严格的过滤和检查。一旦检测到这些非法字符,系统会立即采取行动。

当检测到非法字符时,系统会立即执行一系列操作以确保安全。系统会触发JavaScript脚本生成一个警告弹窗,通知用户存在安全威胁。然后,系统会向后导航到上一页,以防止潜在的恶意操作。系统还会清空当前的处理结果并终止响应。这些都是为了最大程度地保护我们的系统和用户的数据安全。

在`PreventInfuse`子程序中,我们使用了错误处理机制来应对可能的异常情况。如果在检查过程中遇到错误,系统会清除错误并发出相应的警告信息。为了确保系统的高可用性,我们设置了错误恢复机制以应对可能的系统故障。这种多层次的安全防护策略旨在为用户提供最安全、最可靠的在线体验。

我们的团队深知安全的重要性,因此我们始终致力于提高系统的安全性并防止任何形式的攻击。我们深知每一个用户都珍视自己的数据安全,因此我们承诺会不遗余力地保护用户的隐私和数据安全。在这个过程中,我们鼓励用户也积极参与到安全建设中来,遵循我们的建议并正确使用我们的系统和服务。我们相信通过共同努力,我们能够构建一个更加安全、更加可靠的在线环境。

在历史的长河中,每一次点击都承载着用户的期待与。在这背后,我们的安全系统始终如一地守护着每一个用户的网络安全。当您浏览我们的网站时,一段静默的幕后剧情正在上演。

当您尝试通过URL参数与我们的服务器交流时,安全警报已然启动。每当Request.QueryString中传来您的请求,我们都会对其内容进行严格的审查。我们不允许任何非法字符的混入,因为这关系到您的网络安全。

代码中的这段逻辑正是为了守护这份安全。当您的请求到达时,我们首先检查QueryString是否为空。如果其中包含了某些特定的字符或字符串(这些被存储在arrNonlicet数组中),我们就会启动一系列的检测。这些检测是为了确保您的请求不包含任何非法字符。一旦检测到非法字符的存在,我们的服务器就会立即采取行动。

此刻,您可能会收到一个来自服务器的JavaScript弹窗警告:“安全系统提示↓请不要在参数中包含非法字符!”这是我们在向您发出提醒,希望您能意识到网络安全的重要性。我们始终致力于保护您的网络安全,确保您的每一次点击都能得到安全可靠的回应。

在这个数字化的世界里,网络安全如同坚固的城墙,守护着每一位用户的隐私与权益。我们深知每一个细节的重要性,因此我们会不遗余力地保护您的网络安全。在这个旅途中,我们希望能得到您的理解与配合,共同构建一个更加安全的网络环境。这段代码看起来像是VBScript,用于处理网站或服务器的各种功能,如生成文件名、读取图片或Flash、处理日期和时间格式、处理支付和折扣等。我会尽量在不改变原始功能的前提下,让文本更加流畅和吸引人。

函数名:ReadFileUrl

作用: 读取文件URL。

描述: 此函数接收一个URL作为参数,并尝试它。如果URL有效,则返回处理后的URL;如果URL无效,则返回默认的图片路径。

函数名:GetFlashAndPic

作用: 获取图片或Flash的HTML代码。

描述: 这个函数根据提供的URL生成一个包含图片或Flash的HTML代码。如果URL指向的是一个Flash文件,则生成一个embed标签;如果指向的是图片,则生成一个img标签。

函数名:ReadFileName

作用: 读取HTML文件名。

描述: 这个函数根据提供的参数生成一个HTML文件名。它考虑了各种格式和前缀,并根据不同的参数生成不同的文件名。

函数名:HtmlRndFileName

作用: 生成随机的HTML文件名。

描述: 这个函数使用当前日期和时间以及一个随机数来生成一个唯一的HTML文件名。

函数名:ClassFileName

作用: 读取HTML文件列表名。

描述: 这个函数根据分类ID生成一个HTML文件列表名。它考虑了不同的格式和前缀,并生成了一个符合特定格式的文件名。

函数名:SpecialFileName

作用: 读取专题HTML文件名。

描述: 这个函数根据专题ID生成一个HTML文件名。它同样考虑了不同的格式和前缀,并生成了一个符合特定格式的文件名。

函数名:ChannelMenu

作用: 显示频道菜单。

描述: 这个函数生成一个频道菜单,从数据库中获取频道的各种信息,包括名称、颜色、字体、URL等,并生成一个包含这些信息的HTML菜单。

1. 读取和写入文件

`CreatedTextFile(FileName, body)`: 创建一个文本文件,并写入指定内容。

`Readfile(fromPath)`: 读取指定文件的内容。

2. 复制文件和文件夹

`CopyToFile(SoureFile, NewFile)`: 复制一个文件到新的位置。

`CopyToFolder(SoureFolder, NewFolder)`: 复制一个文件夹到新的位置。

3. 删除文件和文件夹

`FileDelete(FilePath)`: 删除一个文件。

`FolderDelete(FolderPath)`: 删除一个文件夹及其所有内容。

4. 处理字符串

`CutMatchContent(str, start, last, Condition)`: 从字符串中截取匹配的内容。

`CutFixContent(str, start, last, n)`: 根据指定的起始和结束字符截取字符串。

5. 数据库查询

`LoadSelectClass(ChannelID)`: 从数据库中获取频道分类信息。

`UserGroupSetting(gradeid)`: 获取用户组权限设置。

6. 验证码和其他功能

`GetRandomCode()`: 生成随机代码。

`CodeIsTrue()`: 验证提交的验证码是否正确。

`CheckAdmin(Flag)`: 检查管理员权限。

7. 其他功能

`ReadContent(strContent)`: 对字符串进行各种处理,如去除危险脚本、替换特定标记等。

`CheckPath(sPath)`: 检查并修正文件路径。

`CreatPathEx(sPath)`: 创建文件夹路径。

```vbscript

' 读取和写入文件

Public Function CreatedTextFile(FileName As String, body As String)

If InStr(FileName, ":") = 0 Then

FileName = Server.MapPath(FileName)

End If

Dim fso, f

Set fso = Server.CreateObject(FSO_ScriptName)

Set f = fso.CreateTextFile(FileName)

f.WriteLine body

f.Close

Set f = Nothing

Set fso = Nothing

End Function

Public Function Readfile(fromPath As String) As String

If InStr(fromPath, ":") = 0 Then

fromPath = Server.MapPath(fromPath)

End If

Dim fso, f, strTemp

Set fso = Server.CreateObject(FSO_ScriptName)

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

End Function

' 复制文件和文件夹

Public Function CopyToFile(SoureFile As String, NewFile As String)

If InStr(SoureFile, ":") = 0 Then

SoureFile = Server.MapPath(SoureFile)

End If

If InStr(NewFile, ":") = 0 Then

NewFile = Server.MapPath(NewFile)

End If

Dim fso

Set fso = Server.CreateObject(FSO_ScriptName)

If fso.FileExists(SoureFile) Then

fso.CopyFile SoureFile, NewFile

End If

Set fso = Nothing

End Function

Public Function CopyToFolder(SoureFolder As String, NewFolder As String)

If InStr(SoureFolder, ":") = 0 Then

SoureFolder = Server.MapPath(SoureFolder)

End If

If InStr(NewFolder, ":") = 0 Then

NewFolder = Server.MapPath(NewFolder)

End If

Dim fso

Set fso = Server.CreateObject(FSO_ScriptName)

If fso.FolderExists(SoureFolder) Then

fso.CopyFolder SoureFolder, NewFolder

End If

Set fso = Nothing

End Function

' 删除文件和文件夹

Public Function FileDelete(FilePath As String) As Boolean

If InStr(FilePath, ":") = 0 Then

FilePath = Server.MapPath(FilePath)

End If

Dim fso

Set fso = Server.CreateObject(FSO_ScriptName)

If fso.FileExists(FilePath) Then

fso.DeleteFile FilePath, True

FileDelete = True

End If

Set fso = Nothing

End Function

Public Function FolderDelete(FolderPath As String) As Boolean

If InStr(FolderPath, ":") = 0 Then

FolderPath = Server.MapPath(FolderPath)

End If

Dim fso

Set fso = Server.CreateObject(FSO_ScriptName)

If fso.FolderExists(FolderPath) Then

fso.DeleteFolder FolderPath, True

FolderDelete = True

End If

Set fso = Nothing

End Function

' 处理字符串

Public Function CutMatchContent(str As String, start As String, last As String, Condition As Boolean) As String

Dim Match, s, re, FilterStr, MatchStr, strContent, ArrayFilter, i, n, bRepeat

If Len(start) = 0 Or Len(last) = 0 Then

Exit Function

End If

MatchStr = "(" & CorrectPattern(start) & ")(.+?)(" & CorrectPattern(last) & ")"

Set re = New RegExp

re.IgnoreCase = True

re.Global = True

re.Pattern = MatchStr

Set s = re.Execute(str)

n = 0

For Each Match In s

If n = 0 Then

n = n + 1

ReDim ArrayFilter(n)

ArrayFilter(n) = Match

Else

bRepeat = False

For i = 0 To UBound(ArrayFilter)

If UCase(Match) = UCase(ArrayFilter(i)) Then

bRepeat = True

Exit For

End If

Next

If bRepeat = False Then

n = n + 1

ReDim Preserve ArrayFilter(n)

ArrayFilter(n) = Match

End If

End If

Next

Set s = Nothing

Set re = Nothing

If Condition Then

strContent = Join(ArrayFilter, "|||")

Else

strContent = Replace(Join(ArrayFilter, "|||"), start, "")

strContent = Replace(strContent, last, "")

End If

CutMatchContent = Replace(strContent, "|||", vbNullString, 1, 1)

End Function

Public Function CutFixContent(str As String, start As String, last As String, n As Integer) As String

Dim strTemp

If InStr(str, start) > 0 Then

Select Case n

Case 0 '左右都截取(都取前面)(去处关键字)

strTemp = Right(str, Len(str) - InStr(str, start) - Len(start) + 1)

strTemp = Left(strTemp, InStr(strTemp, last) - 1)

Case Else '左右都截取(都取前面)(保留关键字)

strTemp = Right(str, Len(str) - InStr(str, start) + 1)

strTemp = Left(strTemp, InStr(strTemp, last) + Len(last) - 1)

End Select

Else

strTemp = ""

End If

CutFixContent = strTemp

End Function

Private Function CorrectPattern(str As String) As String

str = Replace(str, "\", "\\")

str = Replace(str, "~", "\~")

str = Replace(str, "!", "\!")

str = Replace(str, "@", "\@")

str = Replace(str, "", "\")

str = Replace(str, "%", "\%")

str = Replace(str, "^", "\^")

str = Replace(str, "&", "\&")

str = Replace(str, "", "\")

str = Replace(str, "(", "\(")

str = Replace(str, ")", "\)")

str = Replace(str, "-", "\-")

str = Replace(str, "+", "\+")

str = Replace(str, "[", "\[")

str = Replace(str, "]", "\]")

str = Replace(str, "<", "\<")

str = Replace(str, ">", "\>")

str = Replace(str, ".", "\.")

str = Replace(str, "/", "\/")

str = Replace(str, "?", "\?")

str = Replace(str, "=", "\=")

str = Replace(str, "|", "\|")

str = Replace(str, "$", "\$")

CorrectPattern = str

End Function

' 数据库查询

Public Function LoadSelectClass(ChannelID As Integer) As String

Dim CacheSelClass, SQL, Rs1, i

Name = "SelectClass" & ChannelID

If ObjIsEmpty() Then

SQL = "select ClassID,ClassName,depth,TurnLink,child from NC_Classify where ChannelID = " & ChannelID & " order by rootid,orders"

Set Rs1 = Execute(SQL)

If Rs1.BOF And Rs1.EOF Then

CacheSelClass = CacheSelClass & ""

Else

Do While Not Rs1.EOF

If Rs1("TurnLink") <> 0 Then

CacheSelClass = CacheSelClass & "

Else

If Rs1("depth") = 0 And Rs1("child") <> 0 Then

CacheSelClass = CacheSelClass & "

Else

CacheSelClass = CacheSelClass & "

End If

End If

CacheSelClass = CacheSelClass & " {ClassID=" & Rs1("ClassID") & "}>"

If Rs1("depth") = 1 Then CacheSelClass = CacheSelClass & " ├ "

If Rs1("depth") > 1 Then

For i = 2 To Rs1("depth")

CacheSelClass = CacheSelClass & " "

Next

CacheSelClass = CacheSelClass & " ├ "

End If

CacheSelClass = CacheSelClass & Rs1("ClassName") & "" & vbCrLf

Rs1.MoveNext

Loop

End If

Rs1.Close

Set Rs1 = Nothing

Value = CacheSelClass

End If

LoadSelectClass = Value

End Function

Public Function UserGroupSetting(gradeid As Integer) As String

If Not IsNumeric(gradeid) Then

gradeid = 0

End If

Dim Rs, SQL

Name = "GroupSetting" & gradeid

If ObjIsEmpty() Then

SQL = "Select Groupname,GroupSet from [NC_UserGroup] where Grades =" & gradeid

Set Rs = Execute(SQL)

If Rs.BOF And Rs.EOF Then

UserGroupSetting = ""

Set Rs = Nothing

Exit Function

Else

Value = Rs("GroupSet") & Rs("Groupname")

Set Rs = Nothing

End If

End If

UserGroupSetting = Value

End Function

Private Sub LoadGroupSetting()

Dim strGroupSetting, Rs, SQL, Grades

Grades = CInt(membergrade)

If Grades > 0 And memberid > 0 Then

If binUserLong = False Then

Set Rs = Execute("SELECT userid FROM [NC_User] WHERE password='" & CheckRequest(memberpass, 45) & "' And UserGrade=" & Grades & " And UserLock=0 And userid =" & memberid)

If Rs.BOF And Rs.EOF Then

Grades = 0

Response.Cookies(Cookies_Name) = ""

binUserLong = False

Else

binUserLong = True

End If

Set Rs = Nothing

End If

End If

Name = "GroupSetting" & Grades

If ObjIsEmpty() Then

SQL = "Select Groupname,GroupSet from [NC_UserGroup] where Grades =" & Grades

Set Rs = Execute(SQL)

If Rs.BOF And Rs.EOF Then

Response.Cookies(Cookies_Name) = ""

Set Rs = Nothing

Exit Sub

Else

Value = Rs("GroupSet") & Rs("Groupname")

Set Rs = Nothing

End If

End If

blnGroupSetting = True

strGroupSetting = Value

arrGroupSetting = Split(strGroupSetting, "|||")

End Sub

Public Property Get GroupSetting(i As Integer) As String

If Not blnGroupSetting Then LoadGroupSetting

GroupSetting = arrGroupSetting(i)

End Property

Public Function ReadContent(strContent As String) As String

Dim re, i, sContentKeyword, strKeyword

Set re = New RegExp

re.IgnoreCase = True

re.Global = True

'过滤危险脚本

re.Pattern = "(<s+cript(.[^>])>)"

strContent = re.Replace(strContent, "&lt;&83cript$2&gt;")

re.Pattern = "(<\/s+cript>)"

strContent = re.Replace(strContent, "&lt;/&83cript&gt;")

re.Pattern = "(<body(.[^>])>)"

strContent = re.Replace(strContent, "<body>")

re.Pattern = "(<\!(.[^>])>)"

strContent = re.Replace(strContent, "&lt;$2&gt;")

re.Pattern = "(<\!)"

strContent = re.Replace(strContent, "&lt;!")

re.Pattern = "(-->)"

strContent = re.Replace(strContent, "--&gt;")

re.Pattern = "(javascript:)"

strContent = re.Replace(strContent, "<i>javascript</i>:")

If Trim(ContentKeyword) <> "" Then

sContentKeyword = Split(ContentKeyword, "@@@")

For i = 0 To UBound(sContentKeyword) - 1

strKeyword = Split(sContentKeyword(i), "$$$")

re.Pattern = "(" & strKeyword(0) & ")"

strContent = re.Replace(strContent, "<a target=""_blank"" href=""" & strKeyword(1) & """ class=""wordstyle"">$1</a>")

Next

End If

re.Pattern = "(\[i\])(.[^\[])(\[\/i\])"

strContent = re.Replace(strContent, "<i>$2</i>")

re.Pattern = "(\[u\])(.[^\[])(\[\/u\])"

strContent = re.Replace(strContent, "<u>$2</u>")

re.Pattern = "(\[b\])(.[^\[])(\[\/b\])"

strContent = re.Replace(strContent, "<b>$2</b>")

re.Pattern = "(\[fly\])(.)(\[\/fly\])"

strContent = re.Replace(strContent, "<marquee>$2</marquee>")

re.Pattern = "\[size=([1-9])\](.[^\[])\[\/size\]"

strContent = re.Replace(strContent, "<font size=$1>$2</font>")

re.Pattern = "(\[center\])(.[^\[])(\[\/center\])"

strContent = re.Replace(strContent, "<center>$2</center>")

're.Pattern = "<IMG.[^>]SRC(=| )(.[^>])>"

'strContent = re.Replace(strContent, "<IMG SRC=$2 border=""0"">")

re.Pattern = "<img(.[^>])>"

strContent = re.Replace(strContent, "<img$1 onload=""return imgzoom(this,550)"">")

re.Pattern = "\[DIR=([0-9]),([0-9])\](.[^\[])\[\/DIR\]"

strContent = re.Replace(strContent, "<embed src=$3 pluginspage= width=$1 height=$2></embed>")

re.Pattern = "\[QT=([0-9]),([0-9])\](.[^\[])\[\/QT\]"

strContent =

上一篇:Laravel框架路由与MVC实例详解 下一篇:没有了

Copyright © 2016-2025 www.168986.cn 狼蚁网络 版权所有 Power by