Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function readFileLines(filename)
- file = fs.open(filename,"r")
- local tLines = {}
- repeat
- line = file.readLine()
- table.insert(tLines,line)
- until line == nil
- file.close()
- return tLines
- end
- function verifyUser(username,password)
- line = readFileLines("/usernames")
- num = 1
- repeat
- num = num + 1
- if lines[num] == username then userver = true
- until lines[num] == username or lines[num] == nil
- line = readFileLines("/passwords")
- num = 1
- repeat
- num = num + 1
- if lines[num] == password then passver = true
- until lines[num] == password or lines[num] == nil
- if passver == true and userver == true then
- return true
- end
- end
- function bbs()
- term.clear()
- term.setCursorPos(1,1)
- print " ** LOGIN TO SKS-BBS **"
- print "Options:"
- print "[1] Login\n[2] Create Account\n[3] Exit"
- while true do
- event,param1 = os.pullEventRaw()
- if event == "key" and param1 == 2 then selection = 1
- if event == "key" and param1 == 3 then selection = 2
- if event == "key" and param1 == 4 then selection = 3
- end
- if selection == 1 then
- print " ** LOGIN TO SKS-BBS **"
- print "--------\nUSERNAME:"
- write "? "
- user = read()
- print "--------\PASSWORD:"
- write "? "
- pass = read()
- print "--------"
- if verifyUser then
- print "ACCESS GRANTED!"
- login = true
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement