全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

IP归属甄别会员请立即修改密码
查看: 1852|回复: 2
打印 上一主题 下一主题

一段ASP链接mssql数据库报错,求大神看看,

[复制链接]
跳转到指定楼层
1#
发表于 2014-3-28 10:49:34 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

                    <%
'**************************************************
'函数名: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
2#
发表于 2014-3-28 11:06:24 来自手机 | 只看该作者
表示只会html的路过来自: iPhone客户端
3#
发表于 2014-3-28 11:15:42 | 只看该作者
楼主这是想把星外的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
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2026-1-13 17:49 , Processed in 0.062140 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表