pepeknamornik

AD2020

Mar 5th, 2020 (edited)
606
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.54 KB | None | 0 0
  1. local verze = "21.0628.R3"
  2. local anim = 0.1
  3. local i = 0
  4. local a = 1
  5. local ADUsersT = true
  6. local w, h = term.getSize()
  7. local RamCesta = ("/C/system/RAM/AD")
  8. local nastaveni={barva=colors.blue}
  9. local f=fs.open("/C/system/.core/colors","r")
  10. local cnt=f.readAll()
  11. local cUsr = {}
  12. local cComp = {}
  13. f.close()
  14. ----------------------------------------------------
  15. local f=fs.open("/C/system/RAM/user","r")
  16. user=f.readLine()
  17. pass=f.readLine()
  18. Fname=f.readLine()
  19. Lname=f.readLine()
  20. IsAdmin=f.readLine()
  21. f.close()
  22.  
  23. local function Barvy()
  24.     if fs.exists ("/C/system/Users/"..user.."/.Registry/colors") then
  25.     local data = fs.open("/C/system/Users/"..user.."/.Registry/colors", "r")
  26.     BarPoz = tonumber(data.readLine())
  27.     BarTxt = tonumber(data.readLine())
  28.     data.close()
  29.     end
  30.     if BarPoz == nil or BarTxt == nil then BarPoz = 2048 BarTxt = 1 end
  31. end
  32. function ukonceni ()
  33.     fs.delete (RamCesta)
  34.     os.exit()
  35. end
  36.  
  37. function cbarva()
  38. lista.setTextColor(colors.black)
  39. lista.setBackgroundColor(colors.gray)
  40. end
  41.  
  42. function bbarva()
  43. term.setTextColor(colors.black)
  44. term.setBackgroundColor(colors.lightBlue)
  45. end
  46.  
  47. function defaultvalue()
  48. Nuser = " "
  49. Npass = ""
  50. NFname = " "
  51. NLname = " "
  52. IsAdmin = "f"
  53. end
  54.  
  55. function defaultMenu()
  56. ADUsersT = false
  57. ADCompT = false
  58. end
  59.  
  60. function start()
  61. defaultvalue()
  62. Barvy()
  63. local myWindow = window.create(term.current(),w/2-11,h/2-5,25,9)
  64. myWindow.setBackgroundColor(colors.blue)
  65. myWindow.clear()
  66. myWindow.setCursorPos (2, 5)
  67. myWindow.write"Users Active directory"
  68. myWindow.setCursorPos (1, 1)
  69. myWindow.write"Pepek@Soft"
  70. myWindow.setCursorPos (22, 9)
  71. myWindow.write"2020"
  72. kontrola()
  73. sleep(0.5)
  74. menu()
  75. end
  76.  
  77. function plocha()
  78. w, h = term.getSize()
  79. paintutils.drawLine(1, 1, w, 1, BarPoz)
  80. paintutils.drawPixel (w,1, colors.red)
  81. term.setCursorPos (w,1)
  82. term.setTextColor(BarTxt)
  83. write "×"
  84. barW = window.create(term.current(),1,2,w,1)
  85. barW.setBackgroundColor(colors.gray)
  86. barW.clear()
  87. barW.setTextColor(colors.white)
  88. barW.setCursorPos(2,1)
  89. barW.write"Users & Computers AD >"
  90. pozadi = window.create(term.current(),13,3,w,h-2)
  91. pozadi.setBackgroundColor(colors.white)
  92. pozadi.setTextColor(colors.black)
  93. pozadi.clear()
  94. lista = window.create(term.current(),1,3,12,h-2)
  95. lista.setBackgroundColor(BarPoz)
  96. lista.setTextColor(BarTxt)
  97. lista.clear()
  98. lista.setCursorPos(2,3)
  99. lista.write"Dashboard"
  100. lista.setCursorPos(2,5)
  101. lista.write"Users"
  102. lista.setCursorPos(2,7)
  103. lista.write"Computers"
  104. lista.setCursorPos(2,9)
  105. lista.write"Policy"
  106. lista.setCursorPos(2,h-2)
  107. lista.setTextColor(colors.white)
  108. lista.write("Pepek@Soft")
  109. term.setBackgroundColor(colors.lightGray)
  110. end
  111. -----------------------------------------------------------------------------
  112. function kontrola()
  113.     if not fs.exists ("/C/system/server/rules/AD/Users/") then
  114.         fs.makeDir("/C/system/server/rules/AD/Users/")
  115.     end
  116.     if not fs.exists ("/C/system/server/rules/AD/Computers/") then
  117.         fs.makeDir("/C/system/server/rules/AD/Computers/")
  118.     end
  119.    
  120.     if not fs.exists ("/C/service/AD") and not fs.exists ("/C/service/AD.lua") then
  121.         if not fs.exists ("/C/stopService/AD.lua") then
  122.         shell.run("pastebin get LpbqMJuu /C/service/AD.lua")
  123.         multishell.launch({}, "/C/service/AD.lua")
  124.         end
  125.     end
  126.    
  127.     if not fs.exists ("/C/system/.core/AD") then
  128.         local f=fs.open("/C/system/.core/AD","w")
  129.         f.writeLine(tostring(os.getComputerID()))
  130.         f.close()
  131.     end
  132.    
  133.     if not fs.exists ("/C/system/server/rules/AD/Users/"..user) then
  134.         addUser(user)
  135.         fs.copy("/C/system/Users/"..user.."/.data", "/C/system/server/rules/AD/Users/"..user.."/.data")
  136.         if fs.exists ("/C/system/Users/"..user.."/bar.nfp") then fs.copy("/C/system/Users/"..user.."/bar.nfp", "/C/system/server/rules/AD/Users/"..user.."/bar.nfp") end
  137.         fs.copy("/C/system/Users/"..user.."/colors", "/C/system/server/rules/AD/Users/"..user.."/colors")
  138.         fs.copy("/C/system/Users/"..user.."/lsprogram", "/C/system/server/rules/AD/Users/"..user.."/lsprogram")
  139.         fs.copy("/C/system/Users/"..user.."/textcol", "/C/system/server/rules/AD/Users/"..user.."/textcol")
  140.     end
  141. end
  142.  
  143. function addUser(user)
  144.     if not fs.exists ("/C/system/server/rules/AD/Users/"..user) then
  145.         fs.makeDir("/C/system/server/rules/AD/Users/"..user)
  146.     end
  147. end
  148.  
  149. local page = "main"
  150.  
  151. function main()
  152. barW.setCursorPos(25,1)
  153. barW.write"Dashboard"
  154. pozadi.setCursorPos(2,2)
  155. pozadi.write"Instaled Version:"
  156.  
  157. pozadi.setCursorPos(2,4)
  158. pozadi.write"Logged in user:"
  159. pozadi.setCursorPos(2,5)
  160. pozadi.write"Count of Users:"
  161. pozadi.setCursorPos(2,6)
  162. pozadi.write"Count of Comp's:"
  163. pozadi.setCursorPos(2,7)
  164. pozadi.write"This server ID:"
  165.  
  166. pozadi.setTextColor(colors.lightGray)
  167. pozadi.setCursorPos(20,7)
  168. pozadi.write(os.getComputerID())
  169. pozadi.setCursorPos(20,2)
  170. pozadi.write(verze)
  171. pozadi.setCursorPos(20,4)
  172. pozadi.write(user)
  173. pozadi.setCursorPos(20,5)
  174. pozadi.write(#(fs.list("/C/system/server/rules/AD/Users/")))
  175. pozadi.setCursorPos(20,6)
  176. pozadi.write(#(fs.list("/C/system/server/rules/AD/Computers/")))
  177.  
  178. pozadi.setBackgroundColor(colors.lightGray)
  179. pozadi.setTextColor(colors.black)
  180. pozadi.setCursorPos(2,10)
  181. pozadi.write " Start AD "
  182.  
  183. end
  184.  
  185. function Usr()
  186. barW.setCursorPos(25,1)
  187. barW.write"Users    "
  188. barW.setCursorPos(w-8,1)
  189. barW.write"New User"
  190.  
  191. UsrT = window.create(term.current(),14,4,w-14,h-3)
  192. UsrT.setBackgroundColor(colors.lightBlue)
  193. UsrT.setTextColor(colors.black)
  194. UsrT.clear()
  195.  
  196. if fs.exists("/C/system/server/rules/AD/Users/") then
  197.     cUsr = fs.list("/C/system/server/rules/AD/Users/")
  198.     local a=1
  199.     for i = 1, #cUsr do
  200.         local name = tostring(cUsr[i])
  201.         UsrT.setBackgroundColor(colors.lightBlue)
  202.         UsrT.setCursorPos(2,a)
  203.         UsrT.write(cUsr[i])
  204.         a = a+1        
  205.     end
  206. end
  207.        
  208.    
  209. end
  210.  
  211. function Comp()
  212. barW.setCursorPos(25,1)
  213. barW.write"Computers"
  214. barW.setCursorPos(w-8,1)
  215. barW.write"New PC"
  216.  
  217.  
  218. CompT = window.create(term.current(),14,4,w-14,h-3)
  219. CompT.setBackgroundColor(colors.lightBlue)
  220. CompT.setTextColor(colors.black)
  221. CompT.clear()
  222.  
  223. if fs.exists("/C/system/server/rules/AD/Computers/") then
  224.     cComp = fs.list("/C/system/server/rules/AD/Computers/")
  225.     local a=1
  226.     for i = 1, #cComp do
  227.         local name = tostring(cComp[i])
  228.         CompT.setBackgroundColor(colors.lightBlue)
  229.         CompT.setCursorPos(2,a)
  230.         CompT.write(cComp[i])
  231.         a = a+1        
  232.     end
  233. end
  234.  
  235.  
  236. end
  237.  
  238. function CompWin()
  239. local eComp = window.create(term.current(),w/2-5,h/2-4,25,9)
  240. eComp.setBackgroundColor(colors.white)
  241. eComp.clear()
  242. eComp.setBackgroundColor(colors.red)
  243. eComp.setCursorPos (25, 1)
  244. eComp.write"×"
  245. eComp.setBackgroundColor(colors.white)
  246. eComp.setTextColor(colors.black)
  247. eComp.setCursorPos (2, 1)
  248. eComp.write"Add Computer manually"
  249. eComp.setCursorPos (2, 5)
  250. eComp.write"Computer ID: "
  251. eComp.setBackgroundColor(colors.lightGray)
  252. eComp.setCursorPos (15, 5)
  253. eComp.write"          "
  254. eComp.setCursorPos (10, 8)
  255. eComp.write" Apply "
  256. while true do
  257.         local event, button, x, y = os.pullEvent("mouse_click")
  258.         xy = x..","..y
  259.        
  260.         if event == "mouse_click" and x == math.ceil(w/2+18) and y == h/2-4 then
  261.         menu()
  262.         elseif event == "mouse_click" and x >= w/2+8 and x <= w/2+18 and y == h/2 then
  263.         eComp.setBackgroundColor(colors.gray)
  264.         term.setBackgroundColor(colors.gray)
  265.         eComp.setTextColor(colors.white)
  266.         eComp.setCursorPos (15, 5)
  267.         eComp.write"          "
  268.         eComp.setCursorPos (16, 5)
  269.         nID = read()
  270.         elseif event == "mouse_click" and x >= w/2+3 and x <= w/2+10 and y == h/2+3 then
  271.         if not fs.exists("/C/system/server/rules/AD/Computers/"..nID) then
  272.         local a = fs.open("/C/system/server/rules/AD/Computers/"..nID, "w")
  273.         a.close()
  274.         end
  275.         menu()
  276.         end
  277.     end
  278. end
  279.  
  280. function poli()
  281. barW.setCursorPos(25,1)
  282. barW.write"User Policy Setting"
  283.  
  284. end
  285.  
  286. function menu()
  287.     plocha()
  288.     if (page == "main") then
  289.         main ()
  290.     elseif (page == "Usr") then
  291.         Usr ()
  292.     elseif (page == "Comp") then
  293.         Comp ()
  294.     elseif (page == "Poli") then
  295.         poli()
  296.     end
  297.  
  298.     while true do
  299.         local event, button, x, y = os.pullEvent("mouse_click")
  300.         xy = x..","..y
  301.        
  302.         if event == "mouse_click" and x >= 2 and x <= 12 and y == 5 then
  303.         cbarva()
  304.         lista.setCursorPos(1,3)--
  305.         lista.write" Dashboard  "
  306.         sleep(anim)
  307.         page = "main"
  308.         menu()
  309.         elseif event == "mouse_click" and x >= 2 and x <= 12 and y == 7 then
  310.         cbarva()
  311.         lista.setCursorPos(1,5)--
  312.         lista.write" Users      "
  313.         sleep(anim)
  314.         page = "Usr"
  315.         menu()
  316.         elseif event == "mouse_click" and x >= 2 and x <= 12 and y == 9 then
  317.         cbarva()
  318.         lista.setCursorPos(1,7)--
  319.         lista.write" Computers  "
  320.         sleep(anim)
  321.         page = "Comp"
  322.         menu()
  323.         elseif event == "mouse_click" and x >= 2 and x <= 12 and y == 11 then
  324.         cbarva()
  325.         lista.setCursorPos(1,9)--
  326.         lista.write" Policy        "
  327.         sleep(anim)
  328.         page = "Poli"
  329.         menu()
  330.         elseif event == "mouse_click" and x >= w-8 and x <= w and y == 2 then   -- refresh Rules
  331.         barW.setTextColor(colors.lightGray)
  332.         barW.setCursorPos(w-8,1)
  333.         if (page=="Usr") then
  334.         barW.write"New User"
  335.         sleep(anim)
  336.         UserWin("")
  337.         else
  338.         barW.write"New PC"
  339.         sleep(anim)
  340.         CompWin()
  341.         end
  342.         elseif event == "mouse_click" and x >= 14 and x <= 23 and y == 12 and page=="main" and button == 1 then
  343.         pozadi.setBackgroundColor(colors.gray)
  344.         pozadi.setCursorPos(2,10)
  345.         pozadi.write " Start AD "
  346.         pozadi.setBackgroundColor(colors.white)
  347.         sleep(anim)
  348.         if fs.exists ("/C/service/AD.lua") then
  349.         multishell.launch({}, "/C/service/AD.lua")
  350.         pozadi.setTextColor(colors.green)
  351.         pozadi.setCursorPos(2,11)
  352.         pozadi.write"Started successfully"
  353.         sleep(0.5)
  354.         elseif fs.exists ("/C/stopService/AD.lua") then
  355.         pozadi.setTextColor(colors.red)
  356.         pozadi.setCursorPos(2,12)
  357.         pozadi.write"Service unavailable!"
  358.         pozadi.setCursorPos(2,13)
  359.         pozadi.write("You can enable the service in")
  360.         pozadi.setCursorPos(2,15)
  361.         pozadi.write("\"Server Manager > Services\"")
  362.         sleep(2)
  363.         end
  364.         elseif event == "mouse_click" and x >= 14 and x <= w-1 and y >= 4 and page=="Usr" and button == 1 then
  365.         i = y-3
  366.         if not (cUsr[i] == nil) then
  367.         paintutils.drawLine(14, y, w-1, y, colors.lightGray)
  368.         term.setCursorPos(15,y)
  369.         write(cUsr[i])
  370.         sleep(anim)
  371.         UserWin(cUsr[i])
  372.         end
  373.         elseif x >= 16 and x <= w and y >= 4 and button == 2 then
  374.             i = y-3
  375.             if (page == "Usr") then
  376.                 if not (cUsr[i] == nil) then
  377.                 paintutils.drawLine(14, y, w-1, y, colors.lightGray)
  378.                 term.setCursorPos(15,y)
  379.                 write(cUsr[i])
  380.                 end
  381.             elseif (page == "Comp") then
  382.                 if not (cComp[i] == nil) then
  383.                 paintutils.drawLine(14, y, w-1, y, colors.lightGray)
  384.                 term.setCursorPos(15,y)
  385.                 write(cComp[i])
  386.                 end
  387.             end
  388.         dialogWin = window.create(term.current(),x,y,10,3)
  389.         dialogWin.setBackgroundColor(colors.gray)
  390.         dialogWin.setTextColor(colors.white)
  391.         dialogWin.clear()
  392.         dialogWin.setCursorPos(2,1)
  393.         dialogWin.write "Edit"
  394.         dialogWin.setCursorPos(2,2)
  395.         dialogWin.write "Delete"
  396.         ENDS = false
  397.         dialogWin.setCursorPos(2,3)
  398.         if (page=="Usr") and not (cUsr[i] == nil) then
  399.         if fs.exists("/C/system/server/rules/AD/Users/"..cUsr[i].."/.lock") then ENDS = true dialogWin.write "Enable" else dialogWin.write "Disable" end
  400.         elseif (page=="Comp") and not (cComp[i] == nil) then
  401.         end
  402.         PosX = x
  403.         PosY = y
  404.         while true do
  405.             event, button, x,y = os.pullEvent()
  406.        
  407.             if event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY and button == 1 then
  408.                 if (cUsr[i] == nil) then menu () end
  409.                 UserWin(cUsr[i])
  410.             elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+1 and button == 1 then
  411.  
  412.                 if (page=="Usr") and not (cUsr[i] == nil) then fs.delete ("/C/system/server/rules/AD/Users/"..cUsr[i]) elseif (page=="Comp") and not (cComp[i] == nil) then fs.delete ("/C/system/server/rules/AD/Computers/"..cComp[i]) end
  413.                 kontrola()
  414.                 menu()
  415.             elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+2 and ENDS == true and button == 1 then
  416.                 if fs.exists("/C/system/server/rules/AD/Users/"..cUsr[i].."/.lock") then
  417.                     fs.delete("/C/system/server/rules/AD/Users/"..cUsr[i].."/.lock", "w")
  418.                 end
  419.                 dialogWin.setBackgroundColor(colors.lightGray)
  420.                 dialogWin.setCursorPos(1,3)
  421.                 dialogWin.write " Enable   "
  422.                 sleep(anim)
  423.                 menu()
  424.             elseif event == "mouse_click" and x >= PosX and x<= PosX+10 and y == PosY+2 and ENDS == false and button == 1 then
  425.                 if not (cUsr[i] == nil) then
  426.                     if not fs.exists("/C/system/server/rules/AD/Users/"..cUsr[i].."/.lock") then
  427.                         local f = fs.open("/C/system/server/rules/AD/Users/"..cUsr[i].."/.lock", "w")
  428.                         f.close()
  429.                     end
  430.                     dialogWin.setBackgroundColor(colors.lightGray)
  431.                     dialogWin.setCursorPos(1,3)
  432.                     dialogWin.write " Disable  "
  433.                     sleep(anim)
  434.                     menu()
  435.                 else
  436.                 menu()
  437.                 end
  438.             elseif event == "mouse_click" then
  439.                 menu()
  440.             end
  441.         end
  442.         end
  443.        
  444.        
  445.         if x == w and y == 1 then
  446.             ukonceni ()
  447.         else
  448.             menu() -------- stejne jako nazev funkce
  449.         end
  450.     end
  451. end
  452.  
  453. function CreateWindow()
  454.     DialWin = window.create(term.current(),w/2-11,h/2-7,25,16)
  455.     DialWin.setBackgroundColor(colors.white)
  456.     DialWin.setTextColor(colors.black)
  457.     DialWin.clear()
  458.     ww, wh = DialWin.getSize()
  459.     DialWin.setCursorPos (1,1)
  460.     DialWin.write ("+-----------------------+")
  461.     DialWin.setCursorPos (1,16)
  462.     DialWin.write ("+-----------------------+")
  463.     local i = 2
  464.         repeat
  465.         DialWin.setCursorPos (1,i)
  466.         DialWin.write ("|")
  467.         i = i + 1  
  468.     until i == 16
  469.     i = 2
  470.     repeat
  471.         DialWin.setCursorPos (ww,i)
  472.         DialWin.write ("|")
  473.         i = i + 1  
  474.     until i == 16
  475.     DialWin.setTextColor(colors.white)
  476.     DialWin.setBackgroundColor(colors.red)
  477.     DialWin.setCursorPos (ww,1)
  478.     DialWin.write "×"
  479.     DialWin.setBackgroundColor(colors.gray)
  480.     DialWin.setCursorPos (ww/2-2,wh)
  481.     DialWin.write " Apply "
  482.     DialWin.setBackgroundColor(colors.white)
  483.     DialWin.setTextColor(colors.black)
  484. end
  485.  
  486. function UserWin(SUser)
  487. defaultvalue()
  488.     if not (SUser == "") then
  489.     local f=fs.open("/C/system/server/rules/AD/Users/"..SUser.."/.data","r")
  490.     user=f.readLine()
  491.     pass=f.readLine()
  492.     Fname=f.readLine()
  493.     Lname=f.readLine()
  494.     IsAdmin=f.readLine()
  495.     f.close()
  496.     end
  497.    
  498.     CreateWindow()
  499.     DialWin.setCursorPos (3,2)
  500.     DialWin.write "UserName:"
  501.     DialWin.setCursorPos (3,5)
  502.     DialWin.write "Password:"
  503.     DialWin.setCursorPos (3,7)
  504.     DialWin.write "F Name:"
  505.     DialWin.setCursorPos (3,9)
  506.     DialWin.write "L Name:"
  507.     DialWin.setCursorPos (3,11)
  508.     DialWin.write "Permissions:"
  509.     DialWin.setBackgroundColor(colors.lightGray)
  510.     DialWin.setCursorPos (3,3)
  511.     DialWin.write "                     "
  512.     DialWin.setCursorPos (13,5)
  513.     DialWin.write "           "
  514.     DialWin.setCursorPos (13,7)
  515.     DialWin.write "           "
  516.     DialWin.setCursorPos (13,9)
  517.     DialWin.write "           "
  518.     DialWin.setCursorPos (16,11)
  519.     DialWin.write "        "
  520.    
  521.     if (SUser == "") then
  522.        
  523.     else
  524.         DialWin.setCursorPos (4,3)
  525.             if (Nuser == " ") then
  526.                 DialWin.write (tostring(user))
  527.             else
  528.         DialWin.write (tostring(Nuser))
  529.         end
  530.         DialWin.setCursorPos (14,5)
  531.         DialWin.write "Password"
  532.         if Fname == nil then Fname = "" end
  533.         DialWin.setCursorPos (14,7)
  534.         DialWin.write (Fname)
  535.         if Lname == nil then Lname = "" end
  536.         DialWin.setCursorPos (14,9)
  537.         DialWin.write (Lname)
  538.         if (IsAdmin == "t") then
  539.         DialWin.setCursorPos (16,11)
  540.         DialWin.write " Admin  "
  541.         else
  542.         DialWin.setCursorPos (16,11)
  543.         DialWin.write " User   "
  544.         end
  545.     end
  546.    
  547.    
  548.     while true do
  549.         local event, button, x, y = os.pullEvent("mouse_click")
  550.         xy = x..","..y
  551.        
  552.         if x >= 23 and x <= 27 and y == 17 and button == 1 then
  553.             DialWin.setCursorPos (ww/2-2,wh)
  554.             DialWin.write " Apply "
  555.             sleep(anim)
  556.             if (SUser == "") then
  557.                 if not fs.exists ("/C/system/server/rules/AD/Users/"..Nuser.."/.data") and not (Nuser == "") and not (Nuser == nil)then
  558.                     local f=fs.open("/C/system/server/rules/AD/Users/"..Nuser.."/.data","w")
  559.                     f.writeLine(Nuser)
  560.                     f.writeLine(Npass)
  561.                     f.writeLine(NFname)
  562.                     f.writeLine(NLname)
  563.                     f.writeLine(IsAdmin)
  564.                     f.close()
  565.                 end
  566.             else
  567.                 local f=fs.open("/C/system/server/rules/AD/Users/"..SUser.."/.data","w")
  568.                 f.writeLine(SUser)
  569.                 if not (Npass == " ") then f.writeLine(Npass) else f.writeLine("") end
  570.                 if not (NFname == " ") then f.writeLine(NFname) else f.writeLine("") end
  571.                 if not (NLname == " ") then f.writeLine(NLname) else f.writeLine("") end
  572.                 f.writeLine(IsAdmin)
  573.                 f.close()
  574.             end
  575.             defaultvalue()
  576.             menu()
  577.         elseif x >= w/2-ww/2+3 and x <= w/2+ww/2-2 and y == 4 and button == 1 then
  578.             bbarva()
  579.             DialWin.setBackgroundColor(colors.lightBlue)
  580.             DialWin.setCursorPos (3,3)
  581.             DialWin.write "                     "
  582.             DialWin.setCursorPos (4,3)
  583.             Nuser = read()
  584.         elseif x >= w/2-ww/2+14 and x <= w/2+ww/2-2 and y == 6 and button == 1 then
  585.             bbarva()
  586.             DialWin.setBackgroundColor(colors.lightBlue)
  587.             DialWin.setCursorPos (13,5)
  588.             DialWin.write "           "
  589.             DialWin.setCursorPos (14,5)
  590.             Npass = read(string.char(7))
  591.         elseif x >= w/2-ww/2+14 and x <= w/2+ww/2-2 and y == 8 and button == 1 then
  592.             bbarva()
  593.             DialWin.setBackgroundColor(colors.lightBlue)
  594.             DialWin.setCursorPos (13,7)
  595.             DialWin.write "           "
  596.             DialWin.setCursorPos (14,7)
  597.             NFname = read()
  598.         elseif x >= w/2-ww/2+14 and x <= w/2+ww/2-2 and y == 10 and button == 1 then
  599.             bbarva()
  600.             DialWin.setBackgroundColor(colors.lightBlue)
  601.             DialWin.setCursorPos (13,9)
  602.             DialWin.write "           "
  603.             DialWin.setCursorPos (14,9)
  604.             NLname = read()
  605.         elseif x >= w/2-ww/2+17 and x <= w/2+ww/2-2 and y == 12 and button == 1 then
  606.             DialWin.setCursorPos (16,11)
  607.            
  608.             if (IsAdmin == "t") then
  609.             IsAdmin = "f"
  610.             DialWin.write " User   "
  611.             else
  612.             DialWin.write " Admin  "
  613.             IsAdmin = "t"
  614.             end
  615.         elseif x == ww/2+w/2 and y == 2 and button == 1 then
  616.             defaultvalue()
  617.             menu()         
  618.         end
  619.     end
  620.  
  621. end
  622.  
  623. start()
Add Comment
Please, Sign In to add comment