Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --*****************************--
- --********BANQUE SERVEUR*******--
- --*****************************--
- --Décalaration de variable
- local checkstartup = false
- local checkfiles = false
- local checkshell2 = false
- local filesnumb = 0
- fileserror = 0
- local id = os.getComputerID()
- local st = ""
- local ver = "0.0.1"
- local string = ""
- local usersf = "/files/users/"
- local adminsf = "/files/admins.txt"
- local atmsf = "/files/atms.txt"
- local ronda = "/libs/rondanet"
- --Fin de décalaration de variable
- function startup()
- print("Démarage du serveur")
- print("Id de l'ordinateur:", id)
- print("Version: "..ver)
- print("Vérification des fichiers utilisateur")
- verif(usersf)
- verif(adminsf)
- verif("/libs/crypto")
- verif(atmsf)
- verif(ronda)
- if fileserror == 0 then
- print(filesnumb, "fichiers on été vérifier")
- else
- print(fileserror, "fichiers on n'on pas été vérifier !")
- sleep(2)
- os.shutdown()
- end
- print("\n\n\n")
- print("Ouverture de rondanet")
- os.loadAPI(ronda)
- rondanet.open("front")
- print("Fin du startup")
- parallel.waitForAll(redne, idre)
- end
- function verif(var)
- if fs.exists(var) then
- print(var.." existant")
- filesnumb = filesnumb + 1
- else
- print(var.." n'existe pas !")
- fileserror = fileserror + 1
- sleep(10)
- os.shutdown()
- end
- end
- function files(string)
- local response
- return(response)
- end
- function redne()
- print("Ecoute activée !")
- while true do
- local senderid, mess, proto = rondanet.receive("superproto")
- print("[BANQUE]", "[SenderID]:",senderid,"[Message]:", mess)
- local table = textutils.unserialize(mess)
- if table.action == "login" then
- local user = table.User
- local pass = table.Pass
- if fs.exists("/files/users/"..user) then
- local file fs.open("/files/users/"..user, "r")
- local id = file.readLine()
- local pseudo = file.readLine()
- local mot = file.readLine()
- local argent = file.readLine()
- local historique = file.readLine()
- local entreprise = file.readLine()
- file.close()
- if user == pseudo and mot == pass then
- local table = {action = "login", response = "yes"}
- rondanet.send(senderid, table)
- else
- local table = {action = "login", response = "no"}
- rondanet.send(senderid, table)
- end
- else
- print("Pas implementer", table.action)
- end
- end
- end
- rondanet.close()
- end
- function shell2()
- shell.openTab("shell")
- end
- function acces()
- end
- function idre()
- while true do
- if rondanet.isOpen("left") then
- print("Host has opened")
- rondanet.host("babanque", "server")
- else
- sleep(5)
- end
- end
- end
- parallel.waitForAll(startup, shell2)
Add Comment
Please, Sign In to add comment