Version: 0.1
Type: Full Script
Category: Other
License: GNU General Public License
Description: Converts prose to poetry, in form at least. Random words per line and random lines per section, it’s like epic haiku. See a working version here: http://www.i-fubar.com/keitry.php
<? if($submit=="submit") { $view="do"; } else { $view = "ask"; } if($view=="ask"){ ?> <html><head><title>generator</title></head><body> <form action="keitry.php" method="post"> <input type="hidden" name="submit" value="submit"> <ul> Type the<br> proze<br> <br> here<br> <br> in the box:</ul> <textarea name="prozee" rows="15" cols="50"> </textarea> <br><br><input type="submit" value="get poezee"> </form></body></html> <? } elseif($view=="do") { if($redone=="yes") { $prozee=urldecode($prozee); } $prozee=str_replace(" ", "_", str_replace("n", " ", str_replace(" ", " ", $prozee))); ?> <html><head><title>Your poezee</title></head><body> <table border=0> <tr><td> <form action="keitry.php" method="post"> <input type="submit" value="new"> </form> </td><td> <form action="keitry.php" method="post"> <input type="hidden" name="redone" value="yes"> <input type="hidden" name="submit" value="submit"> <input type="hidden" name="prozee" value="<? echo urlencode($prozee); ?>"> <input type="submit" value="re-do this one"> </form> </td></tr></table><hr><center> <? $pArrray = explode('_', $prozee); $j=0; $line=0; mt_srand((double)microtime() * 55595952); $maxWords = mt_rand(2, 4); foreach($pArrray as $key=>$value) { $i++; if((strlen($value) < 4) && ($i<$maxWords)) { echo " "; } else { echo "<br>"; $i=0; $line++; mt_srand((double)microtime() * 1000000); $maxWords = mt_rand(2, 4); } if($j==0) { mt_srand((double)microtime() * 1333444); $j = mt_rand(1, 4); } if(($j == $line) || ($j < $line)) { // extra line break echo "<br>"; $j=0; $line = 1; } } ?> </center><hr> <table border=0> <tr><td> <form action="keitry.php" method="post"> <input type="submit" value="new"> </form> </td><td> <form action="keitry.php" method="post"> <input type="hidden" name="submit" value="submit"> <input type="hidden" name="redone" value="yes"> <input type="hidden" name="prozee" value="<? echo urlencode($prozee); ?>"> <input type="submit" value="re-do this one"> </form> </td></tr></table> </body></html> <? } ?>