local etlua = require "etlua" local utils = require "utils" local yqtemplateform = utils.readfile("yqform.etlua") local form = etlua.compile(yqtemplateform) return { desc = "Creates Yokoka’s quest-style personal status page", run = function(fcgi) fcgi.print("Content-Type: text/html; charset=utf-8\r\n\r\n") local data = "" local args = nil if fcgi.getenv("REQUEST_METHOD") == "POST" then args = {} local content_type = fcgi.getenv("CONTENT_TYPE") local boundary = content_type:match("; boundary=(.*)$") local post_data = fcgi.post() data = "Content type:" .. content_type .. "\n Boundary: " .. boundary .. "\n" for w in string.gmatch(post_data, "(.-)" .. boundary) do local name, dtype, value = utils.parse_form_entry(w) args[name] = { t = dtype, v = value } end for k, v in pairs(args) do data = data .. k .. ": " if v.t then data = data .. "[FILE:" .. v.t .. "]\n" else data = data .. v.v .. "\n" end end end fcgi.print( form { encoder = utils.tobase64, args = args, classes = { "Beast", "Swordsman", "Spirit Bird", "Twin Blades", "Healer", "Summoner", "Tamer", "Pugilist", "Mounted Fighter", "Fruit Animal", "Spellcaster" }, elements = { "Fire", "Water", "Earth", "Air", "Wood", "Electricity", "Metals", "Dreams", "Light", "Darkness", "Sun", "Moon", "Smoke", "Ice", "Crystal", "Sound", "Poison", "Lightning", "Weapons", "Fortune", "Healing", "Curses", "Day", "Night" } } ) end }