Content-type: text/html

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  <meta name="Generator" content="wrote by hand">
  <meta name="Author" content="Joey Kelly">
  <title>JKWiki: FortuneUsingPHP</title>
  <link type="text/css" href="jkwiki.css" rel="stylesheet"/>
  <script src="jkwiki.js"></script>
  <link rel="shortcut icon" href="jokeshow.jpg" type="image/x-icon">
</head>

<body>

  <div id="page">

    <div id="content">
      <!-- <h1>JKWiki: <small>FortuneUsingPHP</small></h1> -->
        <p><a href="?HomePage">HomePage</a> :: <a href="?TechnicalProjects">TechnicalProjects</a> :: FortuneUsingPHP</p>
<h1><a id="FortuneUsingPHP"></a>Fortune Using PHP</h1>
<p>It isn&#39;t much, but I wrote a PHP script that echoes sayings from <strong>fortune</strong>, which I&#39;ve put up on my site.</p>
<pre>
 ?php
 # This script is licensed under the GPL, and was written in summer 2003 by:
 # Joey Kelly, <a href="http://joeykelly.net">http://joeykelly.net</a>
 #
 # Here we are trying to echo a fortune to the user
 exec(<q>/usr/bin/fortune  $filepath/fortune.tmp</q>, $fortune, $returnvalue);
 #
 # general format for reading files
 $handle = fopen (<q>$filepath/fortune.tmp</q>, <q>r</q>);
 while (!feof ($handle)) 
   $fortune = fgets($handle, 4096);
   echo $fortune;
   echo <q>br</q>;

 fclose ($handle);
 #
 ?
</pre>
<p>Then you would call it in a php webpage this way:</p>
<pre>
 ?php
 $filepath = &#39;/path/to/files&#39;;
 include(<q>$filepath/fortune.inc</q>);
 ?
</pre>

    </div>

    <div id="footer">
      <hr>
      <small><i><b><a href="https://gitlab.com/mmlj4/jkwiki">JKWiki</a></b> is a scraped-together wiki app by Joey Kelly</i></small>
    </div>

  </div>

</body>
</html>
