Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function callfunc(func,parameter)
- h = http.post("http://mc.ve1121.venus.fastwebserver.de/index.php", "func="..textutils.urlEncode(tostring(func)).."&".."parameter="..textutils.urlEncode(tostring(parameter)))
- return h.readLine()
- end
- local function register_user()
- term.setCursorPos(1,1)
- term.clear()
- print("Register User")
- print("___________________________________________________")
- print("")
- print("User:")
- user = read()
- print("")
- print("Password:")
- pass = read()
- if callfunc("register_user", user..","..pass) == "1" then
- term.setCursorPos(1,1)
- term.clear()
- print("User "..user.." successfully registered.")
- print("")
- print("Press Enter to proceed..")
- read()
- return true
- else
- return false
- end
- end
- local function login_user()
- term.setCursorPos(1,1)
- term.clear()
- print("Login User")
- print("___________________________________________________")
- print("")
- print("User:")
- user = read()
- print("")
- print("Password:")
- pass = read()
- if callfunc("login_user", user..","..pass) == "1" then
- CE_user = user
- term.setCursorPos(1,1)
- term.clear()
- print("User "..CE_user.." successfully logged in..")
- print("")
- print("Press Enter to proceed..")
- read()
- return true
- end
- end
- local function logout_user()
- if callfunc("logout_user", CE_user) == "1" then
- term.setCursorPos(1,1)
- term.clear()
- print("User "..CE_user.." successfully logged out.")
- print("")
- print("Press Enter to proceed..")
- read()
- return false
- end
- end
- local function wallet_amount()
- return callfunc("wallet_amount", CE_user)
- end
- local function wallet_id()
- return callfunc("wallet_id", CE_user)
- end
- local function wallet_send_money()
- term.setCursorPos(1,1)
- term.clear()
- print("User-Wallet: Send CC")
- print("___________________________________________________")
- print("")
- print("Wallet-Amount: "..wallet_amount().." CC")
- print("")
- print("")
- print("Wallet-ID:")
- id = read()
- print("")
- print("CC amount:")
- amount = read()
- res = callfunc("wallet_send", CE_user..","..id..","..amount)
- if res == "0" then
- term.setCursorPos(1,1)
- term.clear()
- print("Not enough Corner-Credits on Wallet")
- print("")
- print("Press Enter to proceed..")
- read()
- end
- if res == "1" then
- term.setCursorPos(1,1)
- term.clear()
- print("Wallet-ID not found.")
- print("")
- print("Press Enter to proceed..")
- read()
- end
- if res == "2" then
- term.setCursorPos(1,1)
- term.clear()
- print("Send "..amount.." CC to Wallet-ID "..id)
- print("")
- print("Press Enter to proceed..")
- read()
- end
- end
- CE_user = ""
- online = false
- while true do
- term.setCursorPos(1,1)
- term.clear()
- print("Welcome to Corner-Economy Mod v1.0")
- print("___________________________________________________")
- print("")
- print("1. Register")
- print("2. Login")
- print("3. Exit")
- print("")
- print("")
- print("")
- local input1 = read()
- if input1 == "1" then
- register_user()
- end
- if input1 == "2" then
- online = login_user()
- while online do
- term.setCursorPos(1,1)
- term.clear()
- print("Corner-Economy v1.0")
- print("___________________________________________________")
- print("")
- print("User "..CE_user.." logged in.")
- print("")
- print("1. Wallet")
- print("2. Logout")
- print("")
- print("")
- print("")
- local input2 = read()
- if input2 == "1" then
- local back = false
- while back == false do
- term.setCursorPos(1,1)
- term.clear()
- print("Wallet-ID "..wallet_id()..": "..wallet_amount().." CC")
- print("___________________________________________________")
- print("")
- print("1. Send CC")
- print("2. Back")
- print("")
- print("")
- print("")
- local input3 = read()
- if input3 == "1" then
- wallet_send_money()
- end
- if input3 == "2" then
- back = true
- end
- end
- end
- if input2 == "2" then
- online = logout_user()
- end
- end
- end
- if input1 == "3" then
- term.setCursorPos(1,1)
- term.clear()
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement