1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
if(user.getText().equals("")){
ButtonInfo bi = new ButtonInfo(new JFrame(),true);
bi.pan.setBackground(Color.red);
bi.titre1.setText("Erreur de champ");
bi.titre2.setText("Les champs User et Mot de passe doivent être remplis");
bi.titre3.setText("Veillez remplir tous les champs");
bi.setVisible(true);
}else{
if(statut.getSelectedItem().toString().equals("Admin")){
String userV = user.getText();
char[] mdpV = mdp.getPassword();
String mdpv2 = new String(mdpV);
BD bd = new BD();
Connection conn = bd.GetConnection();
try {
Statement stm = conn.createStatement();
ResultSet rs = stm.executeQuery("SELECT * FROM utilisateur WHERE username = ""+userV+"" AND password = ""+mdpv2+""");
if(!rs.next()){
ButtonInfo bi = new ButtonInfo(new JFrame(),true);
bi.pan.setBackground(Color.red);
bi.titre1.setText("Erreur");
bi.titre2.setText("Nom d'utilisateur ou Mot de passe Invalide");
bi.titre3.setText("Veillez recommencer");
bi.setVisible(true);
}else{
Tbord tb = new Tbord();
tb.setVisible(true);
this.dispose();
}
} catch (SQLException ex) {
Logger.getLogger(Connexion.class.getName()).log(Level.SEVERE, null, ex);
}
}else{
BD bd = new BD();
Connection conn = bd.GetConnection();
try {
Statement stm = conn.createStatement();
ResultSet rs = stm.executeQuery("SELECT * FROM utilisateur WHERE user = ""+user.getText()+""");
if(!rs.next()){
ButtonInfo bi = new ButtonInfo(new JFrame(),true);
bi.pan.setBackground(Color.red);
bi.titre1.setText("Erreur");
bi.titre2.setText("Nom d'utilisateur ou Mot de passe Invalide");
bi.titre3.setText("Veillez recommencer");
bi.setVisible(true);
}else{
/*
TbordEleve te = new TbordEleve(user.getText());
te.setVisible(true);
this.dispose();
*/
}
} catch (SQLException ex) {
Logger.getLogger(Connexion.class.getName()).log(Level.SEVERE, null, ex);
}
}
} |
Partager