Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("back")
- --create 30 character long key
- local random
- function randomize()
- random = math.floor(math.random(36))
- end
- function generate()
- randomize()
- charset = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}
- str = ""; --it has
- for i = 1, 30 do
- randomize()
- str = str..charset[random]
- end
- createdir()
- end
- --create directorys
- function createdir()
- print("creating user directorys")
- fs.makeDir("usernames/"..str)
- fs.makeDir("userpins/"..str)
- fs.makeDir("userbalance/"..str)
- fs.makeDir("accountlogs/"..str)
- reg()
- end
- --request account info
- function reg()
- print("input disk")
- event, side = os.pullEvent()
- if event == "disk" and side == "bottom" then
- print("enter name")
- name = read()
- print("enter pin")
- pin = read("*")
- adddata()
- end
- end
- --add account info to file
- function adddata()
- print("adding data to user directorys")
- h = fs.open("usernames/"..str.."/name", "w")
- h.write(name)
- h.close()
- print("username done")
- h = fs.open("userpins/"..str.."/pin", "w")
- h.write(pin)
- h.close()
- print("user pin done")
- h = fs.open("userbalance/"..str.."/balance", "w")
- h.write(100)
- h.close()
- print("user balance done")
- h = fs.open("accountlogs/"..str.."/transactionlogs", "w")
- h.write("| time | day | ammount | account |")
- h.close()
- print("account logs done")
- print(str)
- h = fs.open("disk/keycode", "w")
- h.write(str)
- h.close()
- disk.eject("bottom")
- print("account created")
- end
- function backup()
- sleep(10)
- print("done")
- end --but it should have done an error after 10 secs,,, weird
- while true do
- generate()
- end
Advertisement
Add Comment
Please, Sign In to add comment