VBScript代码从包含';
我的一个用户的用户名中有一个' 我认为它正在破坏登录代码 在线 tempPassword=Request.Form(“用户密码”)VBScript代码从包含';,vbscript,Vbscript,我的一个用户的用户名中有一个' 我认为它正在破坏登录代码 在线 tempPassword=Request.Form(“用户密码”) 有什么解决方案可以解决这个问题?不要使用字符串连接来构建SQL查询。曾经你不仅会遇到这样的问题,还会使你容易受到伤害。使用(又名准备好的语句)代替: 不要使用字符串连接来构建SQL查询。曾经你不仅会遇到这样的问题,还会使你容易受到伤害。使用(又名准备好的语句)代替: if (Request.Form("Action") = "Login") then tem
有什么解决方案可以解决这个问题?不要使用字符串连接来构建SQL查询。曾经你不仅会遇到这样的问题,还会使你容易受到伤害。使用(又名准备好的语句)代替:
不要使用字符串连接来构建SQL查询。曾经你不仅会遇到这样的问题,还会使你容易受到伤害。使用(又名准备好的语句)代替:
if (Request.Form("Action") = "Login") then
tempUsername=Request.Form("UserName")
tempPassword=Request.Form("UserPassword")
if not (tempUserName = "") and not (tempPassword = "") then
strSQL="SELECT ContactID,Email,Password from Directory WHERE Email='" & tempUsername & "' AND Password='" & tempPassword & "'"
set rsQuery=cn.execute(strSQL)
if not (rsQuery.EOF) then
'-- Login correct, so set session variables
Session("CBWorkUser") = "Yes"
Session("CBWorkUserName") = rsQuery("Email")
Session("CBWorkID") = rsQuery("ContactID")
end if
set rsQuery = nothing
end if
end if
Set cmd = CreateObject("ADODB.Command")
cmd.ActiveConnection = cn
Set p1 = cmd.CreateParameter("@email" , 200, 1, 255, tempUsername)
cmd.Parameters.Append p1
Set p2 = cmd.CreateParameter("@password" , 200, 1, 255, tempPassword)
cmd.Parameters.Append p2
cmd.CommandText = "SELECT ContactID,Email,Password FROM Directory " _
& "WHERE Email=? AND Password=?"
Set rsQuery = cmd.Execute