From 9d328ead2c4f52c5f001cdc3baf59269c2853c65 Mon Sep 17 00:00:00 2001 From: Christian Zufferey Date: Sun, 27 Jan 2019 14:15:04 +0100 Subject: [PATCH] =?UTF-8?q?Mon=20serveur=20WEB=20ASP=20commence=20=C3=A0?= =?UTF-8?q?=20fonctionner,=20je=20ne=20suis=20pas=20tr=C3=A8s=20content=20?= =?UTF-8?q?car=20pour=20l'instant=20c'est=20mono-t=C3=A2che=20=C3=A0=20cau?= =?UTF-8?q?se=20des=20variables=20globales?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZYX-html-framework/page1.html | 3 ++- ZYX-html-framework/web_srv2.lua | 23 +++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/ZYX-html-framework/page1.html b/ZYX-html-framework/page1.html index 44992a8..1cf19de 100644 --- a/ZYX-html-framework/page1.html +++ b/ZYX-html-framework/page1.html @@ -15,7 +15,8 @@ La température est: <% -zout(ztemp.."oC") +ztemp=ztemp+1 +zout(ztemp.."°C") %>
Mais il fait encore trop froid !
diff --git a/ZYX-html-framework/web_srv2.lua b/ZYX-html-framework/web_srv2.lua index 926ea57..0b1a7e3 100644 --- a/ZYX-html-framework/web_srv2.lua +++ b/ZYX-html-framework/web_srv2.lua @@ -1,9 +1,16 @@ -- petit script de serveur WEB avec Active Server Page ZYX -print("\n web_srv2.lua zf190127.1127 \n") +print("\n web_srv2.lua zf190127.1340 \n") + +ztemp=12 -- send a file from memory to the client; max. line length = 1024 bytes! function send_file(zclient, zfilename) + zzclient=zclient + function zout(zstring) + zzclient:send(zstring) + end + if zfilename == "" then zfilename = "index.html" end if file.open(zfilename, "r") then repeat @@ -11,14 +18,18 @@ function send_file(zclient, zfilename) if line then if string.find(line, "<%%") then print("start lua...") - lua_code = true + flag_lua_code = true + lua_code = "" elseif string.find(line, "%%>") then print("stop lua...") - lua_code = false - elseif lua_code then - print(line) + flag_lua_code = false + print("Et voici le code lua inline:\n"..lua_code) + loadstring(lua_code)() --on exécute ici le code lua inline ! + elseif flag_lua_code then +-- print(line) + lua_code =lua_code..line else - zclient:send(line) + zout(line) end end until not line