name.fsp - Frink Server Pages highlighter

[Try name.fsp]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<%
   use makeselect.frink
%>
<HTML LANG="en">
 <HEAD>
  <TITLE>Random Name Generator</TITLE>
  <META HTTP-EQUIV="Default-Style" CONTENT="APE Airy"> 
  <LINK REL="StyleSheet" HREF="/frinkdocs/apeairy.css" TYPE="text/css"
        TITLE="APE Airy"> 
  <LINK REL="Alternate StyleSheet" HREF="/frinkdocs/style.css" TYPE="text/css"
        TITLE="APE Classic">
  <LINK REL="Alternate StyleSheet" HREF="/frinkdocs/style2.css" TYPE="text/css"
        TITLE="Compact"> 
  <LINK REL="icon" HREF="/images/futureboyicon.png" TYPE="image/png">
 </HEAD>

 <BODY>
  <H1>Random Name Generator</H1>
  <% num = num ? num : "10"
     numVal = eval[num]
     if (numVal > 100)
        numVal = 100

     sexes = ["Male", "Female", "Indeterminate"]
  %>

  <FORM ACTION="name.fsp" METHOD="POST">
   Gender:
   <SELECT NAME="sex">
    <% makeselect[sexes,sex] %>
   </SELECT><BR>
   
   Number: <INPUT TYPE="TEXT" SIZE="2" NAME="num" VALUE="$num">
   <INPUT TYPE="Submit">
  </FORM>

  <P>
   <%

   // The wordlist files are part of the Moby wordlist project, available at:
   //   http://icon.shef.ac.uk/Moby/
   root = "file:///home/eliasen/prog/mobydict/mwords"
   
  if (sex)
  {
     firstnames = []
     lastnames = []

     for [line] lines["$root/lastnames.txt"]
        lastnames.push[line]

     if (sex == "Female")
        filename = "$root/femalenames.txt"
     else
        if (sex == "Male")
           filename = "$root/malenames.txt"
        else
           filename = "$root/names.txt"

     for [line] lines[filename]
        firstnames.push[line]

     for i = 1 to numVal
        println[random[firstnames] + " " + random[lastnames] + "<BR>"]

     firstnames = lastnames = undef
   }
   %>
   </P>

  <HR>
  <P>
   <A HREF="/fsp/highlight.fsp?f=name.fsp">View source</A>
  </P>
  
  <P>
   <I><A HREF="mailto:eliasen@mindspring.com">Alan Eliasen</A></I> was born
   <%= round[now[] - #1969-08-19 04:54 PM Mountain#, minute] -> ["days", "hours", "minutes"] %> ago.
  </P>

  <P>
   Back to <A HREF="/frinkdocs/fspdocs.html">Frink Server Pages
    documentation.</A>
  </P>  
 </BODY>
</HTML>

[Try name.fsp]


Alan Eliasen was born 17480 days, 13 hours, 43 minutes ago.

Back to Frink Server Pages documentation.