Version: 1
Type: Full Script
Category: BBS/Discussion
License: GNU General Public License
Description: A simple threaded discussion forum without use of SQL
<?php /********************************************************* ONBoard v1.0: by OtterNET Most Bulletin systems are setup with statesmodes there is usually one state for viewing, one for entering the message and one that writes the message then refreshes back to the viewing mode. What differes is this script is that one, it does not require the overhead of a database sever and two that it is a stateless design ---------------------------------------------------------- This forum can make Threads which can be individual replied to or deleted. Intended for a small user base ---------------------------------------------------------- Usage: Just changed the referenceS of C:/apache/htdocs/bb/ to where you want the messages stored; naturally one with write permissions *********************************************************/ //get time $datetime = date("ymdHis"); //del post if($delid){ $curpath="C:/apache/htdocs/bb/"."$delid"; unlink($curpath); } //end del post //write msg if($postid && $postmsg){ $curpath="C:/apache/htdocs/bb/"."$postid"; if($newtest = @file($curpath)){ $postmsg = "<hr><br>".$postmsg."<br><br>"; }else{ $postmsg = "<br>".$postmsg."<br><br>"; } $fp = fopen ("$curpath", "a"); fwrite($fp,$postmsg); fclose($fp); }//end writemsg //html header !! You Can Ignore This Part echo " <html><head> <title>ONBoard</title> <meta http-equiv="refresh" content="300;URL=index.php"> <style> <!-- BODY {font-family : Arial, Helvetica, sans-serif;} A:link {color: #ffffff; text-decoration: none;} A:visited {color: #ffffff; text-decoration: none;} A:hover {color: #ffffff; text-decoration: underline;} A:active {color: #ffffff; font-weight: bold;} --> </style></head> <body bgcolor="#000000" background="img/bg.gif" text="#ffffff" vlink="#ffffff"> ";//end header //begin html form echo " <form name="f" method="post" action="index.php"> "; //read dir $fi=0; $curpath="C:/apache/htdocs/bb/"; if ($dir = opendir($curpath)) { while (($file = readdir($dir)) !== false) { if($i>1){ $filelist[$fi] = $file; $fi++; } $i++; }//while closedir($dir); }//end read dir //begin display //Note: it is readering out the files in reverse order so that newer files go on top $fi--; while($fi>=0){ $readpath = $curpath.$filelist[$fi]; echo " <table bgcolor="#000000" width="80%" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF"> <tr> <td width="100%">$filelist[$fi]</td> <td><a href="index.php?delid=$filelist[$fi]"><img src="close.gif" alt="Delete Thread" border="0"></a></td> </tr> <tr> <td colspan="2"><table width="100%" border="0" cellpadding="10" cellspacing="0"><tr><td>"; echo @stripslashes(implode("<br>",file($readpath))); echo"</td></tr></table> </td> </tr> <tr> <td colspan="2"><div align="right">Reply<input name="postid" type="CHECKBOX" value="$filelist[$fi]"></div></td> </tr> </table> <br> "; $fi--; }//end while //end display //begin footer echo " <table border="0" cellpadding="3" cellspacing="0" bordercolor="#FFFFFF"> <tr><td> New Thread<input name="postid" type="CHECKBOX" value="$datetime"> </td></tr> </table> <textarea name="postmsg" cols="96" rows="3"></textarea> <input type="submit" name="write" value="Go"> </form> </body></html>"; //end footer ?>