Ver Mensaje Individual
  #2 (permalink)  
Antiguo 29/01/2006, 17:42
tati_nu
 
Fecha de Ingreso: julio-2005
Mensajes: 12
Antigüedad: 18 años, 9 meses
Puntos: 0
el codigo html que envia los datos es el siguiente:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>opciones</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" background="chainlink.gif">
<div id="Lmapa" style="position:absolute; left:7px; top:89px; width:148px; height:59px; z-index:9" ><a href="Cobertura.htm" target="mainFrame"><img src="cob_liga.gif" width="147" height="104" border="0"></a></div>
<div id="Layer5" style="position:absolute; left:14px; top:198px; width:131px; height:57px; z-index:13"><a href="catalogo.htm" target="mainFrame"><img src="clientes.gif" width="133" height="123" border="0"></a></div>

<div id="Layer1" style="position:absolute; left:4px; top:326px; width:136px; height:14px; z-index:14"><a href="Preguntas.htm" target="mainFrame"><img src="pf_liga.gif" width="155" height="97" border="0"></a></div>
<div id="Layer2" style="position:absolute; left:11px; top:-1px; width:139px; height:97px; z-index:15">
<form action="mi_jsp.jsp" method="get" name="ingresar" target="_blank" id="ingresar">
<table width="100%" height="50%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="61%"><strong><font size="1" face="Verdana">Usuario :</font></strong></td>
<td width="39%">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><strong><font size="1" face="Verdana">
<input name="usuario" type="text" id="id" size="18" maxlength="10" >
</font></strong></td>
</tr>
<tr>
<td><strong><font size="1" face="Verdana">Contrase&ntilde;a :</font></strong></td>
<td>&nbsp;</td>
</tr>
<tr>
<td><strong><font size="1" face="Verdana">
<input name="passwd" type="password" id="pass" size="10" maxlength="6">
</font></strong></td>
<td><input type="submit" name="Submit" value="Entrar" height="5"></td>
</tr>
</table>
</form>
</div>
</body>
</html>


y el .jsp que los recibe es este:

<%@ page import="java.sql.*" %>
<%! Connection conexion=null;
Statement sentencia;
ResultSet resultado;
String consulta="";
String usuario="";
String passwd="";
String ip="localhost";
%>
<title>mi pagina</title>
<body background="chainlink.gif">
<%Class.forName("org.gjt.mm.mysql.Driver").newInst ance(); conexion=DriverManager.getConnection("jdbc:mysql://localhost/mensaje_mys?user=mi_usuario&password=mi_pass");
sentencia=conexion.createStatement();

usuario=request.getParameter("usuario");
passwd=request.getParameter("passwd");


response.setContentType("text/html");

consulta="Select * from usuarios where usuario='"+usuario+"' and pass='"+passwd+"'";

resultado=sentencia.executeQuery(consulta);
resultado.beforeFirst();
if(!resultado.next()&&usuario="d")
{%>
<center>

<h2><font face="Verdana">Usuario no registrado.<br> Verifique por favor su nombre
o contrase&ntilde;a

</font> </h2>
<br>
<a href="mi pagina" target="_parent" ><font face="Verdana">Regresar</font></a>
</center>
</body>
<%
conexion.close();
}else{
session=request.getSession(true);
session.setAttribute("user",usuario);
session.setMaxInactiveInterval(600);
if(resultado.getInt("tipo")==1)
response.sendRedirect("admin.jsp");
if(resultado.getInt("tipo")==2)
response.sendRedirect("user.jsp");

conexion.close();
}%>