1 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns
="http://www.w3.org/1999/xhtml" xml
:lang
="en" lang
="en">
5 <meta http
-equiv
="content-type" content
="text/html; charset=iso-8859-1" />
6 <title
>WordRunner
</title
>
12 error_reporting(E_ALL
& ~E_NOTICE
);
14 // ### END HTML ######################################################
16 if (empty($_POST['do']))
18 // ### START HTML ####################################################
21 <h1
>Welcome to WordRunner
</h1
>
22 <p
>This script will count the number of times a word is used in a passage
. Simply copy
and paste your article into the text area below
and press
"Run Words" to start the process
.</p
>
25 // ### END HTML ######################################################
30 // ### START HTML ####################################################
33 <h1
>Document Word Run Complete
</h1
>
34 <p
>WordRunner has finished processing your document
: the results are listed below
.</p
>
36 <table cellpadding
="4" cellspacing
="2" border
="1">
37 <tr style
="background-color:#696969">
38 <td
><strong
>Word
</strong
></td
>
39 <td
><strong
>Usage Index
</strong
></td
>
43 // ### END HTML ######################################################
44 $wordrunner_text = htmlspecialchars($_POST['wordtext']);
46 $punctstrip = str_replace(array('"', '"', '\'', '&', '/', '.', ',', '!', '@', ';', ':', '[', ']', '(', ')'), '', $wordrunner_text);
47 $wordarray = preg_split('#[\s]+#', $punctstrip);
49 foreach ($wordarray as $word)
51 if (!is_int($word) && trim($word))
53 $outputlist[ ucwords(strtolower($word)) ]++
;
59 foreach ($outputlist as $word => $count)
61 if (($_POST['ignoresmalls'] && $count > 3) || !$_POST['ignoresmalls'])
63 echo "<tr>\r\t<td>$word</td>\r\t<td>$count</td>\r</tr>\r";
67 echo "</table>\r<br />";
70 // ### START HTML ####################################################
73 <form action
="wordrunner.php" method
="post" name
="wordrunner">
74 <input type
="hidden" name
="do" value
="init">
75 <textarea name
="wordtext" rows
="60" cols
="20" style
="width:75%; height:50%"><?= $wordrunner_text ?></textarea
>
76 <div
><input type
="submit" name
="submit" value
=" Run Words " /> <input type
="checkbox" name
="ignoresmalls" value
="1" checked
="checked" />Ignore Words With Small Counts
</div
>
79 <div align
="center">WordRunner
©
;2004 Robert Sesek
</div
>