Don't like ads? PRO users don't see any ads ;-)
Guest

webhost

By: a guest on Aug 3rd, 2012  |  syntax: Lua  |  size: 1.08 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. --[[ SynthProject ]]--
  2. -- Web Hosting --
  3.  
  4. hostname = "antivirus.synth.com"
  5. webindex = ".synth/.core/.av"
  6. logAccess = true -- Recommended
  7.  
  8. rednet.open("top")
  9. rednet.open("left")
  10. rednet.open("right")
  11. rednet.open("back")
  12. rednet.open("front")
  13.  
  14. FILE = fs.open(".synth/.core/.av", "r")
  15. fileData = FILE.readAll()
  16. FILE:close()
  17. while true do
  18.         action, senderID, text, dist = os.pullEvent()
  19.         if action == "rednet_message" then
  20.                 if text == hostname or text == "rdnt://"..hostname or text == hostname.."/" or text == "rdnt://"..hostname.."/" then
  21.                         print(senderID.." just viewed your site! @ "..text)
  22.                         rednet.send(senderID, fileData)
  23.                         if logAccess then
  24.                         ax = io.open(".logfile","a")
  25.                         ax:write(senderID.." just viewed your site! @ "..text.." from "..dist.." meters away!\n")
  26.                         ax:close()
  27. end
  28.                 end
  29.                 if text == "ping" then
  30.                         print(senderID.." just pinged your site!")
  31.                         rednet.send(senderID, "pong")
  32. if logAccess then
  33. ax = io.open(".logfile","a")
  34.                         ax:write(senderID.." just viewed your site! @ "..text.." from "..dist.." meters away!\n")
  35.                         ax:close()
  36. end
  37.                 end
  38.         end
  39. end