Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > ed08862132de5a762792cb4c9bac7d4a > files > 55

kaya-doc-0.5.2-7.fc13.noarch.rpm

cgi helloweb2;

import Regex;
import CGI;

Void PreContent()
{
    content("<html><head><title>Hello!</title>
             </head><body>");
}

Void Default()
{
    helloForm();
}

Void helloForm()
{
    content(formHandler(OnHello,0)+
	    "What is your name? "+
	    textBox("name")+
	    submit("Say Hello")+
	    closeForm());
}

Void OnHello(Int dummy)
{
    name = incomingValue("name",DataPost);
    // replace is a useful detainting function, but can't...
    replace("<","&lt;",name,[Global]);
    replace("&","&amp;",name,[Global]);
    content("<p>Hello "+name+"!</p>");
    helloForm();
}

Void PostContent()
{
    content("</body></html>");
}