Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- //char[] password = jPasswordField1.getPassword();
- String myPass = String.valueOf(jPasswordField1.getPassword());
- String myAccount = String.valueOf(jTextField1.getText());
- datorBas a = new datorBas();
- a.DBHandler();
- String adminUserName = a.sendQueryUsernameAdmin("select aId from admin where aId ='" + myAccount + "'");
- String guideUserName = a.sendQueryUsernameGuide("select gId from guide where gId ='" + myAccount + "'");
- String customerUserName = a.sendQueryUsernameCustomer("select cId from custumer where cId ='" + myAccount + "'");
- // LOGIN FÖR ADMIN
- if (!adminUserName.equals(myAccount)){
- // System.out.println("This is not a correct admin username!");
- }
- else {
- System.out.println(adminUserName);
- String adminPassword = a.sendQueryPasswordAdmin("select aPassword from admin where aId ='" + myAccount + "'");
- if (!adminPassword.equals(myPass)){
- // System.out.println("Wrong Password!");
- }
- else {
- // System.out.println("Correct password!");
- // System.out.println("ÖPPNA ADMININTERFACE!" + "\n");
- windowAdmin p = new windowAdmin();
- p.setVisible(true);
- this.dispose();
- }
- }
- // LOGIN FÖR GUIDE
- if (!guideUserName.equals(myAccount)){
- // System.out.println("This is not a correct guide username!");
- }
- else {
- System.out.println(guideUserName);
- String guidePassword = a.sendQueryPasswordGuide("select gPassword from guide where gId ='" + myAccount + "'");
- if (!guidePassword.equals(myPass)){
- // System.out.println("Wrong Password for guide!");
- }
- else {
- // System.out.println("Correct password!");
- // System.out.println("ÖPPNA guideuserface!" + "\n");
- windowGuide p = new windowGuide();
- p.setVisible(true);
- this.dispose();
- }
- }
- // LOGIN FÖR CUSTOMER
- if (!customerUserName.equals(myAccount)){
- // System.out.println("This is not a correct Customer username!");
- }
- else {
- System.out.println(customerUserName);
- String customerPassword = a.sendQueryPasswordCustomer("select cPassword from custumer where cId ='" + myAccount + "'");
- if (!customerPassword.equals(myPass)){
- }
- else {
- login x = new login();
- x.setmyAccount(myAccount);
- windowCustomer p = new windowCustomer();
- p.setVisible(true);
- this.dispose();
- }
- System.out.println("errorkompis");
- }
- /* if (myPass.equals("safarier")){
- adminFrame g = new adminFrame();
- g.setVisible(true);
- this.dispose();
- }
- else{
- errorMsg("Wrong Password");
- } */
- }
- -------- // THIS IS LOGIN.JAVA
- ---- // below is windowCostumer.java
- private void button2ActionPerformed(java.awt.event.ActionEvent evt) {
- login p = new login();
- String thisAccount = login.setmyAccount();
- System.out.println(thisAccount); // TODO add your handling code here:
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement