Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --*****************************
- --********BANQUE CLIENT********
- --*****************************
- --Déclaration des variables
- user = ""
- pass = ""
- idserver = 0
- whilef = false
- --rondane = "/disk/rednet"
- publickey = ""
- crypt = "/disk/crypto"
- os.loadAPI(crypt)
- --os.loadAPI(rondane)
- -- Fin des déclaration des variables
- function keyretriver()
- idserver = rednet.lookup("2banque", "server")
- local messagea = "keyretrive"
- if idserver == nil then
- print("La connection n'a pas plus être établie")
- print("Redémarage")
- sleep(2)
- os.reboot()
- else
- rednet.send(idserver, messagea, "superproto")
- end
- local disable = true
- while disable do
- local si, mess, distance = rednet.receive()
- if si == idserver then
- publickey = mess
- disable = false
- return publickey
- end
- end
- end
- function interfac()
- print("Connection au serveur banquaire")
- rednet.open("back")
- keyretriver()
- print("Banque interface")
- print("Entrée votre nom d'utilisateur:")
- user = read()
- print("Entrée votre mot de passe")
- pass = read("*")
- print("Connection en cours")
- conn()
- end
- function conn()
- local logintable = {action = "login", User = user, Pass = pass, id = os.getComputerID()}
- login = textutils.serialize(logintable)
- idserver = rednet.lookup("2banque", "server")
- logincrypt = crypto.encrypt(login, publickey)
- rednet.send(idserver, login, "superproto")
- while whilef == false do
- senderid, message, disance = rednet.receive()
- if senderid == idserver then
- mesge = textutils.unserialize(message)
- if mesge.action == "login" and mesge.user == user then
- whilef = True
- if mesge.response == "yes" then
- print("Vous êtes connectée !")
- sleep(2)
- maininterface()
- else
- print("Mauvais identifiant")
- break
- end
- end
- end
- end
- whilef = false
- end
- function maininterface()
- money = 0
- term.clear()
- term.setCursorPos(1,1)
- x,y = term.getSize()
- paintutils.drawFilledBox(1,1,x,y, colors.lightGray)
- paintutils.drawLine(1,1,x,1, colors.gray)
- term.setCursorPos(1,1)
- term.write("Menu de la banque")
- paintutils.drawPixel(x, 1, colors.red)
- term.setCursorPos(x,1)
- term.write("X")
- term.setCursorPos(1,2)
- term.write("Vous avez,"money)
- --Création des boutton
- paintutils.drawFilledBox(1,3,x:4,y, colors.green)
- --Actions menu
- end
- interfac()
Add Comment
Please, Sign In to add comment