Posted 10 August 2012 - 11:00 PM
I've made a very small website server and an explorer that will find and display a website of your choosing (if its being hosted by the server)
and with a bit of tweaking it can require a password to access the website
server
rednet explorer
THE MODEMS HAVE TO BE PUT ON THE RIGHT SIDE OF THE COMPUTERS!
i have yet to discover how to make it accept more than one direction without 5 lines of code ;)/>/>
if you have any ideas on how i can improve this then Please post a reply
(i'm new at lua so i would greatly appreciate it!)
and with a bit of tweaking it can require a password to access the website
server
rednet.open("right")
local i = 1
repeat
os.sleep(2)
rednet.announce()
senderId, message, distance = rednet.receive(10)
if message == "a" then
rednet.send(senderId, "First Webpage WOOHOO")
print(senderId)
print("acessed")
end
os.sleep(2)
print(i)
i = i + 1
until i == 500
rednet explorer
rednet.open("right")
senderId1, message, distance = rednet.receive(3)
print(senderId1)
senderId2, message, distance = rednet.receive(3)
print(senderId2)
senderId3, message, distance = rednet.receive(3)
print(senderId3)
senderId4, message, distance = rednet.receive(3)
print(senderId4)
senderId5, message, distance = rednet.receive(3)
print(senderId5)
print("choose the website number")
local a = read()
a = tonumber(a)
if a == senderId1 then
rednet.send(senderId, "a")
senderId, message, distance = rednet.receive()
term.clear()
term.setCursorPos(1 , 1)
print(message)
end
if a == senderId2 then
rednet.send(senderId, "a")
senderId, message, distance = rednet.receive()
term.clear()
term.setCursorPos(1 , 1)
print(message)
end
if a == senderId3 then
rednet.send(senderId, "a")
senderId, message, distance = rednet.receive()
term.clear()
term.setCursorPos(1 , 1)
print(message)
end
if a == senderId4 then
rednet.send(senderId, "a")
senderId, message, distance = rednet.receive()
term.clear()
term.setCursorPos(1 , 1)
print(message)
end
if a == senderId5 then
rednet.send(senderId, "a")
senderId, message, distance = rednet.receive()
term.clear()
term.setCursorPos(1 , 1)
print(message)
end
rednet.close("right")
the repitition is so that the explorer can find more than one websiteTHE MODEMS HAVE TO BE PUT ON THE RIGHT SIDE OF THE COMPUTERS!
i have yet to discover how to make it accept more than one direction without 5 lines of code ;)/>/>
if you have any ideas on how i can improve this then Please post a reply
(i'm new at lua so i would greatly appreciate it!)