全球主机交流论坛

标题: 一段ASP链接mssql数据库报错,求大神看看, [打印本页]

作者: 有容乃大    时间: 2014-3-28 10:49
标题: 一段ASP链接mssql数据库报错,求大神看看,

                    <%
'**************************************************
'函数名:Restr
'作  用:过滤非法的SQL字符
'参  数:strChar-----要过滤的字符
'返回值:过滤后的字符
'**************************************************
Function Restr(strChar)
    If strChar = "" Or IsNull(strChar) Then
        Restr = ""
        Exit Function
    End If
    Dim strBadChar, arrBadChar, tempChar, i
    strBadChar = "+,',%,^,&,?,(,),<,>,[,],{,},/,\,;,:," & Chr(34) & "," & Chr(0) & ",--,and,exec,insert,select,delete,update,count,*,%,chr,mid,master,truncate,char,declare"
    arrBadChar = Split(strBadChar, ",")
    tempChar = strChar
    For i = 0 To UBound(arrBadChar)
        tempChar = Replace(tempChar, arrBadChar(i), "")
    Next
    tempChar = Replace(tempChar, "@@", "@")
    Restr = trim(tempChar)
End Function


                                       
                       
                                                Set rs = Server.CreateObject("ADODB.Recordset")
                                                Set conn=Server.CreateObject("ADODB.Connection")
                                                conn.Open Application("FreeHostDBlink")
                                               
                                                xunweb.xunwebPages stype,typeid,conn,rs,skey
                                               
                                                if not rs.eof then
                                                dim typenames
                                               
                                               
                                                                                dim pageid,maxperpage,mpage,totalput,wn
                                       
                                                                                if trim(request("pageid"))<>"" then pageid = cint(request("pageid")) else pageid = 1
                                                                                if pageid = "" or pageid =< 1 then pageid = 1
                               
                                                                                maxperpage = 20  '每页显示资源数目
                                                                                rs.pagesize = maxperpage
                                                                                mpage = rs.pagecount       '得到总页数
                                                                                totalput = rs.recordcount  '得到总记录数
                                                                                rs.move(pageid-1)*maxperpage
                                       
                                                        if not rs.eof then
                                                                if stype = "1" then
                                                                        typenames = "按照行业分类 > <a href=""?stype=1&typeid="& typeid &""">" & rs("webTname") & "</a>"
                                                                elseif stype = "2" then
                                                                        typenames = "按照应用分类 > <a href=""?stype=2&typeid="& typeid &""">" & rs("proTname") & "</a>"
                                                                end if
                                                                if skey <> "" then
                                                                        typenames = typenames & "&nbsp;<font color=red>搜索关键词(" & skey &")</font>"
                                                                end if
                                                        end if       
                                                                               
                                                if stype = "" then stype = "0"
                                                if typeid = "" then typeid = "0"       
                                       
                                        %>

报错字段 红色标记

错误代码
Microsoft VBScript 运行时错误 错误 '800a01a8'

缺少对象: ''

/website.asp,行 141
作者: 爱卡    时间: 2014-3-28 11:06
表示只会html的路过
作者: wvidc    时间: 2014-3-28 11:15
楼主这是想把星外的phpweb插件单独安装?
在页头指定Application("FreeHostDBlink")
或在Global.asa中指定Application("FreeHostDBlink")

Application("FreeHostDBlink")="provider=sqloledb.1ersist Security Info=false;data source=数据库IP;User ID=数据库用户名;pwd=数据库用户名密码;Initial Catalog=数据库名"

然后第141行才能conn.Open Application("FreeHostDBlink")

另外楼主的这套是xunwang的需要绑定dll才能运行的非开源版 部分核心源代码写进了dll

本人写了一套开源版500元/套 见左侧qq




欢迎光临 全球主机交流论坛 (https://loc.mjj8.eu.org/) Powered by Discuz! X3.4