i-fubar.com

Prozee poetry script

Feel free to use this. Working version here. This is PHP, a server-side scripting language. To use: copy and paste into a text editor, save as keitry.php and upload it to your server. "keitry" means "keitai poetry" and it's all for fun.

<?
// public released under no license whatsoever
//       Bill Pellowe 2003
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>  
                <?
}       
 
 
?>