SHOW:
|
|
- or go back to the newest paste.
| 1 | local homepage = "home"; | |
| 2 | local website = "www.newsite.com"; | |
| 3 | local nw = ""; | |
| 4 | local idd = os.computerID() | |
| 5 | local port1 = idd * 32 | |
| 6 | local port2 = 0 | |
| 7 | local port3 = port2 / 32 | |
| 8 | ||
| 9 | local line1 = "This website is currently down or has not been edited. If you are the owner of this website please check your webservers or contact your webserver manager for further assistance." | |
| 10 | local line2 = "" | |
| 11 | local line3 = "" | |
| 12 | local line4 = "" | |
| 13 | local line5 = "" | |
| 14 | ||
| 15 | - | rednet.open("right")
|
| 15 | + | rednet.open("top")
|
| 16 | - | rednet.open("left")
|
| 16 | + | |
| 17 | - | rednet.open("front")
|
| 17 | + | |
| 18 | - | rednet.open("back")
|
| 18 | + | |
| 19 | local x2,y2 = term.getCursorPos() | |
| 20 | term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2) | |
| 21 | print(text) | |
| 22 | end | |
| 23 | ||
| 24 | function home() | |
| 25 | print("Welcome to RedNet explorer! This requires you to have a wireless modem on the right side of your computer. This is the default homepage. A homepage option might be added in 1.2")
| |
| 26 | print("Host a website at: ")
| |
| 27 | print("www.newsite.com! ")
| |
| 28 | print(" -ComputerCraftFan11 ")
| |
| 29 | end | |
| 30 | ||
| 31 | function newsite() | |
| 32 | cPrint("Rednet Site Manager")
| |
| 33 | print("")
| |
| 34 | print("Welcome to the rednet site manager!")
| |
| 35 | print("To make a new website, enter a domain name (.com will NOT be added for you.):")
| |
| 36 | end | |
| 37 | ||
| 38 | function newsite2() | |
| 39 | cPrint("Rednet Site Manager")
| |
| 40 | print("")
| |
| 41 | print("People can connect to this site by going to www." ..nw.. "")
| |
| 42 | print("You can edit this site by going to www." ..nw.. "/editor/" ..idd)
| |
| 43 | id, message = rednet.receive() | |
| 44 | if message == "www." ..nw.. "" then -- If someone tries to connect, it will send back the website | |
| 45 | sleep(1) | |
| 46 | rednet.send(id, line1) | |
| 47 | rednet.send(id, line2) | |
| 48 | rednet.send(id, line3) | |
| 49 | rednet.send(id, line4) | |
| 50 | rednet.send(id, line5) | |
| 51 | elseif message == "www." ..nw.. "/editor/" ..idd then -- If someone tries to connect, it will send back the website | |
| 52 | sleep(1) | |
| 53 | rednet.send(id, "epanst") | |
| 54 | else | |
| 55 | if message == "Editor www." ..nw then | |
| 56 | id1, message = rednet.receive() | |
| 57 | if id1 == id then | |
| 58 | line1 = message | |
| 59 | id1, message = rednet.receive() | |
| 60 | if id1 == id then | |
| 61 | line2 = message | |
| 62 | id1, message = rednet.receive() | |
| 63 | if id1 == id then | |
| 64 | line3 = message | |
| 65 | id1, message = rednet.receive() | |
| 66 | if id1 == id then | |
| 67 | line4 = message | |
| 68 | id1, message = rednet.receive() | |
| 69 | if id1 == id then | |
| 70 | line5 = message | |
| 71 | end | |
| 72 | end | |
| 73 | end | |
| 74 | end | |
| 75 | end | |
| 76 | end | |
| 77 | end | |
| 78 | drawScreen() | |
| 79 | end | |
| 80 | ||
| 81 | function drawScreen() | |
| 82 | term.clear() | |
| 83 | term.setCursorPos(1,1) | |
| 84 | ||
| 85 | cPrint("Rednet Explorer 1.3")
| |
| 86 | ||
| 87 | cPrint("rdnt://"..website)
| |
| 88 | ||
| 89 | print("")
| |
| 90 | ||
| 91 | if website == "www.newsite.com" then | |
| 92 | newsite() | |
| 93 | elseif website == "www.newsite.com/nsite/index.php?/" then | |
| 94 | newsite2() | |
| 95 | else | |
| 96 | write("Port:")
| |
| 97 | port = read() | |
| 98 | port2 = port | |
| 99 | port3 = port2 / 32 | |
| 100 | end | |
| 101 | ||
| 102 | ||
| 103 | print("")
| |
| 104 | ||
| 105 | if website == "www.newsite.com" then | |
| 106 | write("www.")
| |
| 107 | nw = read() | |
| 108 | newsite = nw | |
| 109 | website = "www.newsite.com/nsite/index.php?/" | |
| 110 | drawScreen() | |
| 111 | end | |
| 112 | end | |
| 113 | ||
| 114 | drawScreen() |