Guest User

Untitled

a guest
Mar 25th, 2012
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  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")
  16. rednet.open("left")
  17. rednet.open("front")
  18. rednet.open("back")
  19.  
  20. local function cPrint(text)
  21. local x,y = term.getSize()
  22. local x2,y2 = term.getCursorPos()
  23. term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
  24. print(text)
  25. end
  26.  
  27. function home()
  28. 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")
  29. print("Host a website at: ")
  30. print("www.newsite.com! ")
  31. print(" -ComputerCraftFan11 ")
  32. end
  33.  
  34. function newsite()
  35. cPrint("Rednet Site Manager")
  36. print("")
  37. print("Welcome to the rednet site manager!")
  38. print("To make a new website, enter a domain name (.com will NOT be added for you.):")
  39. end
  40.  
  41. function newsite2()
  42. cPrint("Rednet Site Manager")
  43. print("")
  44. print("People can connect to this site by going to www." ..nw.. "")
  45. print("You can edit this site by going to www." ..nw.. "/editor/" ..idd)
  46. id, message = rednet.receive()
  47. if message == "www." ..nw.. "" then -- If someone tries to connect, it will send back the website
  48. sleep(1)
  49. rednet.send(id, line1)
  50. rednet.send(id, line2)
  51. rednet.send(id, line3)
  52. rednet.send(id, line4)
  53. rednet.send(id, line5)
  54. elseif message == "www." ..nw.. "/editor/" ..idd then -- If someone tries to connect, it will send back the website
  55. sleep(1)
  56. rednet.send(id, "epanst")
  57. else
  58. line1 = message
  59. id, message = rednet.receive()
  60. line2 = message
  61. id, message = rednet.receive()
  62. line3 = message
  63. id, message = rednet.receive()
  64. line4 = message
  65. id, message = rednet.receive()
  66. line5 = message
  67. end
  68. drawScreen()
  69. end
  70.  
  71. function drawScreen()
  72. term.clear()
  73. term.setCursorPos(1,1)
  74.  
  75. cPrint("Rednet Explorer 1.2")
  76.  
  77. cPrint("rdnt://"..website)
  78.  
  79. print("")
  80.  
  81. if website == "www.newsite.com" then
  82. newsite()
  83. elseif website == "www.newsite.com/nsite/index.php?/" then
  84. newsite2()
  85. else
  86. write("Port:")
  87. port = read()
  88. port2 = port
  89. port3 = port2 / 32
  90. end
  91.  
  92.  
  93. print("")
  94.  
  95. if website == "www.newsite.com" then
  96. write("www.")
  97. nw = read()
  98. newsite = nw
  99. website = "www.newsite.com/nsite/index.php?/"
  100. drawScreen()
  101. end
  102. end
  103.  
  104. drawScreen()
Advertisement
Add Comment
Please, Sign In to add comment