Simple ASP imitation

xiaoxiao2021-03-06  37

Now I found that the ASP can also write some classes themselves, and basically and other languages, so I wrote a try, hehe! A year! <% Class clsDSJ Private p_Error, p_Author, p_WebURL Public Property Get Version Version = "DSJ 1.0.0 Beta" End Property Public Property Get Error Error = p_Error End Property Public Property Get Author Author = p_Author End Property Public Property Let Author (strAuthor) strAuthor = Trim (strAuthor) If strAuthor = "" Then p_Author = "Gu Jian" Else p_Author = CStr (strAuthor) End If End Property Public Property Get WebURL WebURL = p_WebURL End Property Public Property Let WebURL (URL) URL = Trim (URL IF URL = "" THEN P_WEBURL = "http://www.blog.9cbs.net/alonesword/" Else IF LCase (CSTR (Left (URL, 7))) <> "http: //" THEN P_WEBURL = "http: //" & url else p_weburl = url end if End if End Property properties Sub class_initialize p_author = "Sword" WebURL = "http://www.blog.9cbs.net/alonesword/" p_ERROR = -1 End Sub Private Sub Class_Terminate End Sub Public Function G OTTOPIC (STR, STRLEN) REM Limits String Displays the length in a certain range DIM I, STRINGLEN, CHARSI, Echochartype Stringlen = LEN (STR) Charsize = 0 for i = 1 to stringlen echochartype = ABS (ASC (Str, I, 1))) IF Echochartype> 255 Then Charsize = Charsize 2 Else Charsize = Charsize 1 Endiffic = LEFT (STR, I) & "..." EXIT for else gottopic = STR & "End if Next end function"

****************************** The name: chkinvaildwords' parameter: words' Return Value: True / falsh 'effect: Check parameters Is there an illegal character '***************************** FUNCTION ChKWORDS (Words) REM definition requires filtering illegal character const information invaildwords = "SELECT | Update | DELETE | INSERT | @ | - |, | '| # |%" chkwords = true infaildword = split (invaildwords, "|") inWords = LCase (Trim (words)) for i = lbound (InvaildWord ) To UBound (InvaildWord) If Instr (inWords, InvaildWord (i))> 0 Then p_Error = 0 ChkWords = False Exit Function End If Next ChkWords = True End Function Function DividedPage (objRs, perPageSize, CurrentPage) objRs.Pagesize = perPageSize TotalPage = objrs.pagecount if ISempty (perpageSize) Then p_error = 1 response.write (" Parameter can not be empty!
") Response.end () exit function elseif (ISNUMERIC (CURRENTPAGE) = false) THEN P_ERROR = 2 response.write (" Parameter can't be empty!
") Response.end () EXIT FUNCTION END IF CLNG (CURRENTPAGE ) <1 Then CurrentPage = 1 End If If CLng (CurrentPage)> TotalPage Then CurrentPage = TotalPage End If If TotalPage> 0 Then objRs.AbsolutePage = CurrentPage End If Items = 1 Do While Not objRs.Eof Response.Write (Items) objRs .MOVENEXT loop end function 'November 27, 2004 End classdim dsjset dsj = new clsdsj%>

转载请注明原文地址:https://www.9cbs.com/read-83473.html

New Post(0)