Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local modem = peripheral.wrap("back")
- modem.open( 1 )
- os.pullEvent = os.pullEventRaw
- local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
- function explode(d,p)
- local t, ll
- t={}
- ll=0
- if(#p == 1) then
- return {p}
- end
- while true do
- l = string.find(p, d, ll, true) -- find the next d in the string
- if l ~= nil then -- if "not not" found then..
- table.insert(t, string.sub(p,ll,l-1)) -- Save it in our array.
- ll = l + 1 -- save just after where we found it for searching next time.
- else
- table.insert(t, string.sub(p,ll)) -- Save what's left in our array.
- break -- Break at end, as it should be, according to the lua manual.
- end
- end
- return t
- end
- local vartable = explode(",",message)
- if vartable[0] == "login" then
- local login = http.get("https://mistaken.pl/barwa/cc/login.php?login="..vartable[1].."&passwd="..vartable[2])
- if not login then
- print("Error")
- else
- local content = login.readAll()
- modem.transmit(replyChannel, 1, content)
- end
- end
- if vartable[0] == "auth" then
- local login = http.get("https://mistaken.pl/barwa/cc/auth.php?hash="..vartable[1])
- if not login then
- print("Error")
- else
- local content = login.readAll()
- modem.transmit(replyChannel, 1, content)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment