##- # From Programming with Unicon # Copyright (C) 1999-2015 Clinton Jeffery, Shamim Mohamed, # Jafar Al Gharaibeh, Ray Pereda, and Robert Parlett # Licensed under the GNU FDL. # # Modifications by Brian Tiffin # Modified: 2016-11-19/16:52-0500 ##+ # # simple-cgi.icn # tectonics: # unicon -B simple-cgi.icn # mv simple ../cgi-bin/simple.cgi # link cgi procedure cgimain() # set defaults for both CGI and AJAX usage if /cgi["name"] | cgi["name"] === "" then cgi["name"] := "Guest" if /cgi["age"] | cgi["age"] === "" then cgi["age"] := "no" if /cgi["comments"] then cgi["comments"] := "" if /cgi["word"] then cgi["word"] := "" # remove any potentially dangerous characters cgi["name"] := map(cgi["name"], "<>&%", "....") cgi["age"] := map(cgi["age"], "<>&%", "....") cgi["comments"] := map(cgi["comments"], "<>&%", "....") cgi["word"] := map(cgi["word"], "<>&%", "....") # output for the web cgiEcho("Hello, ", cgi["name"], "!") cgiEcho("Are you really ", cgi["age"], " years old?") cgiEcho("You seek: ", cgi["fame"]==="on" & "fame") cgiEcho("You seek: ", cgi["fortune"]==="on" & "fortune") cgiEcho("You seek: ", cgi["grail"]==="on" & "grail") cgiEcho("Your favorite color is: ", cgi["color"]) cgiEcho("Your comments: ", cgi["comments"]) cgiEcho("") cgiEcho("Your AJAX word: ", cgi["word"]) cgiEcho("") cgiEcho("Home / " || "Back to HTML form / " || "Back to AJAX form") end