Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void login_menu()
- {
- Scanner sc = new Scanner(System.in);
- File users = new File("Users.txt");
- int ok=0;
- String user,pass,info = null, next = null;
- String arr[]=null;
- System.out.println("Introduceti datele dumneavoastra: ");
- System.out.print("Nume utilizator: ");
- user = sc.nextLine();
- try
- {
- while(ok==0)
- {
- Scanner fs = new Scanner(users);
- while(fs.hasNextLine())
- {
- info = fs.nextLine();
- arr= info.split(" ", 3);
- next = arr[0];
- if(next.equalsIgnoreCase(user))
- {
- ok=1;
- fs.close();
- break;
- }
- }
- if(ok == 0)
- {
- System.out.print("Nu exista acest nume de utilizator, reintroduceti: ");
- user = sc.nextLine();
- }
- }
- users = null;
- System.out.print("Introduceti parola: ");
- pass = sc.nextLine();
- next = arr[1];
- while(!next.contentEquals(pass))
- {
- System.out.println("Ati introdus parola gresita, reintroduceti: ");
- pass = sc.nextLine();
- }
- if(info.contains("seller"))
- {
- while(Vanzator.menu(user))
- {}
- }
- else if(info.contains("buyer"))
- {
- while(true)
- Cumparator.menu();
- }
- }
- catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement