Advertisement
xample

Database

Jan 23rd, 2019
643
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.34 KB | None | 0 0
  1.  
  2. ######
  3. """  
  4. How to use
  5. 1) Login into the user account.
  6. 2) You will have full access to his account.
  7. 3) You can change everyone's / view passwords and emails and all that stuff.
  8. 4) I recommend that you only view them and not delete them but the admins will notice
  9. That's it! Enjoy!
  10.  
  11. WARNING : I am NOT responsible how you use this data. Some users just want it to view the 29k + users Emails and passwords and gain themselves money, again, I AM NOT RESPONSIBLE HOW YOU USE THIS DATA!
  12.  
  13. """
  14. ######
  15.  
  16.  
  17.  
  18. username = input("Username : ") # ADMIN USERNAME IN TXT FILE
  19. password = input("Password : ") # ADMIN PASSWORD IN TXT FILE
  20. pp = pprint.PrettyPrinter()
  21. numbers = [] # Store ALL user's usernames position
  22. #This function will get positions
  23. def get_numbers(reset_function):
  24.     global numbers,numbers_paswd
  25.     if reset_function == "yes":
  26.         numbers = []
  27.         paswd_numbers = []
  28.     else:
  29.         pass
  30.     for position,item in enumerate(sheet.col_values(1)):
  31.         if item == username:
  32.             numbers.append(int(position))
  33.  
  34.     numbers_paswd = [] # Store all user's password to compare      
  35.     for paswd_position,pasw_item in enumerate(sheet.col_values(2)):
  36.         if pasw_item == password:
  37.             numbers_paswd.append(int(paswd_position))
  38. get_numbers (reset_function = 'no')
  39. # Little check
  40. if numbers == numbers_paswd:
  41.     print ("Logged in!")
  42. else:
  43.     print ("The login info didn't work. Please check your username and password.")
  44.     raise SystemExit("Incorrect information.")
  45.  
  46.  
  47.  
  48.  
  49.  
  50. # ------------------------------------------------- #
  51. ##### _____________________________________________
  52.  
  53. # ~~ // !! START OF USER UNPACKING DATA !! \\ ~~ #
  54.  
  55. ##### _____________________________________________
  56.  
  57. # ------------------------------------------------- #
  58.  
  59.  
  60. user_data = []
  61. def get_data(reset_function):
  62.     global user_data, numbers, amounts
  63.     if reset_function == 'yes':
  64.         user_data = []
  65.         get_numbers (reset_function = 'yes')
  66.     else:
  67.         pass
  68.     # // Will now user numbers to get specific user data \\ #
  69.     # how many dups there is
  70.     amounts  = len(numbers)
  71.     # Where it will store all data
  72.     for x in range(amounts):
  73.         position_table = (numbers[0]) # Will always stay 0 because the number that is used is being removed.
  74.         # Get table
  75.         Specific_User = sheet.row_values(position_table+1) # It's position_table + 1 because in the database it's always 1 number behind.
  76.         # Insert first value
  77.         user_data.append(Specific_User)
  78.         # Remove the data that was already inserted
  79.         numbers.remove(position_table)
  80. get_data(reset_function = 'no')
  81.    
  82.  
  83.  
  84. # user_data - contains list of user stored records.
  85. # // unpacking data \\ #
  86. print ("Unpacking Data...")
  87. account_number = 0
  88. current_number = -1
  89. def print_data(reset_function):
  90.     global account_number,current_number
  91.     if reset_function == "no":
  92.         pass
  93.     elif reset_function == "yes":
  94.         account_number = 0
  95.         current_number = -1
  96.         get_data(reset_function = 'yes')
  97.     for y in range(len(user_data)):
  98.         account_number +=1
  99.         current_number +=1
  100.         account_name = (user_data[current_number][2])
  101.         account_password = (user_data[current_number][3])
  102.         account_website = (user_data[current_number][4])
  103.         account_note = (user_data[current_number][5])
  104.         print ("---------------------------\nRECORD {0} : \nAccount : {1}\nPassword : {2}\nWebsite : {3}\nNote : {4}\n---------------------------".format(
  105.         account_number,
  106.         account_name,
  107.         account_password,
  108.         account_website,
  109.         account_note))
  110.  
  111. print_data(reset_function = 'no')
  112.  
  113. print ("You have {0} account(s) stored.".format(len(user_data)))
  114. # ------------------------------------------------- #
  115. ##### _____________________________________________
  116.  
  117. # ~~ // !! END OF USER UNPACKING DATA !! \\ ~~ #
  118.  
  119. ##### _____________________________________________
  120.  
  121. # ------------------------------------------------- #
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130. # ------------------------------------------------- #
  131. ##### _____________________________________________
  132.  
  133. # ~~ // !! START OF UPDATING DATA !! \\ ~~ #
  134.  
  135. ##### _____________________________________________
  136.  
  137. # ------------------------------------------------- #
  138. def question()
  139.     global _choice_
  140.     _choice_ = input("1 - Update Data\n> ")
  141. def update_cell(value,y,x,new_data):
  142.     global print_data
  143.     update = value
  144.     try:
  145.         update_to = new_data
  146.         try:
  147.             sheet.update_cell(y,x, update_to)
  148.         except Exception as update_error:
  149.             print (update_error)
  150.         print ("The data was changed!")
  151.         print_data(reset_function = 'yes')
  152.         question()
  153.  
  154.     except Exception as error_finding:
  155.         print (error_finding)
  156.         print ("Sorry, that value couldn't be found! or the program ran into an error")
  157.         question()
  158. question()
  159. if _choice_ == "1":
  160.     original = input ("What would you like to change? : ")
  161.     print ("Finding data...")
  162.     try:
  163.         cell = sheet.find(original)
  164.         row = cell.row
  165.         col = cell.col
  166.         print ("Found!")
  167.         new = input(f"RECORD BEING CHANGED : {original}\nWhat would you like to change it to? : ")
  168.         update_cell(original,row,col,new)
  169.     except:
  170.         print ("Failed! couldn't find the data.")
  171.         pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement