I want to authenticate my HTML form with lua script. create a session
variable and check if it is same . I tried it but it will not work .
Please help
index.html
<html><head> </head>
<h3><title>LOGIN</title></h3>
<body>
<div align="center">LOGIN
<form method="Post" action="get.lua">
<table border="0" cellspacing="10" cellpadding="10" align="middle">
<tr>
<th class="th" align="left">User Name</th>
<td><input type="text" name="username" placeholder="Username"></td>
</tr>
<tr>
<th class="th" align="left">Password</th><td><input type="password" name="password" placeholder="Password"></td>
</tr>
<tr><th><input type="submit" value="LOGIN"><td><input type="reset" value="RESET"></td></th></tr>
</table>
</form></div></body>
</html>
get.lua
require "string"
function handle(r)
r.content_type = "text/plain"
r:puts("\n...The Log Detailsss...\n\n")
local file = io.open("/var/www/html/settings.txt", "w")
if r.method == 'POST' then
r:puts("\n...The Log Detailsss...\n\n")
for k, v in pairs( r:parsebody() ) do
r:puts( string.format("%s: %s\n\n", k, v) )
file:write(string.format("%s: %s\n\n", k, v))
if r:parsebody() == "aaa" then
r:puts("hello)")
else
r:puts(error")
end
else
return 501
end
file:close()
return apache2.OK
end
it will not work ..please help