Un saludo a todos, tengo un problema que no he podido resolver en una base de datos de Mysql estoy guardando la informacion del usuario, pero mi problema es que cuando el usuario entra por segunda vez a la pagina ya no quiero que intorduzca sus datos si no que muestre solo su informacion que se obtuvo y a mi me sale otra vez el formulario es pero que me puedan auxiliar a qui les proporciono mi codigo espero que me ayuden plis
<%
'Comienzo del programa de captura de datos
dim ip,idioma,x,y,xy,a,b,str_temp,a1,con,g,h
Dim cnn, sqlText, sql, Tip, rs, I,numR
Dim sNombre,sDepto,sArea
'Recogo el formulario de Request.Form("Nombre)
sNombre = Trim(Request.Form("Nombre"))
sDepto = Trim(Request.Form("Depto"))
sArea = Trim(Request.Form("Area"))
'Nombre=request.form("Nombre")
'Si esta variable está vacía
'es que no hemos enviado el formulario
'así que lo muestro
if Len(sNombre) = 0 then
Formulario
else
'Tengo ya un nombre para insertar
'Creo los objetos Connection y Recordset
h= Now()
ip = Request.ServerVariables("REMOTE_ADDR")
idioma = Request.ServerVariables("HTTP_ACCEPT_LANGUAGE")
x=request.servervariables("http_user_agent")
str_varserver=request.servervariables("http_user_a gent")
str_temp=mid(str_varserver,instr(str_varserver,"(" )+1)
str_temp=mid(str_temp,1,instr(str_temp,")")-1)
mat=split(str_temp,";")
explorador=mid(str_varserver,1,instr(str_varserver ,"(")-1)+mat(1)
y = explorador
x = trim(mat(2))
xy=len(request.servervariables("http_user_agent"))
if xy<=50 then
a= "No tiene instalado el Service Pack"
else
b = trim(mat(3))
'rs.close
set rs= Nothing
' conn.close
Set conn = Nothing
'Abro el Recordset con la sentencia SQL
'definiendo oConn como el objeto Connection
'y cursor 1 y lock(cerrojo) 2
'Identifica el tipo del Browsner que usa el cliente
'===========================================
'Guardo los cambios
'end if
'================================================= =======
'Imprimo una fila de la tabla
'para cada registro que encuentre
Response.Write( "<TR>" & vbCrlf ) 'ip,software,x,y,xy,a,b
Response.Write( "<p> </p><TD><B>Fecha y hora es : "&h&"</B></TD><p> </p>" & vbCrlf )
Response.Write( "<TD><B>Tu Ip es: " & ip & "</B></TD><p> </p>" & vbCrlf )
Response.Write( "<TD><B>Idioma del Windows es: " & idioma & "</B></TD><p> </p>" & vbCrlf )
Response.Write( "<TD><B>Version del Intert Explorer es:" & y & "</B></TD><p> </p>" & vbCrlf )
Response.Write( "<TD><B>Version del Sistema Operativo es:" & x & "</B></TD><p> </p>" & vbCrlf )
Response.Write( "<TD><B>" & a & "</B></TD><p> </p>" & vbCrlf )
Response.Write( "<TD><B>" & b & "</B></TD><p></p>" & vbCrlf )
Response.Write( "</TR>" & vbCrlf )
'Pasamos al siguiente registro
'Olvidarte esto significa que vas a imprimir
'siempre el mismo registro... Un bucle infinito!
'Cierro la tabla
end if
'//////////////////////////////////////////////////////////
' cnn.Open "DSN=mantto"
'sql ="select nombre from ips where ip = & ip "
'sql = "SELECT * FROM nombre WHERE ip='"&ip&"'"
'rs.open sql,conn,1,1
'================================================= =======
End if
Sub Formulario
'Imprimo por pantalla el formulario
Response.Write("<FORM ACTION=""pc.asp"" METHOD=""post"">" & vbCrlf)
Response.Write("<P>Introduce tu nombre:" & vbCrlf)
Response.Write("<INPUT TYPE=""text"" NAME=""Nombre"" SIZE=""50""><p>" & vbCrlf)
Response.Write("<P>Introduce el departamento:" & vbCrlf)
Response.Write("<INPUT TYPE=""text"" NAME=""Depto"" SIZE=""50""><p>" & vbCrlf)
Response.Write("<P>Introduce el area:" & vbCrlf)
Response.Write("<INPUT TYPE=""text"" NAME=""Area"" SIZE=""50""><p>" & vbCrlf)
Response.Write("<INPUT TYPE=""submit"" VALUE=""Enviar"">" & vbCrlf)
Response.Write("</FORM>")
End Sub'Formulario
%>
<%
dim cuenta,actualiza
dns="DSN=pc"
set conn = Server.CreateObject("ADODB.connection")
conn.open(dns)
set rs = server.CreateObject("ADODB.Recordset")
'if rs.eof = false then
sql = "SELECT * FROM nombre WHERE ip='"&ip&"'"
rs.open sql,conn,1,1
if rs.eof = true then
con="insert into nombre (ip,nombre,dept('"&ip&"',' ',' ',' ',1)"
' conn.execute(nombre,area,visito) values
else
' ejecuta la consulta
'cnn.Execute (sql)
set rs = conn.Execute(sql)
end if
if rs.eof = false then
cuenta=rs.Fields("visito")+ 1
actualiza= "Update nombre set visito = '"&cuenta&"' WHERE '"&ip&"'=ip"
set rs = conn.Execute(actualiza)
Response.Write("<B>HAZ ENTRADO A LA PAGINA DE MANTENIMIENTO DE EQUIPO: </B>" & cuenta & " <i>VECES</i>" )
else
cuenta = 1
Response.Write("<B>HAZ ENTRADO A LA PAGINA DE MANTENIMIENTO DE EQUIPO: </B>" & cuenta & " <i>VECES</i>" )
end if
'Response.Write(rs.Fields("visito"))
sSQL="Update nombre Set Idioma='" & Idioma & "' Where ip='" & ip & "'"
set RS = Conn.Execute(sSQL)
sSQL="Update nombre Set Version_IE='" & y & "' Where ip='" & ip & "'"
set RS = Conn.Execute(sSQL)
sSQL="Update nombre Set Version_Windows='" & x & "' Where ip='" & ip & "'"
set RS = Conn.Execute(sSQL)
sSQL="Update nombre Set Service_Pack='" & b & "' Where ip='" & ip & "'"
set RS = Conn.Execute(sSQL)
sSQL="Update nombre Set Sin_Service_Pack='" & a & "' Where ip='" & ip & "'"
set RS = Conn.Execute(sSQL)
sSQL="Update nombre Set Fecha='" & h & "' Where ip='" & ip & "'"
set RS = Conn.Execute(sSQL)
' else
sSQL="insert into nombre (ip,Usuario,depto,area,visito,Idioma,Version_IE,Ve rsion_Windows,Service_Pack,Sin_Service_Pack,Fecha) values ('"&ip&"','"&sNombre&"','"&sDepto&"','"&sArea&"',' "&cuenta&"','"&idioma&"','"&y&"','"&x&"','"&b&"',' "&a&"','"&h&"')"
set RS = conn.Execute(sSQL)
'end if
%>