Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local currencyName = "Diamonds"
- local chan = 12345
- peripheral.find("modem").open(chan)
- if not fs.exists("/users") then
- fs.makeDir("/users")
- end
- if not fs.exists("/balance") then
- fs.makeDir("/balance")
- end
- if not fs.exists("/sha256") then
- f = fs.open("sha256",'w')
- f.writeLine(http.get('https://raw.github.com/jakemroman/JakeHub/master/sha256').readAll())
- f.close()
- end
- os.loadAPI("sha256")
- term.current().setVisible(false)
- term.clear()
- term.current().setVisible(true)
- term.setCursorPos(2,2)
- write("QuantumTech Banking")
- term.setCursorPos(2,5)
- write("If you do not have an account then")
- term.setCursorPos(2,6)
- write("enter your credentials now.")
- term.setCursorPos(2,8)
- write("Currency: ")
- term.setTextColor(colors.black)
- write(currencyName)
- term.setCursorPos(2,9)
- write("Username: ")
- local username = read()
- term.setCursorPos(2,11)
- write("Password: ")
- local password = sha256.sha256(read("*"))
- term.setCursorPos(2,4)
- if fs.exists("/users/"..username) then
- f = fs.open("/users/"..username,"r")
- local pw = f.readAll()
- f.close()
- if pw == password then
- term.setTextColor(colors.green)
- write("Access Granted!")
- sleep(1)
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor( colors.white )
- write("Logged in as "..username)
- else
- term.setTextColor(colors.red)
- textutils.slowWrite("Access Denied!")
- sleep(2)
- end
- else
- write("Registered!")
- f = fs.open("/users/"..username,"w")
- f.write(password)
- f.close()
- f = fs.open("/balance/"..username,"w")
- f.write("0")
- f.close()
- sleep(2.3)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement