SHOW:
|
|
- or go back to the newest paste.
| 1 | local maxw, maxh = term.getSize() | |
| 2 | ||
| 3 | - | -- IMPLEMENTAZIONE DEL DRAWFILLEDBOX |
| 3 | + | --IMPLEMENTAZIONE DEL DRAWFILLEDBOX |
| 4 | local function drawPixelInternal(xPos, yPos) | |
| 5 | term.setCursorPos(xPos, yPos) | |
| 6 | term.write(" ")
| |
| 7 | end | |
| 8 | ||
| 9 | local tColourLookup = {}
| |
| 10 | - | for n = 1, 16 do |
| 10 | + | for n = 1,16 do |
| 11 | - | tColourLookup[string.byte("0123456789abcdef", n, n)] = 2 ^ (n - 1)
|
| 11 | + | tColourLookup[string.byte("0123456789abcdef", n, n)] = 2^(n-1)
|
| 12 | end | |
| 13 | ||
| 14 | function drawFilledBox(startX, startY, endX, endY, nColour) | |
| 15 | - | if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~= "number" or type(endY) ~= "number" or |
| 15 | + | if type(startX) ~= "number" or type(startX) ~= "number" or |
| 16 | - | (nColour ~= nil and type(nColour) ~= "number") then |
| 16 | + | type(endX) ~= "number" or type(endY) ~= "number" or |
| 17 | (nColour ~= nil and type(nColour) ~= "number") then | |
| 18 | error("Expected startX, startY, endX, endY, colour", 2)
| |
| 19 | end | |
| 20 | ||
| 21 | startX = math.floor(startX) | |
| 22 | startY = math.floor(startY) | |
| 23 | endX = math.floor(endX) | |
| 24 | endY = math.floor(endY) | |
| 25 | ||
| 26 | if nColour then | |
| 27 | term.setBackgroundColor(nColour) | |
| 28 | end | |
| 29 | if startX == endX and startY == endY then | |
| 30 | drawPixelInternal(startX, startY) | |
| 31 | return | |
| 32 | end | |
| 33 | ||
| 34 | local minX = math.min(startX, endX) | |
| 35 | if minX == startX then | |
| 36 | minY = startY | |
| 37 | maxX = endX | |
| 38 | maxY = endY | |
| 39 | else | |
| 40 | minY = endY | |
| 41 | maxX = startX | |
| 42 | maxY = startY | |
| 43 | end | |
| 44 | ||
| 45 | for x = minX, maxX do | |
| 46 | for y = minY, maxY do | |
| 47 | drawPixelInternal(x, y) | |
| 48 | end | |
| 49 | end | |
| 50 | end | |
| 51 | ||
| 52 | function clear() | |
| 53 | sfondo(colors.lightBlue) | |
| 54 | term.clear() | |
| 55 | term.setCursorPos(1, 1) | |
| 56 | end | |
| 57 | ||
| 58 | function colore(sfumatura) | |
| 59 | term.setTextColour(sfumatura) | |
| 60 | end | |
| 61 | ||
| 62 | function sfondo(sfumaturaSfondo) | |
| 63 | term.setBackgroundColour(sfumaturaSfondo) | |
| 64 | end | |
| 65 | ||
| 66 | function titolo(testo) | |
| 67 | drawFilledBox(1, 1, maxw, 1, colors.yellow) | |
| 68 | term.setCursorPos((maxw - #testo) / 2, 1) | |
| 69 | colore(colors.black) | |
| 70 | term.write(testo) | |
| 71 | sfondo(colors.lightBlue) | |
| 72 | end | |
| 73 | ||
| 74 | function update() | |
| 75 | term.setCursorPos(1, 21) | |
| 76 | - | if fs.exists("startup2") then
|
| 76 | + | |
| 77 | - | shell.run("rm startup")
|
| 77 | + | if fs.exists("startup2") then
|
| 78 | - | shell.run("mv startup2 startup")
|
| 78 | + | shell.run("rm startup")
|
| 79 | shell.run("mv startup2 startup")
| |
| 80 | end | |
| 81 | os.reboot() | |
| 82 | end | |
| 83 | ||
| 84 | function disconnetti() | |
| 85 | clear() | |
| 86 | text = "ARRIVEDERCI!" | |
| 87 | colore(colors.white) | |
| 88 | term.setCursorPos((maxw - #text) / 2, math.floor(maxh / 2)) | |
| 89 | term.write(text) | |
| 90 | - | text2 = "Tra poco sarà possibile eseguire" |
| 90 | + | |
| 91 | text2 = "Tra poco saråA0 possibile eseguire" | |
| 92 | text3 = "una nuova operazione..." | |
| 93 | term.setCursorPos((maxw - #text2) / 2, math.floor(maxh / 2) + 2) | |
| 94 | print(text2) | |
| 95 | term.setCursorPos((maxw - #text3) / 2, math.floor(maxh / 2) + 3) | |
| 96 | print(text3) | |
| 97 | os.sleep(0.5) | |
| 98 | update() | |
| 99 | end | |
| 100 | ||
| 101 | function drawCard() | |
| 102 | drawFilledBox(6, 7, 24, 7, colors.blue) | |
| 103 | drawFilledBox(6, 15, 24, 15, colors.blue) | |
| 104 | drawFilledBox(5, 8, 25, 14, colors.blue) | |
| 105 | ||
| 106 | drawFilledBox(7, 9, 23, 9, colors.lightGray) | |
| 107 | drawFilledBox(7, 12, 23, 13, colors.black) | |
| 108 | end | |
| 109 | ||
| 110 | mag = peripheral.wrap("bottom")
| |
| 111 | bl = "BN Credit" | |
| 112 | ||
| 113 | sfondo(colors.lightBlue) | |
| 114 | clear() | |
| 115 | ||
| 116 | colore(colors.white) | |
| 117 | print(" ")
| |
| 118 | print(" ___ ")
| |
| 119 | print(" _ __ / _ \\__ _ _ _ ")
| |
| 120 | print(" | '_ \\ / /_)/ _ | | | |")
| |
| 121 | print(" | | | / ___/ (_| | |_| |")
| |
| 122 | print(" |_| |_\\/ \\__,_|\\__, |")
| |
| 123 | print(" |___/ ")
| |
| 124 | ||
| 125 | -- Bottoni login/registrati | |
| 126 | ||
| 127 | drawFilledBox(14, 10, 38, 12, colors.white) | |
| 128 | term.setCursorPos(23, 11) | |
| 129 | colore(colors.black) | |
| 130 | term.write("Accedi")
| |
| 131 | ||
| 132 | drawFilledBox(14, 15, 38, 17, colors.white) | |
| 133 | term.setCursorPos(21, 16) | |
| 134 | colore(colors.black) | |
| 135 | term.write("Sei nuovo?")
| |
| 136 | ||
| 137 | while true do | |
| 138 | event, key, x, y = os.pullEvent("mouse_click")
| |
| 139 | if event == "mouse_click" and x >= 14 and x <= 38 and y >= 15 and y <= 17 then | |
| 140 | -- Registrazione nuovo utente | |
| 141 | clear() | |
| 142 | titolo("Registrati a nPay")
| |
| 143 | term.setCursorPos(1, 3) | |
| 144 | print("Inserisci un nome utente e una password sicura.")
| |
| 145 | term.setCursorPos(1, 5) | |
| 146 | - | print( |
| 146 | + | |
| 147 | - | "Premi ENTER per confermare i dati inseriti.\nSe i dati sono corretti, il campo diventerà verde.\nSe sono errati, il programma chiederà di reinserirli nuovamente.") |
| 147 | + | print("Premi ENTER per confermare i dati inseriti.\nSe i dati sono corretti, il campo diventeråA0 verde.\nSe sono errati, il programma chiederåA0 di reinserirli nuovamente.")
|
| 148 | ||
| 149 | -- Nome Utente | |
| 150 | term.setCursorPos(1, 10) | |
| 151 | colore(colors.black) | |
| 152 | term.write("Nome utente:")
| |
| 153 | term.setCursorPos(14, 10) | |
| 154 | colore(colors.white) | |
| 155 | utenteAccettato = false | |
| 156 | conteggioErrori = 0 | |
| 157 | while utenteAccettato == false do | |
| 158 | utente = read() | |
| 159 | utente = string.gsub(utente, "%s", "") | |
| 160 | - | checkuser = http.get( |
| 160 | + | checkuser = http.get("http://luanet.rgbcraft.com/servlets/nebraskapay.php?auth=no&richiesta=verifica&utente=" .. utente).readAll()
|
| 161 | - | "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=no&richiesta=verifica&utente=" .. |
| 161 | + | |
| 162 | - | utente).readAll() |
| 162 | + | |
| 163 | term.setCursorPos(14, 10) | |
| 164 | colore(colors.lime) | |
| 165 | term.write(utente) | |
| 166 | colore(colors.white) | |
| 167 | utenteAccettato = true | |
| 168 | else | |
| 169 | term.setCursorPos(14, 10) | |
| 170 | colore(colors.red) | |
| 171 | term.write("Utente giåA0 esistente!")
| |
| 172 | sleep(2) | |
| 173 | - | term.write("Utente già esistente!")
|
| 173 | + | |
| 174 | colore(colors.white) | |
| 175 | term.write(" ")
| |
| 176 | term.setCursorPos(14, 10) | |
| 177 | conteggioErrori = conteggioErrori + 1 | |
| 178 | if conteggioErrori > 2 then | |
| 179 | term.setCursorPos(14, 10) | |
| 180 | colore(colors.red) | |
| 181 | term.write("Tre tentativi di immissione errati.")
| |
| 182 | sleep(2) | |
| 183 | term.setCursorPos(14, 10) | |
| 184 | colore(colors.white) | |
| 185 | term.write(" ")
| |
| 186 | term.setCursorPos(14, 10) | |
| 187 | clear() | |
| 188 | os.reboot() | |
| 189 | end | |
| 190 | end | |
| 191 | end | |
| 192 | ||
| 193 | --password | |
| 194 | colore(colors.black) | |
| 195 | - | -- password |
| 195 | + | |
| 196 | term.write("Password:")
| |
| 197 | term.setCursorPos(11, 12) | |
| 198 | colore(colors.white) | |
| 199 | ||
| 200 | passAccettata = false | |
| 201 | conteggioErrori = 0 | |
| 202 | while passAccettata == false do | |
| 203 | password1 = read("#")
| |
| 204 | colore(colors.black) | |
| 205 | term.setCursorPos(1, 13) | |
| 206 | term.write("Verifica:")
| |
| 207 | term.setCursorPos(11, 13) | |
| 208 | colore(colors.white) | |
| 209 | local password2 = read("#")
| |
| 210 | if password1 == password2 then | |
| 211 | term.setCursorPos(11, 12) | |
| 212 | colore(colors.lime) | |
| 213 | term.write("###############")
| |
| 214 | term.setCursorPos(11, 13) | |
| 215 | term.write("###############")
| |
| 216 | colore(colors.white) | |
| 217 | passAccettata = true | |
| 218 | else | |
| 219 | colore(colors.red) | |
| 220 | term.setCursorPos(11, 12) | |
| 221 | term.write("Le password non corrispondono! ")
| |
| 222 | term.setCursorPos(1, 13) | |
| 223 | colore(colors.white) | |
| 224 | term.write(" ")
| |
| 225 | sleep(1.5) | |
| 226 | term.setCursorPos(11, 12) | |
| 227 | term.write(" ")
| |
| 228 | term.setCursorPos(11, 12) | |
| 229 | conteggioErrori = conteggioErrori + 1 | |
| 230 | if conteggioErrori > 2 then | |
| 231 | term.setCursorPos(14, 12) | |
| 232 | colore(colors.red) | |
| 233 | term.write("Tre tentativi di immissione errati.")
| |
| 234 | sleep(1.5) | |
| 235 | term.setCursorPos(14, 12) | |
| 236 | colore(colors.white) | |
| 237 | term.write(" ")
| |
| 238 | term.setCursorPos(14, 12) | |
| 239 | clear() | |
| 240 | os.reboot() | |
| 241 | end | |
| 242 | end | |
| 243 | end | |
| 244 | ||
| 245 | --crea l'account | |
| 246 | ||
| 247 | - | -- crea l'account |
| 247 | + | |
| 248 | creaAccount = http.get("http://luanet.rgbcraft.com/servlets/nebraskapay.php?auth=" .. password1 .. "&utente=" .. utente .. "&richiesta=crea&valore=0").readAll()
| |
| 249 | tabCreaAccount = textutils.unserialize(creaAccount) | |
| 250 | - | creaAccount = http.get( |
| 250 | + | |
| 251 | - | "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=" .. password1 .. "&utente=" .. |
| 251 | + | |
| 252 | - | utente .. "&richiesta=crea&valore=0").readAll() |
| 252 | + | |
| 253 | sleep(1.5) | |
| 254 | clear() | |
| 255 | os.reboot() | |
| 256 | else | |
| 257 | colore(colors.red) | |
| 258 | print("Errore durante la creazione del conto.")
| |
| 259 | sleep(1.5) | |
| 260 | clear() | |
| 261 | os.reboot() | |
| 262 | end | |
| 263 | ||
| 264 | elseif event == "mouse_click" and x >= 14 and x <= 38 and y >= 10 and y <= 12 then | |
| 265 | clear() | |
| 266 | titolo("Accedi a nPay")
| |
| 267 | term.setCursorPos(1, 3) | |
| 268 | colore(colors.black) | |
| 269 | print("Inserire i propri dati.")
| |
| 270 | colore(colors.gray) | |
| 271 | print("\nPremere Enter per confermare i dati inseriti.\nSe i dati sono corretti, il campo diventeråA0 verde.\nSe sono errati, il programma chiederåA0 di reinserirli nuovamente.")
| |
| 272 | ||
| 273 | --nomeutente | |
| 274 | term.setCursorPos(1, 10) | |
| 275 | - | print( |
| 275 | + | |
| 276 | - | "\nPremere Enter per confermare i dati inseriti.\nSe i dati sono corretti, il campo diventerà verde.\nSe sono errati, il programma chiederà di reinserirli nuovamente.") |
| 276 | + | |
| 277 | term.setCursorPos(15, 10) | |
| 278 | - | -- nomeutente |
| 278 | + | |
| 279 | utenteAccettato = false | |
| 280 | conteggioErrori = 0 | |
| 281 | while utenteAccettato == false do | |
| 282 | utente = read() | |
| 283 | utente = string.gsub(utente, "%s", "") | |
| 284 | checkuser = http.get("http://luanet.rgbcraft.com/servlets/nebraskapay.php?auth=no&richiesta=verifica&utente=" .. utente).readAll()
| |
| 285 | tabcheckuser = textutils.unserialize(checkuser) | |
| 286 | if tabcheckuser.stato == "OK" then | |
| 287 | term.setCursorPos(15, 10) | |
| 288 | colore(colors.lime) | |
| 289 | - | checkuser = http.get( |
| 289 | + | |
| 290 | - | "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=no&richiesta=verifica&utente=" .. |
| 290 | + | |
| 291 | - | utente).readAll() |
| 291 | + | |
| 292 | else | |
| 293 | term.setCursorPos(15, 10) | |
| 294 | colore(colors.red) | |
| 295 | term.write("Utente errato! ")
| |
| 296 | sleep(2) | |
| 297 | term.setCursorPos(15, 10) | |
| 298 | colore(colors.white) | |
| 299 | term.write(" ")
| |
| 300 | term.setCursorPos(15, 10) | |
| 301 | conteggioErrori = conteggioErrori + 1 | |
| 302 | if conteggioErrori > 2 then | |
| 303 | term.setCursorPos(15, 10) | |
| 304 | colore(colors.red) | |
| 305 | term.write("Tre tentativi di immissione errati.")
| |
| 306 | sleep(2) | |
| 307 | term.setCursorPos(15, 10) | |
| 308 | colore(colors.white) | |
| 309 | term.write(" ")
| |
| 310 | term.setCursorPos(15, 10) | |
| 311 | clear() | |
| 312 | os.reboot() | |
| 313 | end | |
| 314 | end | |
| 315 | end | |
| 316 | ||
| 317 | --password | |
| 318 | colore(colors.black) | |
| 319 | term.setCursorPos(1,12) | |
| 320 | term.write("Password:")
| |
| 321 | term.setCursorPos(15, 12) | |
| 322 | ||
| 323 | conteggioErrori = 0 | |
| 324 | - | -- password |
| 324 | + | |
| 325 | while passAccettata == false do | |
| 326 | colore(colors.white) | |
| 327 | password = read("#")
| |
| 328 | password = string.gsub(password, "%s", "") | |
| 329 | colore(colors.black) | |
| 330 | checkuser = http.get("http://luanet.rgbcraft.com/servlets/nebraskapay.php?auth=" .. password .. "&richiesta=addebito&valore=0&utente=".. utente).readAll()
| |
| 331 | risposta = textutils.unserialize(checkuser) | |
| 332 | if risposta.stato == "OK" then | |
| 333 | term.setCursorPos(15, 12) | |
| 334 | colore(colors.lime) | |
| 335 | term.write("############## ")
| |
| 336 | colore(colors.white) | |
| 337 | - | checkuser = http.get("http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=" .. password ..
|
| 337 | + | |
| 338 | - | "&richiesta=addebito&valore=0&utente=" .. utente).readAll() |
| 338 | + | else |
| 339 | term.setCursorPos(15, 12) | |
| 340 | colore(colors.red) | |
| 341 | term.write("Password errata! ")
| |
| 342 | conteggioErrori = conteggioErrori + 1 | |
| 343 | sleep(2) | |
| 344 | term.setCursorPos(15, 12) | |
| 345 | term.write(" ")
| |
| 346 | term.setCursorPos(15, 12) | |
| 347 | if conteggioErrori > 2 then | |
| 348 | term.setCursorPos(15, 12) | |
| 349 | - | term.write("Password errata! ")
|
| 349 | + | |
| 350 | term.write("Tre tentativi di immissione errati.")
| |
| 351 | sleep(2) | |
| 352 | term.setCursorPos(15, 12) | |
| 353 | term.write(" ")
| |
| 354 | term.setCursorPos(15, 12) | |
| 355 | clear() | |
| 356 | os.reboot() | |
| 357 | end | |
| 358 | end | |
| 359 | end | |
| 360 | ||
| 361 | conteggioErrori = 0 | |
| 362 | -- Pagina in cui scegli le operazioni da fare | |
| 363 | ||
| 364 | while true do | |
| 365 | --Ricontrolla il saldo per gestire l'aggiornamento di piåB9 operazioni | |
| 366 | checkuser = http.get("http://luanet.rgbcraft.com/servlets/nebraskapay.php?auth="..password.."&richiesta=addebito&valore=0&utente="..utente).readAll()
| |
| 367 | risposta = textutils.unserialize(checkuser) | |
| 368 | saldo = tonumber(risposta.saldo) | |
| 369 | --Disegna la finestra del pannello utente | |
| 370 | clear() | |
| 371 | titolo("Pannello utente nPay")
| |
| 372 | term.setCursorPos(1, 3) | |
| 373 | - | -- Ricontrolla il saldo per gestire l'aggiornamento di più operazioni |
| 373 | + | |
| 374 | - | checkuser = http.get("http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=" .. password ..
|
| 374 | + | |
| 375 | - | "&richiesta=addebito&valore=0&utente=" .. utente).readAll() |
| 375 | + | |
| 376 | colore(colors.black) | |
| 377 | term.write("! Saldo: ")
| |
| 378 | - | -- Disegna la finestra del pannello utente |
| 378 | + | |
| 379 | term.write(saldo) | |
| 380 | colore(colors.black) | |
| 381 | term.write(" IC")
| |
| 382 | print("\n\nOperazioni disponibili:\n")
| |
| 383 | sfondo(colors.white) | |
| 384 | print(" Carica denaro su nPay \n")
| |
| 385 | print(" Preleva denaro da nPay \n")
| |
| 386 | print(" Trasferisci denaro \n")
| |
| 387 | print(" Estratto conto \n")
| |
| 388 | colore(colors.red) | |
| 389 | print(" Disconnettiti da nPay \n")
| |
| 390 | colore(colors.black) | |
| 391 | ||
| 392 | antitonto = os.startTimer(60) | |
| 393 | ||
| 394 | event, key, x, y = os.pullEventRaw() | |
| 395 | if event == "mouse_click" and y == 7 and x <= 24 then --Pulsante carica denaro su nPay | |
| 396 | clear() | |
| 397 | titolo("Caricamento denaro su nPay")
| |
| 398 | ||
| 399 | drawCard() | |
| 400 | ||
| 401 | sfondo(colors.lightBlue) | |
| 402 | colore(colors.black) | |
| 403 | term.setCursorPos(30, 8) | |
| 404 | - | if event == "mouse_click" and y == 7 and x <= 24 then -- Pulsante carica denaro su nPay |
| 404 | + | |
| 405 | term.setCursorPos(29, 10) | |
| 406 | print("NEL LETTORE IN BASSO")
| |
| 407 | drawFilledBox(34, 14, 42, 14, colors.white) | |
| 408 | term.setCursorPos(35, 14) | |
| 409 | term.write("Annulla")
| |
| 410 | ||
| 411 | mag.setInsertCardLight(true) | |
| 412 | finalBreakC = false | |
| 413 | while true do | |
| 414 | event, arg1, arg2, arg3 = os.pullEventRaw() | |
| 415 | if event == "mouse_click" and arg3 == 14 and arg2 >= 34 and arg2 <= 42 then -- arg2 = x | arg3 = y | |
| 416 | mag.setInsertCardLight(false) | |
| 417 | clear() | |
| 418 | term.setCursorPos(1,1) | |
| 419 | break | |
| 420 | elseif event == "mag_swipe" then | |
| 421 | mag.setInsertCardLight(false) | |
| 422 | tabel = textutils.unserialize(arg1) | |
| 423 | if tabel == "" or tabel == nil then | |
| 424 | clear() | |
| 425 | titolo("Caricamento denaro da nPay")
| |
| 426 | ||
| 427 | - | term.setCursorPos(1, 1) |
| 427 | + | |
| 428 | ||
| 429 | sfondo(colors.lightBlue) | |
| 430 | term.setCursorPos(36, 10) | |
| 431 | colore(colors.red) | |
| 432 | term.write("ERRORE!")
| |
| 433 | term.setCursorPos(30, 12) | |
| 434 | colore(colors.black) | |
| 435 | term.write("Carta smagnetizzata!")
| |
| 436 | os.sleep(3) | |
| 437 | break | |
| 438 | elseif tabel.t ~= "cc" or tabel.e ~= "BN" then | |
| 439 | clear() | |
| 440 | titolo("Caricamento denaro da nPay")
| |
| 441 | ||
| 442 | drawCard() | |
| 443 | ||
| 444 | sfondo(colors.lightBlue) | |
| 445 | term.setCursorPos(36, 10) | |
| 446 | colore(colors.red) | |
| 447 | - | elseif tabel.t == "cc" then |
| 447 | + | |
| 448 | term.setCursorPos(31, 12) | |
| 449 | colore(colors.black) | |
| 450 | term.write("Carta non valida!")
| |
| 451 | os.sleep(3) | |
| 452 | break | |
| 453 | else | |
| 454 | while true do | |
| 455 | clear() | |
| 456 | titolo("Caricamento denaro su nPay")
| |
| 457 | colore(colors.gray) | |
| 458 | print("\n\nDisponibilitåA0 su carta: " .. tabel.v .. " IC")
| |
| 459 | - | term.write("Carta NON SICURA!")
|
| 459 | + | |
| 460 | - | term.setCursorPos(31, 13) |
| 460 | + | |
| 461 | - | term.write("Convertire la carta")
|
| 461 | + | |
| 462 | - | term.setCursorPos(31, 14) |
| 462 | + | |
| 463 | - | term.write("presso gli sportelli")
|
| 463 | + | |
| 464 | - | term.setCursorPos(31, 15) |
| 464 | + | term.write("Eccezionalmente, grazie ai 600 voti di marzo,")
|
| 465 | - | term.write("in banca")
|
| 465 | + | --term.write("Per le operazioni inferiori a 50 000 IC,")
|
| 466 | term.setCursorPos(1, 16) | |
| 467 | print("le operazioni saranno GRATUITE fino al 4 aprile!")
| |
| 468 | --print("si applica una commissione del 0.15%.")
| |
| 469 | - | elseif tabel.t ~= "cd" or tabel.e ~= "BN" then |
| 469 | + | --print("Oltre 50 000 IC la commissione åA8 del 0.05%.")
|
| 470 | term.setCursorPos(1, 5) | |
| 471 | term.write("Importo da caricare: ")
| |
| 472 | colore(colors.white) | |
| 473 | credito = tonumber(tabel.v) | |
| 474 | credit = read() | |
| 475 | if tonumber(credit) == "" or tonumber(credit) == nil or tonumber(credit) <= 0 then | |
| 476 | colore(colors.red) | |
| 477 | term.setCursorPos(22, 5) | |
| 478 | term.write("Importo errato! ")
| |
| 479 | colore(colors.black) | |
| 480 | sleep(1.5) | |
| 481 | - | term.write("Carta non valida o corrotta!")
|
| 481 | + | |
| 482 | else | |
| 483 | if tonumber(credit) >= 50000 then | |
| 484 | --commissioni = tonumber(credit) * 0.005 | |
| 485 | commissioni = tonumber(credit) * 0 | |
| 486 | else | |
| 487 | --commissioni = tonumber(credit) * 0.015 | |
| 488 | commissioni = tonumber(credit) * 0 | |
| 489 | - | sibRaw = http.get( |
| 489 | + | |
| 490 | - | "http://luanet.rgbcraft.com/servlets/carte_debito.php?richiesta=verifica&uuid=" .. |
| 490 | + | crediton = credit + commissioni |
| 491 | - | tabel.v).readAll() |
| 491 | + | if tonumber(tabel.v) >= crediton then |
| 492 | - | sib = textutils.unserialize(sibRaw) |
| 492 | + | tab = http.get("http://luanet.rgbcraft.com/servlets/nebraskapay.php?utente=" .. utente .. "&auth=" .. password .. "&richiesta=accredito&valore=" .. credit).readAll()
|
| 493 | tabella = textutils.unserialize(tab) | |
| 494 | - | if type(sib) ~= "table" then |
| 494 | + | tabr = {}
|
| 495 | - | print("\n\n\nImpossibile comunicare con il server interbancario")
|
| 495 | + | tabr.t = tabel.t |
| 496 | - | sleep(5) |
| 496 | + | tabr.e = tabel.e |
| 497 | - | os.reboot() |
| 497 | + | tabr.p = tabel.p |
| 498 | tabr.v = tonumber(tabel.v) - crediton | |
| 499 | - | if sib.stato ~= "OK" then |
| 499 | + | ncr = textutils.serialize(tabr) |
| 500 | - | print("\n\n\nLa carta non risulta nel sistema interbancario, potrebbe essere stata disabilitata per uso fraudolento")
|
| 500 | + | |
| 501 | - | sleep(5) |
| 501 | + | |
| 502 | - | os.reboot() |
| 502 | + | |
| 503 | drawCard() | |
| 504 | ||
| 505 | - | print("\n\nDisponibilità su carta: " .. sib.saldo .. " IC")
|
| 505 | + | |
| 506 | sfondo(colors.lightBlue) | |
| 507 | term.setCursorPos(29, 10) | |
| 508 | print("RE-INSERIRE LA CARTA")
| |
| 509 | term.setCursorPos(29, 12) | |
| 510 | print("NEL LETTORE IN BASSO")
| |
| 511 | - | term.write("Grazie al Ministero dell'Abbondanza,")
|
| 511 | + | |
| 512 | - | -- term.write("Per le operazioni inferiori a 50 000 IC,")
|
| 512 | + | mag.setInsertCardLight(true) |
| 513 | mag.beginWrite(ncr, bl) | |
| 514 | - | print("le operazioni su nPay sono GRATUITE!")
|
| 514 | + | za2, carta = os.pullEvent("mag_write_done")
|
| 515 | - | -- print("si applica una commissione del 0.15%.")
|
| 515 | + | mag.setInsertCardLight(false) |
| 516 | - | -- print("Oltre 50 000 IC la commissione è del 0.05%.")
|
| 516 | + | |
| 517 | titolo("Caricamento denaro su nPay")
| |
| 518 | ||
| 519 | colore(colors.lime) | |
| 520 | term.setCursorPos(1, 3) | |
| 521 | print("Operazione completata!")
| |
| 522 | colore(colors.black) | |
| 523 | term.setCursorPos(1, 5) | |
| 524 | print("Denaro accreditato: " .. credit .. " IC")
| |
| 525 | print("Commissioni: " .. commissioni .. " IC")
| |
| 526 | term.setCursorPos(1, 8) | |
| 527 | print("Saldo sul conto: " .. tabella.credito .. " IC")
| |
| 528 | print("Saldo sulla carta: " .. tabr.v .. " IC")
| |
| 529 | sfondo(colors.white) | |
| 530 | term.setCursorPos(1, 12) | |
| 531 | - | -- commissioni = tonumber(credit) * 0.005 |
| 531 | + | |
| 532 | - | commissioni = tonumber(credit) * 0 |
| 532 | + | |
| 533 | ||
| 534 | - | -- commissioni = tonumber(credit) * 0.015 |
| 534 | + | |
| 535 | - | commissioni = tonumber(credit) * 0 |
| 535 | + | |
| 536 | local event, arg1, arg2, arg3 = os.pullEventRaw() | |
| 537 | - | crediton = credit + commissioni |
| 537 | + | if event == "mouse_click" and arg3 == 12 and arg2 <= 30 or event == "timer" and arg1 == antiTonto2 then -- arg2 = x | arg3 = y |
| 538 | finalBreakC = true | |
| 539 | - | sibRaw = http.get( |
| 539 | + | |
| 540 | - | "http://luanet.rgbcraft.com/servlets/carte_debito.php?richiesta=addebito&valore=" .. |
| 540 | + | |
| 541 | - | crediton .. "&uuid=" .. tabel.v).readAll() |
| 541 | + | |
| 542 | - | sib = textutils.unserialize(sibRaw) |
| 542 | + | |
| 543 | else | |
| 544 | - | if type(sib) ~= "table" then |
| 544 | + | |
| 545 | - | print("\n\n\nImpossibile comunicare con il server interbancario")
|
| 545 | + | |
| 546 | - | sleep(5) |
| 546 | + | |
| 547 | - | os.reboot() |
| 547 | + | |
| 548 | sleep(1.5) | |
| 549 | - | if sib.stato ~= "OK" then |
| 549 | + | |
| 550 | - | print("\n\n\nLa carta non risulta nel sistema interbancario, potrebbe essere stata disabilitata per uso fraudolento")
|
| 550 | + | |
| 551 | - | sleep(5) |
| 551 | + | |
| 552 | - | os.reboot() |
| 552 | + | |
| 553 | if finalBreakC then | |
| 554 | - | |
| 554 | + | |
| 555 | end | |
| 556 | - | if sib.stato == "OK" then |
| 556 | + | |
| 557 | - | tab = http.get("http://172.16.20.220/luanet/servlets/nebraskapay.php?utente=" ..
|
| 557 | + | |
| 558 | - | utente .. "&auth=" .. password .. |
| 558 | + | |
| 559 | - | "&richiesta=accredito&valore=" .. credit).readAll() |
| 559 | + | |
| 560 | elseif event == "mouse_click" and y == 9 and x <= 24 then --Pulsante preleva denaro da nPay | |
| 561 | clear() | |
| 562 | titolo("Prelievo denaro da nPay")
| |
| 563 | ||
| 564 | drawCard() | |
| 565 | ||
| 566 | sfondo(colors.lightBlue) | |
| 567 | colore(colors.black) | |
| 568 | term.setCursorPos(30, 8) | |
| 569 | print("INSERIRE LA CARTA")
| |
| 570 | term.setCursorPos(29, 10) | |
| 571 | print("NEL LETTORE IN BASSO")
| |
| 572 | drawFilledBox(34, 14, 42, 14, colors.white) | |
| 573 | term.setCursorPos(35, 14) | |
| 574 | - | print("Saldo sulla carta: " .. sib.credito .. " IC")
|
| 574 | + | |
| 575 | ||
| 576 | mag.setInsertCardLight(true) | |
| 577 | finalBreakP = false | |
| 578 | while true do | |
| 579 | event, arg1, arg2, arg3 = os.pullEventRaw() | |
| 580 | if event == "mouse_click" and arg3 == 14 and arg2 >= 34 and arg2 <= 42 then -- arg2 = x | arg3 = y | |
| 581 | mag.setInsertCardLight(false) | |
| 582 | clear() | |
| 583 | - | if event == "mouse_click" and arg3 == 12 and arg2 <= 30 or event == "timer" and |
| 583 | + | term.setCursorPos(1,1) |
| 584 | - | arg1 == antiTonto2 then -- arg2 = x | arg3 = y |
| 584 | + | |
| 585 | elseif event == "mag_swipe" then | |
| 586 | mag.setInsertCardLight(false) | |
| 587 | sfondo(colors.lightBlue) | |
| 588 | clear() | |
| 589 | tabel = textutils.unserialize(arg1) | |
| 590 | if tabel == "" or tabel == nil then | |
| 591 | clear() | |
| 592 | titolo("Prelievo denaro da nPay")
| |
| 593 | ||
| 594 | drawCard() | |
| 595 | ||
| 596 | sfondo(colors.lightBlue) | |
| 597 | term.setCursorPos(36, 10) | |
| 598 | colore(colors.red) | |
| 599 | term.write("ERRORE!")
| |
| 600 | term.setCursorPos(30, 12) | |
| 601 | colore(colors.black) | |
| 602 | term.write("Carta smagnetizzata!")
| |
| 603 | os.sleep(3) | |
| 604 | break | |
| 605 | elseif tabel.t ~= "cc" or tabel.e ~= "BN" then | |
| 606 | clear() | |
| 607 | - | elseif event == "mouse_click" and y == 9 and x <= 24 then -- Pulsante preleva denaro da nPay |
| 607 | + | |
| 608 | ||
| 609 | drawCard() | |
| 610 | ||
| 611 | sfondo(colors.lightBlue) | |
| 612 | term.setCursorPos(36, 10) | |
| 613 | colore(colors.red) | |
| 614 | term.write("ERRORE!")
| |
| 615 | term.setCursorPos(31, 12) | |
| 616 | colore(colors.black) | |
| 617 | term.write("Carta non valida!")
| |
| 618 | os.sleep(3) | |
| 619 | break | |
| 620 | else | |
| 621 | while true do | |
| 622 | tabr = {}
| |
| 623 | tabr.e = tabel.e | |
| 624 | tabr.p = tabel.p | |
| 625 | tabr.t = tabel.t | |
| 626 | tab1 = http.get("http://luanet.rgbcraft.com/servlets/nebraskapay.php?utente=" .. utente .. "&auth=" .. password .. "&richiesta=accredito&valore=0").readAll()
| |
| 627 | tab3 = textutils.unserialize(tab1) | |
| 628 | clear() | |
| 629 | titolo("Prelievo denaro da nPay")
| |
| 630 | - | term.setCursorPos(1, 1) |
| 630 | + | |
| 631 | print("\n\nDisponibilitåA0 su conto: " .. saldo .. " IC")
| |
| 632 | colore(colors.black) | |
| 633 | term.setCursorPos(1, 5) | |
| 634 | term.write("Importo da ritirare: ")
| |
| 635 | colore(colors.white) | |
| 636 | credito = tonumber(tabel.v) | |
| 637 | credit = read() | |
| 638 | if tonumber(credit) == "" or tonumber(credit) == nil or tonumber(credit) <= 0 then | |
| 639 | colore(colors.red) | |
| 640 | term.setCursorPos(22, 5) | |
| 641 | term.write("Importo errato! ")
| |
| 642 | colore(colors.black) | |
| 643 | sleep(1.5) | |
| 644 | clear() | |
| 645 | else | |
| 646 | tab = http.get("http://luanet.rgbcraft.com/servlets/nebraskapay.php?utente=" .. utente .. "&auth=" .. password .. "&richiesta=addebito&valore=" .. credit).readAll()
| |
| 647 | tabella = textutils.unserialize(tab) | |
| 648 | if tabella.stato == "DI" then | |
| 649 | colore(colors.red) | |
| 650 | term.setCursorPos(22, 5) | |
| 651 | term.write("Credito su carta insufficente.")
| |
| 652 | - | elseif tabel.t == "cc" then |
| 652 | + | |
| 653 | sleep(1.5) | |
| 654 | clear() | |
| 655 | else | |
| 656 | tabr.v = tonumber(tabel.v) + tonumber(credit) | |
| 657 | ncr = textutils.serialize(tabr) | |
| 658 | mag.setInsertCardLight(true) | |
| 659 | mag.beginWrite(ncr, bl) | |
| 660 | clear() | |
| 661 | titolo("Prelievo denaro da nPay")
| |
| 662 | ||
| 663 | drawCard() | |
| 664 | - | term.write("Carta NON SICURA!")
|
| 664 | + | |
| 665 | - | term.setCursorPos(31, 13) |
| 665 | + | |
| 666 | - | term.write("Convertire la carta")
|
| 666 | + | |
| 667 | - | term.setCursorPos(31, 14) |
| 667 | + | term.setCursorPos(29, 10) |
| 668 | - | term.write("presso gli sportelli")
|
| 668 | + | print("RE-INSERIRE LA CARTA")
|
| 669 | - | term.setCursorPos(31, 15) |
| 669 | + | term.setCursorPos(29, 12) |
| 670 | - | term.write("in banca")
|
| 670 | + | print("NEL LETTORE IN BASSO")
|
| 671 | ||
| 672 | mag.setInsertCardLight(true) | |
| 673 | event = os.pullEvent("mag_write_done")
| |
| 674 | - | elseif tabel.t ~= "cd" or tabel.e ~= "BN" then |
| 674 | + | mag.setInsertCardLight(false) |
| 675 | clear() | |
| 676 | titolo("Prelievo denaro da nPay")
| |
| 677 | ||
| 678 | colore(colors.lime) | |
| 679 | term.setCursorPos(1, 3) | |
| 680 | print("Operazione completata!")
| |
| 681 | colore(colors.black) | |
| 682 | term.setCursorPos(1, 5) | |
| 683 | print("Denaro prelevato: " .. credit .. " IC")
| |
| 684 | term.setCursorPos(1, 7) | |
| 685 | print("Saldo sul conto: " .. tabella.credito .. " IC")
| |
| 686 | print("Saldo sulla carta: " .. tabr.v .. " IC")
| |
| 687 | sfondo(colors.white) | |
| 688 | term.setCursorPos(1, 11) | |
| 689 | term.write(" Torna alla pagina principale ")
| |
| 690 | sfondo(colors.lightBlue) | |
| 691 | - | tab1 = http.get( |
| 691 | + | |
| 692 | - | "http://172.16.20.220/luanet/servlets/nebraskapay.php?utente=" .. utente .. |
| 692 | + | |
| 693 | - | "&auth=" .. password .. "&richiesta=accredito&valore=0").readAll() |
| 693 | + | |
| 694 | local event, arg1, arg2, arg3 = os.pullEventRaw() | |
| 695 | if event == "mouse_click" and arg3 == 11 and arg2 <= 30 or event == "timer" and arg1 == antiTonto2 then -- arg2 = x | arg3 = y | |
| 696 | finalBreakP = true | |
| 697 | break | |
| 698 | - | print("\n\nDisponibilità su conto: " .. saldo .. " IC")
|
| 698 | + | |
| 699 | end | |
| 700 | break | |
| 701 | end | |
| 702 | end | |
| 703 | end | |
| 704 | if finalBreakP then | |
| 705 | break | |
| 706 | end | |
| 707 | end | |
| 708 | end | |
| 709 | end | |
| 710 | ||
| 711 | elseif event == "mouse_click" and y == 11 and x <= 24 then --Pulsante trasferisci denaro | |
| 712 | --Trasferisci denaro | |
| 713 | - | tab = http.get("http://172.16.20.220/luanet/servlets/nebraskapay.php?utente=" ..
|
| 713 | + | --inizio pagina |
| 714 | - | utente .. "&auth=" .. password .. "&richiesta=addebito&valore=" .. |
| 714 | + | |
| 715 | - | credit).readAll() |
| 715 | + | |
| 716 | term.setCursorPos(1, 3) | |
| 717 | term.write("Inserire il nome utente del beneficiario.")
| |
| 718 | colore(colors.gray) | |
| 719 | print("\n\nPremere Enter per confermare i dati inseriti.\nSe i dati sono corretti, il campo diventeråA0 verde.\nSe sono errati, il programma chiederåA0 di reinserirli nuovamente.")
| |
| 720 | - | term.write("Credito insufficente.")
|
| 720 | + | |
| 721 | --Mostra saldo | |
| 722 | term.setCursorPos(1, 10) | |
| 723 | colore(colors.gray) | |
| 724 | print("Saldo disponibile: " .. saldo .. " IC")
| |
| 725 | colore(colors.black) | |
| 726 | ||
| 727 | --Verifica Beneficiario | |
| 728 | - | sibRaw = http.get( |
| 728 | + | |
| 729 | - | "http://luanet.rgbcraft.com/servlets/carte_debito.php?richiesta=accredito&valore=" .. |
| 729 | + | |
| 730 | - | credit .. "&uuid=" .. tabel.v).readAll() |
| 730 | + | |
| 731 | - | sib = textutils.unserialize(sibRaw) |
| 731 | + | |
| 732 | destAccettato = false | |
| 733 | - | if type(sib) ~= "table" then |
| 733 | + | |
| 734 | - | print("\n\n\nImpossibile comunicare con il server interbancario")
|
| 734 | + | |
| 735 | - | sleep(5) |
| 735 | + | |
| 736 | - | os.reboot() |
| 736 | + | checkuser = http.get("http://luanet.rgbcraft.com/servlets/nebraskapay.php?auth=no&richiesta=verifica&utente=" .. beneficiario).readAll()
|
| 737 | tabcheckuser = textutils.unserialize(checkuser) | |
| 738 | - | if sib.stato ~= "OK" then |
| 738 | + | |
| 739 | - | print("\n\n\nLa carta non risulta nel sistema interbancario, potrebbe essere stata disabilitata per uso fraudolento")
|
| 739 | + | |
| 740 | - | sleep(5) |
| 740 | + | |
| 741 | - | os.reboot() |
| 741 | + | |
| 742 | colore(colors.white) | |
| 743 | - | |
| 743 | + | |
| 744 | else | |
| 745 | - | if sib.stato == "OK" then |
| 745 | + | |
| 746 | term.setCursorPos(15, 12) | |
| 747 | - | clear() |
| 747 | + | |
| 748 | - | titolo("Prelievo denaro da nPay")
|
| 748 | + | |
| 749 | term.write("Non puoi inserire te stesso.")
| |
| 750 | - | colore(colors.lime) |
| 750 | + | |
| 751 | - | term.setCursorPos(1, 3) |
| 751 | + | |
| 752 | - | print("Operazione completata!")
|
| 752 | + | |
| 753 | - | colore(colors.black) |
| 753 | + | |
| 754 | - | term.setCursorPos(1, 5) |
| 754 | + | |
| 755 | - | print("Denaro prelevato: " .. credit .. " IC")
|
| 755 | + | |
| 756 | - | term.setCursorPos(1, 7) |
| 756 | + | |
| 757 | - | print("Saldo sul conto: " .. tabella.credito .. " IC")
|
| 757 | + | |
| 758 | - | print("Saldo sulla carta: " .. sib.credito .. " IC")
|
| 758 | + | |
| 759 | - | sfondo(colors.white) |
| 759 | + | |
| 760 | - | term.setCursorPos(1, 11) |
| 760 | + | |
| 761 | - | term.write(" Torna alla pagina principale ")
|
| 761 | + | |
| 762 | - | sfondo(colors.lightBlue) |
| 762 | + | |
| 763 | term.setCursorPos(15, 12) | |
| 764 | - | antiTonto2 = os.startTimer(15) |
| 764 | + | |
| 765 | - | while true do |
| 765 | + | |
| 766 | - | local event, arg1, arg2, arg3 = os.pullEventRaw() |
| 766 | + | |
| 767 | - | if event == "mouse_click" and arg3 == 11 and arg2 <= 30 or event == |
| 767 | + | |
| 768 | - | "timer" and arg1 == antiTonto2 then -- arg2 = x | arg3 = y |
| 768 | + | |
| 769 | - | finalBreakP = true |
| 769 | + | |
| 770 | - | break |
| 770 | + | |
| 771 | - | end |
| 771 | + | |
| 772 | ||
| 773 | - | break |
| 773 | + | |
| 774 | --Verifica valore dell'invio | |
| 775 | term.setCursorPos(1, 14) | |
| 776 | term.write("Importo:")
| |
| 777 | - | if finalBreakP then |
| 777 | + | |
| 778 | - | break |
| 778 | + | |
| 779 | importoAccettato = false | |
| 780 | conteggioErrori = 0 | |
| 781 | while importoAccettato == false do | |
| 782 | importo = tonumber(read()) | |
| 783 | if importo == "" or importo == nil or importo <= 0 then | |
| 784 | - | elseif event == "mouse_click" and y == 11 and x <= 24 then -- Pulsante trasferisci denaro |
| 784 | + | |
| 785 | - | -- Trasferisci denaro |
| 785 | + | |
| 786 | - | -- inizio pagina |
| 786 | + | |
| 787 | term.write("Importo errato! ")
| |
| 788 | sleep(2) | |
| 789 | term.setCursorPos(15, 14) | |
| 790 | colore(colors.white) | |
| 791 | term.write(" ")
| |
| 792 | - | print( |
| 792 | + | |
| 793 | - | "\n\nPremere Enter per confermare i dati inseriti.\nSe i dati sono corretti, il campo diventerà verde.\nSe sono errati, il programma chiederà di reinserirli nuovamente.") |
| 793 | + | |
| 794 | term.setCursorPos(15, 14) | |
| 795 | - | -- Mostra saldo |
| 795 | + | |
| 796 | term.write(importo .. " IC") | |
| 797 | colore(colors.white) | |
| 798 | importoAccettato = true | |
| 799 | else | |
| 800 | conteggioErrori = conteggioErrori + 1 | |
| 801 | - | -- Verifica Beneficiario |
| 801 | + | |
| 802 | colore(colors.red) | |
| 803 | term.write("Credito insufficiente! ")
| |
| 804 | sleep(2) | |
| 805 | term.setCursorPos(15, 14) | |
| 806 | colore(colors.white) | |
| 807 | term.write(" ")
| |
| 808 | term.setCursorPos(15, 14) | |
| 809 | if conteggioErrori > 2 then | |
| 810 | - | checkuser = http.get( |
| 810 | + | |
| 811 | - | "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=no&richiesta=verifica&utente=" .. |
| 811 | + | |
| 812 | - | beneficiario).readAll() |
| 812 | + | |
| 813 | sleep(2) | |
| 814 | term.setCursorPos(15, 14) | |
| 815 | colore(colors.white) | |
| 816 | term.write(" ")
| |
| 817 | term.setCursorPos(15, 14) | |
| 818 | clear() | |
| 819 | os.reboot() | |
| 820 | end | |
| 821 | end | |
| 822 | end | |
| 823 | ||
| 824 | sleep(0.5) | |
| 825 | clear() | |
| 826 | titolo("Riepilogo del trasferimento")
| |
| 827 | ||
| 828 | text = "Vuoi inviare " .. importo .. " IC a " .. beneficiario .. "?" | |
| 829 | term.setCursorPos((maxw - #text) / 2, 6) | |
| 830 | term.write("Vuoi inviare ")
| |
| 831 | colore(colors.white) | |
| 832 | term.write(tostring(importo) .. " IC ") | |
| 833 | colore(colors.black) | |
| 834 | term.write("a ")
| |
| 835 | colore(colors.white) | |
| 836 | term.write(beneficiario) | |
| 837 | colore(colors.black) | |
| 838 | term.write("?")
| |
| 839 | ||
| 840 | drawFilledBox(7, 11, 23, 13, colors.white) | |
| 841 | drawFilledBox(29, 11, 45, 13, colors.white) | |
| 842 | ||
| 843 | term.setCursorPos(8, 12) | |
| 844 | colore(colors.lime) | |
| 845 | term.write("Invia il denaro")
| |
| 846 | ||
| 847 | term.setCursorPos(34, 12) | |
| 848 | colore(colors.red) | |
| 849 | term.write("Annulla")
| |
| 850 | - | -- Verifica valore dell'invio |
| 850 | + | |
| 851 | inviare = false | |
| 852 | while true do | |
| 853 | event, key, x, y = os.pullEvent() | |
| 854 | if event == "mouse_click" and x >= 7 and x <= 23 and y >= 11 and y <= 13 then | |
| 855 | inviaDenaro = http.get("http://luanet.rgbcraft.com/luanet/servlets/nebraskapay.php?auth=" .. password .. "&utente=" .. utente .. "&richiesta=trasferimento&valore=" .. importo .. "&beneficiario=" .. beneficiario).readAll()
| |
| 856 | risultatoInvio = textutils.unserialize(inviaDenaro) | |
| 857 | if risultatoInvio.stato == "OK" then | |
| 858 | text = "Invio del denaro riuscito." | |
| 859 | text2 = "Nuovo saldo: " .. risultatoInvio.credito .. " IC" | |
| 860 | sfondo(colors.lightBlue) | |
| 861 | colore(colors.lime) | |
| 862 | term.setCursorPos((maxw - #text) / 2, 16) | |
| 863 | term.write(text) | |
| 864 | colore(colors.black) | |
| 865 | term.setCursorPos((maxw - #text2) / 2, 18) | |
| 866 | term.write(text2) | |
| 867 | sleep(2) | |
| 868 | clear() | |
| 869 | break | |
| 870 | else | |
| 871 | text = "Errore durante l'invio del denaro." | |
| 872 | text2 = risultatoInvio.errore | |
| 873 | sfondo(colors.lightBlue) | |
| 874 | colore(colors.red) | |
| 875 | term.setCursorPos((maxw - #text) / 2, 16) | |
| 876 | term.write(text) | |
| 877 | colore(colors.black) | |
| 878 | term.setCursorPos((maxw - #text2) / 2, 18) | |
| 879 | term.write(text2) | |
| 880 | sleep(2) | |
| 881 | clear() | |
| 882 | break | |
| 883 | end | |
| 884 | elseif event == "mouse_click" and x >= 29 and x <= 45 and y >= 11 and y <= 13 then | |
| 885 | sfondo(colors.lightBlue) | |
| 886 | colore(colors.red) | |
| 887 | text = "Operazione annullata." | |
| 888 | term.setCursorPos((maxw - #text) / 2, 16) | |
| 889 | term.write(text) | |
| 890 | sleep(1.5) | |
| 891 | clear() | |
| 892 | break | |
| 893 | end | |
| 894 | end | |
| 895 | ||
| 896 | elseif event == "mouse_click" and y == 13 and x <= 24 then --Pulsante estratto conto | |
| 897 | --Estratto Conto (inizio pagina) | |
| 898 | clear() | |
| 899 | titolo("Estratto conto")
| |
| 900 | ||
| 901 | estratto = http.get("http://luanet.rgbcraft.com/servlets/nebraskapay.php?auth=" .. password .. "&utente=" .. utente .. "&richiesta=estratto").readAll()
| |
| 902 | ec = textutils.unserialize(estratto) | |
| 903 | term.setCursorPos(1, 3) | |
| 904 | print("Entrate:")
| |
| 905 | colore(colors.lime) | |
| 906 | print(ec.entrata1) | |
| 907 | print(ec.entrata2) | |
| 908 | print(ec.entrata3) | |
| 909 | print(ec.entrata4) | |
| 910 | colore(colors.black) | |
| 911 | print("\nUscite:")
| |
| 912 | colore(colors.red) | |
| 913 | print(ec.uscita1) | |
| 914 | print(ec.uscita2) | |
| 915 | print(ec.uscita3) | |
| 916 | print(ec.uscita4) | |
| 917 | term.setCursorPos(1, 18) | |
| 918 | sfondo(colors.white) | |
| 919 | colore(colors.black) | |
| 920 | term.write(" Torna al menåB9 principale ")
| |
| 921 | while true do | |
| 922 | event, key, x, y = os.pullEventRaw() | |
| 923 | if event == "mouse_click" and x <= 26 and y == 18 then | |
| 924 | break | |
| 925 | end | |
| 926 | end | |
| 927 | ||
| 928 | elseif event == "mouse_click" and y == 15 and x <= 24 then --Pulsante disconnetti da nPay | |
| 929 | disconnetti() | |
| 930 | ||
| 931 | - | inviaDenaro = http.get( |
| 931 | + | elseif event == "timer" and key == antitonto then --Butta fuori l'utente se non fa niente |
| 932 | - | "http://172.16.20.220/luanet/servlets/nebraskapay.php?auth=" .. password .. |
| 932 | + | |
| 933 | - | "&utente=" .. utente .. "&richiesta=trasferimento&valore=" .. importo .. |
| 933 | + | |
| 934 | - | "&beneficiario=" .. beneficiario).readAll() |
| 934 | + | |
| 935 | update() | |
| 936 | end | |
| 937 | end | |
| 938 | ||
| 939 | elseif event == "mouse_click" and x == maxw and y == maxh then -- Auto aggiornamento su magic corner (schermata principale) | |
| 940 | update() | |
| 941 | end | |
| 942 | end |