Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. public int loginCheck()
  2. {
  3. //-----------------------------------------------------------------
  4. string[] users = File.ReadLines("Username_Passwords").ToArray();
  5. //line of text file added to array
  6. //-----------------------------------------------------------------
  7. for (int i = 0; i < users.Length; i++)
  8. {
  9. string[] usernameAndPassword = users[i].Split('_');
  10. //usernames and passwords separated by '_' in file, split into two strings
  11.  
  12. if (_username == usernameAndPassword[0] && _password == usernameAndPassword[1])
  13. {
  14. return 1;
  15. //return 1, could have used bool
  16. }
  17.  
  18. else
  19. {
  20. return 0;
  21.  
  22. }
  23. }
  24.  
  25. public int loginCheck() {
  26. //-----------------------------------------------------------------
  27. string[] users = File.ReadLines("Username_Passwords").ToArray();
  28. //line of text file added to array
  29. //-----------------------------------------------------------------
  30. for (int i = 0; i < users.Length; i++) {
  31. string[] usernameAndPassword = users[i].Split('_');
  32. //usernames and passwords separated by '_' in file, split into two strings
  33.  
  34. if (_username == usernameAndPassword[0] && _password == usernameAndPassword[1]) {
  35. return 1;
  36. //return 1, could have used bool
  37. }
  38.  
  39. else {
  40. return 0;
  41.  
  42. }
  43. }
  44. return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement