Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local computer = require("computer")
- local event = require("event")
- local inet = require("internet")
- local run = "True"
- while (run == "True") do
- print("1) add item to user")
- print("2) add new user")
- print("3) List all users")
- print("4) Quit")
- selection = io.read()
- if (selection == "1") then
- print("Username:")
- local username = io.read()
- print("Item:")
- local item = io.read()
- print("Quantity:")
- local quantity = io.read()
- print("Cost:")
- local cost = io.read()
- local response = inet.request("http://secondary.infinity-servers.com:9000/databaseset", tostring(username .. "|" .. item .. "|" .. quantity .. "|" .. cost))
- local body = ""
- for chunk in response do
- body = body .. chunk
- end
- print(body)
- elseif (selection == "2") then
- print("Username")
- local usernamee = io.read()
- local response = inet.request("http://secondary.infinity-servers.com:9000/databaseadd/" .. usernamee)
- local body = ""
- for chunk in response do
- body = body .. chunk
- end
- print(body)
- elseif (selection == "3") then
- local response = inet.request("http://secondary.infinity-servers.com:9000/databaselistall", "E")
- local body = ""
- for chunk in response do
- body = body .. chunk
- end
- print(body)
- elseif (selection == "4") then
- run = "False"
- end
- end
Add Comment
Please, Sign In to add comment