where id=$id
如果$id="1 or 1=1"的时候?
所以我认为还要对$id加上引号或者进行检查。

解决方案 »

  1.   

    这个函数就能解决!
     Function SafeRequest(ParaName,ParaType)
    '传入参数
    'ParaName:参数名称-字符型
    'ParaType:参数类型-数字型(1表示以上参数是数字,0表示以上参数为字符)
    if ParaName<>"" then
    Dim ParaValue
     
    ParaValue=TRIM(ParaName) If ParaType=1 then
    If not isNumeric(ParaValue) then
    Response.write "参数 <font color=#ff0000>" & ParaName & "</font> 必须为数字型!"
    Response.end
    End if
    Else
    ParaValue=replace(ParaValue,"'","''")
    End if
    end if
    SafeRequest=ParaValue
    End function