Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --
- -- LuaPay API
- -- Imque 2013
- --
- local _tGeneric = {
- _sVersion = "LuaPay API v0.1";
- _sURL = "http://imque.koding.com/luapay/index.php";
- }
- function version()
- return _tGeneric._sVersion
- end
- function login(user, pass)
- http.request(_tGeneric._sURL .. "?function=login&username=" .. textutils.urlEncode(user) .. "&password=" ..
- textutils.urlEncode(pass))
- local _sEvent, _sUrl, _sResponse = os.pullEvent("http_success")
- local _sResponse = _sResponse.readAll()
- if _sResponse:find("deprecated") then
- return true, user
- end
- return false, _sResponse
- end
- function changepass(user, pass, newpass)
- http.request(_tGeneric._sURL .. "?function=changepassword&username=" .. textutils.urlEncode(user) .. "&password=" ..
- textutils.urlEncode(pass) .. "&newpassword=" .. textutils.urlEncode(newpass))
- local _sEven, _sUrl, _sResponse = os.pullEvent("http_success")
- local _sResponse = _sResponse.readAll()
- if _sResponse:find("changed") then
- return true, user
- end
- return false, _sResponse
- end
- function pay(user, pass, touser, amount)
- http.request(_tGeneric._sURL .. "?function=pay&username=" .. textutils.urlEncode(user) .. "&password=" ..
- textutils.urlEncode(pass) .. "&toaccount=" .. textutils.urlEncode(touser) .. "&amount=" .. textutils.urlEncode(amount))
- local _sEven, _sUrl, _sResponse = os.pullEvent("http_success")
- local _sResponse = _sResponse.readAll()
- if _sResponse:find(user) then
- return true, user
- end
- return false, _sResponse
- end
- function balance(user, pass)
- http.request(_tGeneric._sURL .. "?function=balance&username=" .. textutils.urlEncode(user) .. "&password=" ..
- textutils.urlEncode(pass))
- local _sEvent, _sUrl, _sResponse = os.pullEvent("http_success")
- local _sResponse = _sResponse.readAll()
- if not _sResponse:find("Bad") then
- return _sResponse, user
- end
- return false, _sResponse
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement