<%
IP=Request.ServerVariables("REMOTE_ADDR")
nome=request("nome")
password=request("password")
set sql = conn.execute("select nick,arresti,ip from utenti where nick like '"&nome&"' and pass like '"&password&"'")
if sql.eof then
Conn.close
set sql=Nothing
Response.Redirect("entra.asp?errore=1")
End if
set pg=sql.fields("nick")
set arresti=sql.fields("arresti")
set IPdb=sql.fields("ip")
if arresti="no" then
set sql2 = conn.execute("select * from entra where nome like'"&pg&"'")
if sql2.eof then
set sql=conn.execute("insert into entra (nome) values('"&pg&"')")
end if
set sql2=Nothing
end if
data = Year(date) & "/" & Month(date) & "/" & Day(date)
ora= Hour(time)
set connip=Conn.execute("update utenti set ip='"&IP&"', ultimaentratadata='"&data&"', ultimaentrataora='"&ora&"' where nick='"&pg&"'")
Conn.Close
set connip=Nothing
set sql=Nothing
set sql2=Nothing
response.redirect("default.asp?entrata=1&ip="&IP)
%>