buttercheetah

Banking software

Aug 12th, 2021 (edited)
1,219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.55 KB | None | 0 0
  1. local component = require("component")
  2. local computer = require("computer")
  3. local event = require("event")
  4. local inet = require("internet")
  5. local run = "True"
  6. while (run == "True") do
  7.     print("1) add item to user")
  8.     print("2) add new user")
  9.     print("3) List all users")
  10.     print("4) Quit")
  11.     selection = io.read()
  12.     if (selection == "1") then
  13.         print("Username:")
  14.         local username = io.read()
  15.         print("Item:")
  16.         local item = io.read()
  17.         print("Quantity:")
  18.         local quantity = io.read()
  19.         print("Cost:")
  20.         local cost = io.read()
  21.         local response = inet.request("http://secondary.infinity-servers.com:9000/databaseset", tostring(username .. "|" .. item .. "|" .. quantity .. "|" .. cost))
  22.         local body = ""
  23.         for chunk in response do
  24.             body = body .. chunk
  25.         end
  26.             print(body)
  27.     elseif (selection == "2") then
  28.         print("Username")
  29.         local usernamee = io.read()
  30.         local response = inet.request("http://secondary.infinity-servers.com:9000/databaseadd/" .. usernamee)
  31.         local body = ""
  32.         for chunk in response do
  33.             body = body .. chunk
  34.         end
  35.             print(body)
  36.     elseif (selection == "3") then
  37.         local response = inet.request("http://secondary.infinity-servers.com:9000/databaselistall", "E")
  38.         local body = ""
  39.         for chunk in response do
  40.             body = body .. chunk
  41.         end
  42.         print(body)
  43.     elseif (selection == "4") then
  44.         run = "False"
  45.     end
  46. end
  47.  
Add Comment
Please, Sign In to add comment