Ver Mensaje Individual
  #6 (permalink)  
Antiguo 22/09/2010, 18:22
lince_0011
 
Fecha de Ingreso: septiembre-2009
Mensajes: 63
Antigüedad: 14 años, 7 meses
Puntos: 0
Respuesta: Autentificar usuarios en JAVA y MYSQL

Logre solucionarlo asi:

Código PHP:
  String usuario=jTextField1.getText();
String pass=String.valueOf(password.getPassword());

try {
res=sen.executeQuery("select user,password from entrar where user='"+usuario+"' and password='"+pass+"' ");
int x=0;
while(
res.next()){
 
JOptionPane.showMessageDialog(this"Bienvenido");
 new 
frame().setVisible(true);
            
this.setVisible(false);
x++;
}
if(
x==0){
JOptionPane.showMessageDialog(this"Nombre de usuario o password invalido intente de nuevo.");
}
} catch (
SQLException ex) {
//ex.printStackTrace();

Y asi cuando el usuario X intenta entrar con contraseña falsa el sistema le indica con un mensaje de error y no le permite accesar.

Saludos