Advertisement
Guest User

Untitled

a guest
Dec 5th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. QSqlQuery qry;
  2.  
  3. if(qry.exec("select * from Users where Nick = '"+nick+"' and Password = '"+password+"'" ))
  4. {
  5. int count = 0;
  6. while(qry.next())
  7. {
  8. count++;
  9. }
  10. if(count == 1)
  11. {
  12.  
  13. if((nick.toStdString()) == "admin")
  14. {
  15. MainWindow mainWindow;
  16. user = &admin;
  17. mainWindow.show();
  18. }
  19.  
  20. if((nick.toStdString()) == student.nick)
  21. user = &student;
  22.  
  23. if((nick.toStdString()) == professor.nick)
  24. user = &professor;
  25.  
  26. }
  27. if(count < 1)
  28. {
  29. ui->errorLabel->setText("Wrong login or password");
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement