SHOW:
|
|
- or go back to the newest paste.
| 1 | function password() | |
| 2 | if not fs.exists("password") then
| |
| 3 | file=fs.open("password","w")
| |
| 4 | file.writeLine("admin")
| |
| 5 | file.close() | |
| 6 | else | |
| 7 | file=fs.open("password","r")
| |
| 8 | pwt=file.readLine() | |
| 9 | file.close() | |
| 10 | end | |
| 11 | end | |
| 12 | ||
| 13 | function eject() | |
| 14 | disk.eject("drive_0")
| |
| 15 | sleep(3) | |
| 16 | term.setCursorPos( 1,2 ) | |
| 17 | print(" ")
| |
| 18 | end | |
| 19 | shell.run("clear")
| |
| 20 | while true do | |
| 21 | if disk.isPresent("drive_0") then
| |
| 22 | diskname=disk.getLabel("drive_0")
| |
| 23 | if diskname == "Chris" then | |
| 24 | if fs.exists("disk/auth.lua") then
| |
| 25 | file=fs.open("disk/auth.lua","r")
| |
| 26 | text=file.readLine() | |
| 27 | file.close() | |
| 28 | password() | |
| 29 | if text == pwt then | |
| 30 | eject() | |
| 31 | rs.setOutput( "back", true) | |
| 32 | sleep(3) | |
| 33 | rs.setOutput( "back", false) | |
| 34 | else | |
| 35 | term.setCursorPos( 1,2 ) | |
| 36 | print("wrong code")
| |
| 37 | eject() | |
| 38 | end | |
| 39 | else | |
| 40 | term.setCursorPos( 1,2 ) | |
| 41 | print("file not found")
| |
| 42 | eject() | |
| 43 | end | |
| 44 | else | |
| 45 | term.setCursorPos( 1,2 ) | |
| 46 | print("wrong disk")
| |
| 47 | eject() | |
| 48 | end | |
| 49 | else | |
| 50 | shell.run("clear")
| |
| 51 | os.sleep(1) | |
| 52 | end | |
| 53 | end | |
| 54 |