常用ASP自定義函數(shù)全集(3)_ASP教程

      編輯Tag賺U幣
      教程Tag:暫無Tag,歡迎添加,賺取U幣!

      推薦:解讀ASP常見錯(cuò)誤類型大全
      ActiveServerPages,ASP0126(0x80004005)--找不到包含文件 MicrosoftOLEDBProviderforODBCDrivers(0x80040E21)--sql語句出錯(cuò)(數(shù)據(jù)類型不匹配或表名(字段名)錯(cuò)誤或表處于編輯狀態(tài),或表不存在于conn打開的數(shù)據(jù)庫中) MicrosoftOLEDBProviderforODBCDrivers(0x800


      '防止SQL注入,為了系統(tǒng)的安全,直接在有數(shù)據(jù)庫連接的地方都加上SQL注入的免疫
      Function CheckSql()
           Dim sql_injdata  
           SQL_injdata = "'|and|exec|insert|select|delete|update|count|*|%|chr|mid|master|truncate|char|declare"
           SQL_inj = split(SQL_Injdata,"|")
           If Request.QueryString<>"" Then
               For Each SQL_Get In Request.QueryString
                   For SQL_Data=0 To Ubound(SQL_inj)
                       if instr(Request.QueryString(SQL_Get),Sql_Inj(Sql_DATA))>0 Then
      Response.Write "<Script Language='javascript'>{alert('請(qǐng)不要在參數(shù)中包含非法字符!');history.back(-1)}</Script>"
                           Response.end
                       end if
                   next
               Next
           End If
           If Request.Form<>"" Then
               For Each Sql_Post In Request.Form
                   For SQL_Data=0 To Ubound(SQL_inj)
                       if instr(Request.Form(Sql_Post),Sql_Inj(Sql_DATA))>0 Then
                           Response.Write "<Script Language='javascript'>{alert('請(qǐng)不要在參數(shù)中包含非法字符!');history.back(-1)}     </Script>"
                           Response.end
                       end if
                   next
               next
           end if
      End Function
      '--------------------------------
      '程序執(zhí)行時(shí)間檢測(cè)
      Function Runtime()
      EndTime=Timer()
      If EndTime<StartTime Then
           EndTime=EndTime+24*3600
      End if
      RunTime=(EndTime-StartTime)*1000   '單位毫秒
      End Function
      '--------------------------------

      分享:ASP實(shí)現(xiàn)長(zhǎng)文章手動(dòng)分頁的代碼
      % setrecordset1=server.createobject(adodb.recordset) exec=SELECT*FROMnewswhereid=id recordset1.Openexec,conn,1,1 % tablewidth=85%border=0align=centercellpadding=3cellspacing=0 trtd ....... % IfRequest(page)=Then pageNum=0

      來源:模板無憂//所屬分類:ASP教程/更新時(shí)間:2010-04-10
      相關(guān)ASP教程