
webhost
By: a guest on
Aug 3rd, 2012 | syntax:
Lua | size: 1.08 KB | hits: 15 | expires: Never
--[[ SynthProject ]]--
-- Web Hosting --
hostname = "antivirus.synth.com"
webindex = ".synth/.core/.av"
logAccess = true -- Recommended
rednet.open("top")
rednet.open("left")
rednet.open("right")
rednet.open("back")
rednet.open("front")
FILE = fs.open(".synth/.core/.av", "r")
fileData = FILE.readAll()
FILE:close()
while true do
action, senderID, text, dist = os.pullEvent()
if action == "rednet_message" then
if text == hostname or text == "rdnt://"..hostname or text == hostname.."/" or text == "rdnt://"..hostname.."/" then
print(senderID.." just viewed your site! @ "..text)
rednet.send(senderID, fileData)
if logAccess then
ax = io.open(".logfile","a")
ax:write(senderID.." just viewed your site! @ "..text.." from "..dist.." meters away!\n")
ax:close()
end
end
if text == "ping" then
print(senderID.." just pinged your site!")
rednet.send(senderID, "pong")
if logAccess then
ax = io.open(".logfile","a")
ax:write(senderID.." just viewed your site! @ "..text.." from "..dist.." meters away!\n")
ax:close()
end
end
end
end