ciao a tutti,
ho un problemino. Sto scrivendo un programma che in un file presenta queste righe di codice:
dim uip, uhost, check, stripcookie, oCn, oRs, rSql, coktime, cokdate
uip = Request.ServerVariables("REMOTE_ADDR")
uhost = Request.ServerVariables("REMOTE_HOST")
' Search Ip of the client machine in the database
Set oCn = DBConnexion(DB_MAIN)
rsql = "select sIP, sTime, sDate from stop_ip where sIP ='" & uip & "' and sStatus = 'a'"
Set oRs = DBRecordSet(oCn, rsql)
if oRs.EOF then
check = "allow"
else
check = "not_allow"
coktime = oRs("sTime")
cokdate = oRs ("sDate")
end if
oRs.close
set oRs = nothing
oCn.close
set oCn = nothing
' If Ip is found in database, then write cookie on client machine
if check <> "allow" then
if NOT request.cookies("yi").HasKeys then
response.Cookies("yi")("status") = "blocked"
response.Cookies("yi")("time") = coktime
response.Cookies("yi")("date") = cokdate
Response.Cookies("yi").Expires = Date + (5 * 365)
end if
end If
' If cookie is found on client machine, then update old ip with new ones
if request.cookies ("yi").Haskeys then
Set oCn = DBConnexion(DB_MAIN)
rsql = "select sIp from stop_ip where sTime = '" & request.cookies("yi")("time") & "' AND sDate = '" & request.cookies("yi")("date") & "'"
Set oRs = DBRecordSet(oCn, rsql)
if NOT oRs.EOF then
oRs.close
set oRs = nothing
oCn.close
set oCn = nothing
Set oCn = DBConnexion(DB_MAIN)
rsql = "update stop_ip SET sIP = '" & uip & "' where sTime = '" & request.cookies("yi")("time") & "' AND sDate = '" & request.cookies("yi")("date") & "'"
Set oRs = DBRecordSet(oCn, rsql)
oRs.close
set oRs = nothing
oCn.close
set oCn = nothing
end if
end if
if request.cookies("yi")("status") = "blocked" OR check <> "allow" then
response.redirect ("/not_allow.asp")
end if
%>
Ora, nella parte dove c'è scritto
Set oCn = DBConnexion(DB_MAIN)
rsql = "update stop_ip SET sIP = '" & uip & "' where sTime = '" & request.cookies("yi")("time") & "' AND sDate = '" & request.cookies("yi")("date") & "'"
Set oRs = DBRecordSet(oCn, rsql)
oRs.close
set oRs = nothing
oCn.close
set oCn = nothing
ci deve essere qualcosa che non va, in quanto, quando il file viene interpretato, il server restituisce il seguente errore:
ADODB.Recordset error '800a0e78'
Operation is not allowed when the object is closed.
/includes/stop_ip-inc.asp, line 63
Ora, qual'è il problema?Perchè dovrei lasciare la connessione aperta??
Saluti,
Carlo

Rispondi quotando