Let's print out <i>all</i> the environment vars we get from the HTTP request:<br/>
<?
local env = getEnv();
for key,value in pairs(env) do
?>
<b><?=key?>:</b> <?=value?><br />
<?
end
?>
<form method="post">
<input type="text" name="name"/>
<input type="hidden" name="action" value="post stuff">
<input type="submit" value="Submit"/>
</form>
<?
local params = parsePost();
if (params and params["name"]) then
echo("Hello, ", params["name"], "!");
end
?>
<?
setContentType("text/plain");
?>
Plain text goes here, and any <html> tags should not be parsed.
local filename = "abcdefg.txt";
setContentType("text/plain");
file.send(filename); --# Use sendfile to maximize performance
<?
include("myheader.plua");
echo("Contents goes here");
include("footer.html"); --# You can include HTML files as well
?>
<?
header("Location", "/gone");
setReturnCode(302); --#Set httpd to return 302 Moved
print("We have moved!");
?>
~~~~~~