Advertisement
Guest User

Credit Card Program

a guest
Apr 17th, 2013
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.78 KB | None | 0 0
  1. term.clear()
  2. local Data = {}
  3. --Functions
  4. function header()
  5. print(textutils.centerprint("+-------------------+", 1)) print(textutils.centerprint("|Credit Card Creator|", 2))
  6. print(textutils.centerprinr("|
  7.  
  8. print(textutils.centerprint("+-------------------", 4)) end
  9.  
  10. function no_card()
  11. while not fs.exists("disk") do
  12. print(textutils.centerprint("------------------------+", 8))
  13. print(textutils.centerprint("|Please insert Credit Card |", 9))
  14. print(textutils.centerprint("+-------------------------+", 10))
  15. sleep(2)
  16. end
  17. end
  18.  
  19. function card_isPresent_but_not_prepared() function load()
  20. fs.makeDir("disk/reditcards/")
  21. sleep(1)
  22. file = fs.open("disk/creditcards/card1.acc", "w") file.close()
  23. sleep(1) r
  24. eturn true
  25. end
  26. function screen()
  27. while true do
  28. print(textutils.centerprint("
  29.  
  30. print(textutils.centerprint("
  31.  
  32. print(textutils.centerprint("
  33.  
  34. print(textutils.centerprint("+--------------------------+", 8))
  35. print(textutils.centerprint("|
  36.  
  37. print(textutils.centerprint("+--------------------------+", 10))
  38. sleep(1)
  39. end
  40. end
  41. parallel.waitForAny(load, screen)
  42. print(textutils.centerprint("
  43.  
  44. print(textutils.centerprint("
  45.  
  46. print(textutils.centerprint("
  47.  
  48. print(textutils.centerprint("+--------------------------+", 8))
  49. print(textutils.centerprint("|
  50.  
  51. print(textutils.centerprint("+--------------------------+", 10))
  52. sleep(3)
  53.  
  54. end
  55.  
  56. function asking_for_data()
  57. print(textutils.centerprint("
  58.  
  59. print(textutils.centerprint("
  60.  
  61. print(textutils.centerprint("
  62.  
  63. tem.setCursorPos(20,6)
  64. print("+-------------------+")
  65. term.setCursorPos(20,7)
  66. print("|
  67.  
  68. term.setCursorPos(20,8)
  69. print("+-------------------+")
  70. term.setCursorPos(20,10)
  71. print("+-------------------+")
  72. term.setCursorPos(20,11)
  73. print("|
  74.  
  75. term.setCursorPos(20,12)
  76. print("---------------------+")
  77. term.setCursorPos(10,7)
  78. write("Username:)
  79. term.setCursrPos(10,1)
  80. write("Password:")
  81. sleep(0.5)
  82. term.setCursorPos(21,7)
  83. username = read()
  84. term.setCursorPos(21,11)
  85. password = read("*")
  86. end
  87.  
  88. function checking()
  89.  
  90. if not username == nil and not password == nil then
  91. table.insert("Data", username)
  92. random_ID = (math.random(1000, 9999)
  93. table.insert("Data", random_ID)
  94. table.insert("Data", 0) -- This is the start money end
  95. end
  96. function create_file()
  97. pass_file = fs.open("disk/creditcards/pass1.pass", "w")
  98. pass_file.writeLine(StrUtils.SHA1(password)) pass_file.close()
  99. h = fs.open("disk/creditcards/card1.acc", "w") local serialized = (textutils.serialize(Data)) encrypted = StrUtils.encrypt(serialized, password) h.writeLine(encrypted)
  100. h.close()
  101.  
  102. --Function Calling
  103. header()
  104. if not fs.exists("disk/creditcards/card1.acc") then card_isPresent_but_not_prepared()
  105. end
  106. if fs.exists("disk/creditcards/card1.acc") then asking_for_data()
  107. end
  108. checking()
  109. create_file()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement