xXm0dzXx

Untitled

Apr 25th, 2012
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. if message == "Editor www." ..nw then
  59. id1, message = rednet.receive()
  60. if id1 == id then
  61. line1 = message
  62. id1, message = rednet.receive()
  63. if id1 == id then
  64. line2 = message
  65. id1, message = rednet.receive()
  66. if id1 == id then
  67. line3 = message
  68. id1, message = rednet.receive()
  69. if id1 == id then
  70. line4 = message
  71. id1, message = rednet.receive()
  72. if id1 == id then
  73. line5 = message
  74. end
  75. end
  76. end
  77. end
  78. end
  79. end
  80. end
  81. drawScreen()
  82. end
  83.  
  84. function drawScreen()
  85. term.clear()
  86. term.setCursorPos(1,1)
  87.  
  88. cPrint("Rednet Explorer 1.3")
  89.  
  90. cPrint("rdnt://"..website)
  91.  
  92. print("")
  93.  
  94. if website == "www.newsite.com" then
  95. newsite()
  96. elseif website == "www.newsite.com/nsite/index.php?/" then
  97. newsite2()
  98. else
  99. write("Port:")
  100. port = read()
  101. port2 = port
  102. port3 = port2 / 32
  103. end
  104.  
  105.  
  106. print("")
  107.  
  108. if website == "www.newsite.com" then
  109. write("www.")
  110. nw = read()
  111. newsite = nw
  112. website = "www.newsite.com/nsite/index.php?/"
  113. drawScreen()
  114. end
  115. end
  116.  
  117. drawScreen()
Advertisement
Add Comment
Please, Sign In to add comment