cvs: php-hosts-web /msgboard getdoc.php getdoc2.php index.php list.php message.php post.php preview.php shared-msgboard.inc toolbar.php /msgboard/etc
delete.php edit.php index.php toolbar.php /msgboard/gifs big-doc.gif lil-doc.gif t-mboard.gif
| From: | jim winstead | Date: | Sun, 21 Apr 2002 20:58:05 +0000 |
| Subject: | cvs: php-hosts-web /msgboard getdoc.php getdoc2.php index.php list.php message.php post.php preview.php shared-msgboard.inc toolbar.php /msgboard/etc delete.php edit.php index.php toolbar.php /msgboard/gifs big-doc.gif lil-doc.gif t-mboard.gif |
||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-9725@lists.php.net to get a copy of this message | ||
jimw Sun Apr 21 16:58:05 2002 EDT
Added files:
/php-hosts-web/msgboard getdoc.php getdoc2.php index.php list.php
message.php post.php preview.php
shared-msgboard.inc toolbar.php
/php-hosts-web/msgboard/etc delete.php edit.php index.php
toolbar.php
/php-hosts-web/msgboard/gifs big-doc.gif lil-doc.gif t-mboard.gif
Log:
the missing msgboard stuff
Index: php-hosts-web/msgboard/getdoc.php +++ php-hosts-web/msgboard/getdoc.php <?php include("shared-msgboard.inc"); commonHeader(); $FT="<FONT FACE=\"$FONTFACE\">"; $q1=mysql($DBASE,"select * from $TABLE_DOCS where document=$document"); $docinfo=getDocInfo($document); echo "<TABLE BORDER=0 cellpadding=5 cellspacing=0 width=$TABLE_WIDTH BGCOLOR=\"$MSG_FRAME_COLOR2\">\n"; echo "<TR VALIGN=top><TD align=left>$FT<FONT SIZE=-1>\n"; echo "<FONT SIZE=+1><B>Document Download</B></FONT><P>\n"; showDisclaimer(); echo "<P></TD></TR>\n"; echo "<TR VALIGN=top><TD align=left>$FT<FONT SIZE=-1>\n"; echo "<TABLE BORDER=0 WIDTH=100% BGCOLOR=\"$MSG_FRAME_COLOR\" cellpadding=10 cellspacing=0><TR valign=top>\n"; echo "<TD><A HREF=\"getdoc2.php/$document/$docinfo[0]\">$BIG_DOC_IMG</A></TD>\n"; echo "<TD align=left>$FT\n"; echo "Filename: <A HREF=\"getdoc2.php/$document/$docinfo[0]\"><B>$docinfo[0]</B></A><BR>\n"; echo "Size: <B>$docinfo[1] bytes</B><BR>\n"; if ($docinfo[2]!=""): echo "Type: ".$docinfo[2]."<BR>\n"; endif; echo "</TD></TR></TABLE>\n"; echo "<CENTER>Click on the icon or the filename to download.</CENTER>\n"; echo "</TD></TR></TABLE>\n"; commonFooter(); ?> Index: php-hosts-web/msgboard/getdoc2.php +++ php-hosts-web/msgboard/getdoc2.php <?php include("shared-msgboard.inc"); $file=strtok($PATH_INFO,"/"); $file=strtok("/"); $newfile=sprintf("%-07.7d",$file); $newfile="$DOCS/d"+$newfile; $docinfo=getDocInfo($file); $filesize=$docinfo[1]; if ($docinfo[2]==""): $filetype="binary/x-cbmbin"; else: $filetype=$docinfo[2]; endif; Header("Content-type: $filetype"); Header("Content-Length: $filesize"); ReadFile($newfile);?> Index: php-hosts-web/msgboard/index.php +++ php-hosts-web/msgboard/index.php <?php require 'shared-msgboard.inc'; commonHeader("Message Board"); ?> <h3>Message Board</h3> <? introText(); ?> <P> Click on <? echo $IMG_SHOW; ?> for a listing of all the comments for a particular <? echo $SUBGROUP_TITLE; ?>. To add your own comments, click on <? echo $IMG_ADD; ?>. </P> <? echo "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=5 WIDTH=100%>\n"; echo "<TR BGCOLOR=\"$MSG_FRAME_COLOR2\" VALIGN=bottom>\n"; echo "<TD ALIGN=left>"; font("-1"); echo $SUBGROUP_TITLE."</TD>\n"; echo "<TD ALIGN=center>"; font("-1"); echo "Number of<BR>Messages</TD>\n"; echo "<TD ALIGN=center>"; font("-1"); echo "Latest<BR>Message</TD>\n"; echo "<TD><BR></TD>\n"; echo "<TD><BR></TD>\n"; echo "</TR>\n"; $i=0; while (list($id,$section)=each($SUBGROUP)): $bg=$BGCOLOR[$i%2]; echo "<TR BGCOLOR='$bg' VALIGN=middle>\n"; echo "<TD>"; font(""); echo $section."<BR></TD>\n"; $query="select count(id) as count, max(date) as last"; $query.=" from msgboard_msgs"; $query.=" where subgroup=".$id; echo "<!-- $query -->\n"; $q2=mysql_db_query($DBASE,$query); $count=mysql_result($q2,0,"count"); $last=date("d-M-Y",mysql_result($q2,0,"last")); if ($count==0): $last="-"; else: endif; mysql_free_result($q2); echo "<TD ALIGN=right>"; font("-1"); echo "$count<BR></TD>\n"; echo "<TD ALIGN=center>"; font("-1"); echo "$last<BR></TD>\n"; echo "<TD>"; font("-1"); if ($count!=0): echo "<A HREF=\"list.php?subgroup=" .$id . "\">" . $IMG_SHOW . "</A>"; endif; echo "<BR></TD>"; echo "<TD>"; font("-1"); echo "<A HREF=\"post.php?subgroup=" . $id . "\">" . $IMG_ADD . "</A>"; echo "<BR></TD>"; echo "</TR>\n"; $i++; endwhile; echo "</TABLE>\n"; commonFooter(); ?> Index: php-hosts-web/msgboard/list.php +++ php-hosts-web/msgboard/list.php <?php include("shared-msgboard.inc"); if ($USE_SUBGROUPS): if (isSet($subgroup)): $groupname=getSubgroupName($subgroup); commonHeader("List Messages: $groupname"); title("List Messages"); else: Header("Location: $ROOT_URL"); exit; endif; else: $subgroup=0; endif; ?> Click on the message title to read that message, or <A HREF="post.php?subgroup=<? echo $subgroup;?>">click here</A> to post a new message. <P> <TABLE BORDER=0 CELLPADDING=5 CELLSPACING=0 BGCOLOR="<? echo $MSG_FRAME_COLOR2;?>" WIDTH=100%> <TR VALIGN=bottom> <TD ALIGN=left><? font("-1");?> Messages for<BR></FONT> <? font();?><B><? echo $groupname;?></B><BR></FONT> </TD> </TR> <TR VALIGN=top> <TD> <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%> <? getHeaders(0,$subgroup,"",0); ?> </TABLE> </TD></TR> </TABLE><P> <CENTER> <? include($TOOLBAR); echo "</CENTER>\n"; commonFooter(); ?> Index: php-hosts-web/msgboard/message.php +++ php-hosts-web/msgboard/message.php <?php include("shared-msgboard.inc"); $q1=mysql($DBASE,"select * from $TABLE_MSGS where id=$id"); $parent=intval(mysql_result($q1,0,"parent")); $subj=mysql_result($q1,0,"subj"); $email=mysql_result($q1,0,"email"); $name=mysql_result($q1,0,"name"); $date=mysql_result($q1,0,"date"); $date=date($DATE_FORMAT,$date); $document=mysql_result($q1,0,"document"); $subgroup=mysql_result($q1,0,"subgroup"); $section=getSubgroupName($subgroup); commonHeader("Message: $section"); title("Message: $section"); showMessage("show",$subj,$subgroup,$name,$email,$date,$document,$parent,$id); $q2=mysql($DBASE, "select id from $TABLE_MSGS where parent=$id and subgroup=$subgroup"); if (mysql_numrows($q2)!=0): echo "<TR VALIGN=top><TD align=left colspan=2><FONT FACE=\"$FONTFACE\" SIZE=-1>Follow-ups:<p>\n"; echo "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>\n"; getHeaders($id,$subgroup,"",-1); echo "</TABLE>\n"; echo "</TD></TR>\n"; endif; echo "</TABLE><BR>\n"; echo "<CENTER>\n"; echo "<a href=\"post.php?subgroup=$subgroup&parent=$id\">$BUTTON_POSTFOLLOW</a> | \n"; include($TOOLBAR); echo "</CENTER>\n"; commonFooter(); ?> Index: php-hosts-web/msgboard/post.php +++ php-hosts-web/msgboard/post.php <?php include("shared-msgboard.inc"); $groupname=getSubgroupName($subgroup); commonHeader("Post a New Message: $groupname"); if($mode=="preview"): if ($USE_DOC_UPLOAD && $filename!="none"): $q=mysql($DBASE,"insert into $TABLE_DOCS values (0,'$filename_name',$filename_size,'$filename_type')"); $fileid=mysql_insert_id(); $newfile=sprintf("%-07.7d",$fileid); $newfile="$DOCS/d"+$newfile; $command=QuoteMeta("cp $filename $newfile"); exec($command); chmod($newfile,"0664"); unlink($filename); else: $fileid=0; endif; include("preview.php"); commonFooter(); exit; elseif($mode=="post"): if($parent!=0): title("Post a Follow-Up Message: ".$groupname); else: title("Post a New Message: ".$groupname); endif; $time=time(); $subj=addslashes($subj); $email=addslashes($email); $name=addslashes($name); $query="insert into $TABLE_MSGS values (0,$time,$subgroup,$parent,$type,'$subj','$email','$name',$fileid)"; echo "<!-- $query -->\n"; mysql_db_query($DBASE,$query); $id=mysql_insert_id(); $newfile="$MSGS/$id"; if (file_exists($tempfile)): $command=QuoteMeta("mv $tempfile $newfile"); exec($command); endif; echo "<FONT SIZE=+1><b>Message posted.</b></FONT><P>\n"; echo "<CENTER>\n"; include("toolbar.php"); echo "</CENTER>\n"; commonFooter(); exit; endif; if(isSet($parent)): title("Post a Follow-Up Message: ".$groupname); else: title("Post a New Message: ".$groupname); endif; ?> <SCRIPT LANGUAGE="Javascript"> <!-- function checkFields() { if (document.forms[0].elements['name'].value == "") { alert("Please enter your name."); document.forms[0].elements['name'].focus(); return false ; } if (document.forms[0].elements['subj'].value == "") { alert("Please enter a title for this posting."); document.forms[0].elements['subj'].focus(); return false ; } if (document.forms[0].elements['txt'].value == "") { alert("You need to enter something for your message."); document.forms[0].elements['txt'].focus(); return false ; } return true; } //--> </SCRIPT> Fields marked with a <? reqStar();?> are required. <FORM ENCTYPE="multipart/form-data" ACTION="post.php" METHOD="post" onReset="return confirm('Really erase all fields and start over?')" onSubmit="return checkFields();"> <input TYPE="hidden" NAME="mode" value="preview"> <INPUT TYPE="hidden" NAME="type" value="<? echo $HTML;?>"> <INPUT TYPE="hidden" NAME="subgroup" value=<? echo $subgroup;?> > <input TYPE="hidden" NAME="MAX_FILE_SIZE" VALUE="<? echo $MAX_DOC_SIZE;?>"> <? $subj=""; if(isSet($parent)): echo "<input type=\"hidden\" name=\"parent\" value=\"$parent\">"; $q1=mysql($DBASE,"select subj from $TABLE_MSGS where id=$parent"); $subj=mysql_result($q1,0,"subj"); if (!ereg("^Re:",$subj)): $subj="Re: ".$subj; endif; endif; ?> <TABLE BORDER=0 cellpadding=5 cellspacing=0 WIDTH=<? echo $TABLE_WIDTH;?> BGCOLOR="<? echo $MSG_FRAME_COLOR;?>"> <TR VALIGN=top BGCOLOR="<? echo $MSG_FRAME_COLOR2;?>"> <TD COLSPAN=2><FONT FACE="<? echo $TFONTFACE;?>"><B>New Message</B></TD></TR> <TR VALIGN=top> <TD ALIGN=right><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Your Name:</TD> <TD><input name="name" SIZE=40 MAXLENGTH=127><? reqStar();?></TD> </TR> <TR VALIGN=top> <TD ALIGN=right><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Email Address:</TD> <TD><input name="email" SIZE=40 MAXLENGTH=127><BR></TD> </TR> <TR VALIGN=top> <TD ALIGN=right><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Title of Message:</TD> <TD><input name="subj" SIZE=40 value="<? echo $subj;?>" MAXLENGTH=127><? reqStar();?></TD> </TR> <TR VALIGN=top BGCOLOR="<? echo $MSG_FRAME_COLOR2;?>"> <TD COLSPAN=2><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Enter your message below:</TD> </TR> <TR VALIGN=top> <TD ALIGN=right><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Message:</TD> <TD><textarea rows=8 cols=40 name="txt" WRAP="virtual"></textarea><? reqStar();?></TD> </TR> <TR VALIGN=top> <TD><BR></TD> <TD ALIGN=left><FONT FACE="<? echo $TFONTFACE;?>" SIZE=-2><B>Note:</B> We reserve the right to edit or delete messages that we deem offensive or inappropriate.<BR></TD> </TR> <? if ($USE_DOC_UPLOAD):?> <TR VALIGN=top BGCOLOR="<? echo $MSG_FRAME_COLOR2;?>"> <TD COLSPAN=2><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1> If you wish to attach a document to this message, enter the filename here.</TD> </TR> <TR VALIGN=top> <TD ALIGN=right> <FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Attachment:</TD> <TD><INPUT NAME="filename" TYPE="file"></TD> </TR> <? endif;?> <TR VALIGN=top BGCOLOR="<? echo $MSG_FRAME_COLOR2;?>"> <TD ALIGN=left><INPUT TYPE="Reset" VALUE=" Clear All "></TD> <TD ALIGN=right><INPUT TYPE="submit" VALUE=" Preview » "> <? if ($USE_DOC_UPLOAD): echo "<FONT FACE=\"$FONTFACE\" SIZE=-2><BR>This may take a while if you have attached a file.\n"; endif;?> </TD> </TR> </TABLE> </form> <? commonFooter();?> Index: php-hosts-web/msgboard/preview.php +++ php-hosts-web/msgboard/preview.php <?php title ("Preview"); if($name==""): echo "<B>You need to give your name!</B><BR>\n"; echo "<FORM><input type=submit value=\" « Go Back \" onClick=\"history.go(-1);\"></FORM>\n"; if ($USE_DOC_UPLOAD && isset($fileid)): $q=@mysql($DBASE,"delete from $TABLE_DOCS where document=$fileid"); unlink($newfile); endif; exit; endif; if($txt==""): echo "<B>You need to say <I>something</I>!</B><BR>\n"; echo "<FORM><input type=submit value=\" « Go Back \" onClick=\"history.go(-1);\"></FORM>\n"; if ($USE_DOC_UPLOAD && isset($fileid)): $q=@mysql($DBASE,"delete from $TABLE_DOCS where document=$fileid"); unlink($newfile); endif; exit; endif; echo "Your message will look like this:\n"; if(!$subj): $subj="(no title)"; endif; if(!isSet($parent)): $parent=0; endif; $tempfile = tempnam( "/tmp", "phphosts_" ); if ($txt!=""): $fp=fopen($tempfile,"w"); fputs($fp,$txt); fclose($fp); endif; $date=date($DATE_FORMAT); ?> <form method=post action="post.php"> <input type=hidden name="mode" value="post"> <input type=hidden name="type" value=<? echo $type;?>> <input type=hidden name="parent" value=<? echo $parent;?>> <input type=hidden name="name" value="<? qecho($name);?>"> <input type=hidden name="email" value="<? qecho($email);?>"> <input type=hidden name="subj" value="<? qecho($subj);?>"> <input type=hidden name="tempfile" value="<? echo $tempfile;?>"> <input type=hidden name="subgroup" value=<? echo $subgroup;?>> <input type=hidden name="fileid" value=<? echo $fileid;?>> <? showMessage("preview",$subj,$subgroup,$name,$email,$date,$fileid,$parent,$txt); ?> <TR VALIGN=top BGCOLOR="<? echo $MSG_FRAME_COLOR2;?>"> <TD align=left><input type=button value=" « Go Back " onClick="history.go(-1);"></TD> <TD align=right><input type=submit value=" Post it » "></TD> </TR> </TABLE> </form> Index: php-hosts-web/msgboard/shared-msgboard.inc +++ php-hosts-web/msgboard/shared-msgboard.inc <?php require ("shared.inc"); $conn = mysql_pconnect("localhost","www"); $DBASE="phphosts"; $SYSOP="webmaster@php.net"; $BGTABLE = $COLOR["ltpurple"]; $BGCOLOR[0] = "#F0F0F0"; $BGCOLOR[1] = "#E0E0E0"; $FONTFACE="tahoma,arial,helvetica,sans-serif"; $TITLEFACE=$FONTFACE; function font($size="",$face=0) { global $FONTFACE,$TITLEFACE; echo "<FONT FACE=\""; if ($face): echo "$TITLEFACE\" "; else: echo "$FONTFACE\" "; endif; if ($size!=""): echo "SIZE=$size"; endif; echo ">"; } function title($title,$size="+2",$blank=1) { echo "<h3>" . $title . "</h3>\n"; } function reqStar() { echo "<B>*</B>"; } /* VARIABLE DEFINTIONS */ /* Setup the database: */ $TABLE_MSGS="msgboard_msgs"; /* Setup the directory and URL structures: */ $ROOT_DIR=$SERVER['DOCUMENT_ROOT'].'/msgboard'; $ROOT_URL="http://hosts.php.net/msgboard"; $HOME_URL="http://hosts.php.net"; $MSGS="$ROOT_DIR/msgs"; $GIFS="$ROOT_URL/gifs"; $STAFF_URL="http://hosts.php.net/staff"; $MOD_URL="$ROOT_URL/etc"; $MOD_DIR="$ROOT_DIR/etc"; $TOOLBAR="toolbar.php"; $MOD_TOOLBAR="$MOD_DIR/toolbar.php"; /* Obsolete variables, kept for backwards compatability */ $TXT=1; $HTML=2; /* Pick one of the following: */ /* 1. Document Upload disabled (DEFAULT): */ $USE_DOC_UPLOAD = false; /* 2. Document Upload enabled: */ /* $USE_DOC_UPLOAD = true; $TABLE_DOCS="msgboard_docs"; $DOCS="$ROOT_DIR/docs"; $MAX_DOC_SIZE=1000000; */ /* If $USE_SUBGROUP = true, you will have subgroups, or categories, defined for each message. Write your own code to convert between the subgroup number and the subgroup name! */ $USE_SUBGROUPS = true; $SUBGROUP_TITLE = "Hosting Company"; $query = "select * from $HOSTS_TABLE order by HostName"; $q1 = mysql_db_query($DBASE,$query) or die($query.": ".mysql_error()); while ($result=mysql_fetch_array($q1)) { $SUBGROUP[$result["HostID"]] = $result["HostName"]; } mysql_free_result($q1); function getSubgroupName($id) { global $SUBGROUP; return $SUBGROUP[$id]; } /* Layout variables: */ $DATE_FORMAT="d-M-Y H:i"; $MSG_FRAME_COLOR="#E0E0E0"; /* the colour behind message info */ $MSG_FRAME_COLOR2=$COLOR["ltpurple"]; /* a slightly different version of the above */ $MSG_TEXT_COLOR="#E0E0E0"; /* the colour behind message text */ $TEXT_COLOR1="#000000"; /* colour of "Subject", "Name", etc. */ $TEXT_COLOR2="#000000"; /* colour of message, name, subj */ $MOD_TXT_COLOR="#FF0000"; $TABLE_WIDTH="100%"; $TFONTFACE="TAHOMA,VERDANA,ARIAL,sans-serif"; /* Graphic variables: You can make all the graphics into text by just setting the following variables to text strings. e.g.: $TITLE_POSTNEW="<IMG SRC=\"gifs/post_title.gif\">"; */ $TITLE_MSGBOARD="<FONT SIZE=+2><B>Message Board</B></FONT>"; $TITLE_POSTNEW="<FONT SIZE=+1><B>Post New Message</B></FONT>"; $TITLE_POSTFOLLOWUP="<FONT SIZE=+1><B>Post Follow-Up Message</B></FONT>"; $TITLE_PREVIEW="<FONT SIZE=+1><B>Preview Message</B></FONT>"; $BUTTON_INDEX="<FONT SIZE=-1> " . $SUBGROUP_TITLE . " Listing </FONT>"; $BUTTON_POSTNEW="<FONT SIZE=-1> Add a Message </FONT>"; $BUTTON_POSTFOLLOW="<FONT SIZE=-1> Reply to Message </FONT>"; $BUTTON_LISTHEAD="<FONT SIZE=-1> Show All Messages </FONT>"; $LIL_DOC_IMG="<IMG SRC=\"$GIFS/lil-doc.gif\" ALT=\"Attachment\" WIDTH=16 HEIGHT=16 BORDER=0>"; $BIG_DOC_IMG="<IMG SRC=\"$GIFS/big-doc.gif\" ALT=\"Attachment\" WIDTH=32 HEIGHT=32 BORDER=0>"; $IMG_SHOW = "<b>Show</b>"; $IMG_ADD = "<b>Add</b>"; /* FUNCTION DEFINITIONS */ function introText () { /* * Intro blurb on the intro page */ ?> <P> This Message Board has been developed so that users can comment on the hosting companies listed on this site. Try and keep your comments on-topic, and free of inappropriate language. </P> <? }; function getDocInfo ($fileid) { /* * Returns information on an attached document */ global $DBASE, $TABLE_DOCS; UnSet($return); $q1=mysql($DBASE,"select * from $TABLE_DOCS where document=$fileid"); if (mysql_numrows($q1)==0): $return[0]=-1; else: $return[0]=mysql_result($q1,0,"filename"); $return[1]=mysql_result($q1,0,"filesize"); $return[2]=mysql_result($q1,0,"filetype"); endif; return($return); }; function makeIndent($x) { $return="<IMG SRC=\"/gifs/spacer.gif\" ALT=\" \" WIDTH=8 HEIGHT=18 BORDER=0 ALIGN=top>"; $i=1; while ($i<strlen($x)): $c=substr($x,$i,1); switch ($c) { case "-": $return.="<IMG SRC=\"/gifs/spacer.gif\" ALT=\" \" WIDTH=16 HEIGHT=18 BORDER=0 ALIGN=top>"; break; case "L": $return.="<IMG SRC=\"/gifs/arrow0.gif\" ALT=\" +-\" WIDTH=16 HEIGHT=18 BORDER=0 ALIGN=top>"; break; case "T": $return.="<IMG SRC=\"/gifs/arrow1.gif\" ALT=\" |-\" WIDTH=16 HEIGHT=18 BORDER=0 ALIGN=top>"; break; case "I": $return.="<IMG SRC=\"/gifs/arrow2.gif\" ALT=\" | \" WIDTH=16 HEIGHT=18 BORDER=0 ALIGN=top>"; break; } $i++; endwhile; return($return); }; function getHeaders ($parent,$subgroup,$indent,$mode=0) { /* * Threads the message headers * if $mode=1, it's the moderator function */ global $DBASE, $TABLE_MSGS, $ROOT_DIR, $MSGS, $ROOT_URL, $MOD_URL, $LIL_DOC_IMG; global $BGCOLOR, $DATE_FORMAT,$jjj; $query="select * from $TABLE_MSGS where parent=$parent and subgroup=$subgroup order by date desc"; $q1=mysql_db_query($DBASE, $query); $num=mysql_numrows($q1); if ($num>0): $i=0; while ($i<$num): $id=mysql_result($q1,$i,"id"); $date=mysql_result($q1,$i,"date"); $subj=mysql_result($q1,$i,"subj"); $document=mysql_result($q1,$i,"document"); echo "<TR VALIGN=middle BGCOLOR=\"".$BGCOLOR[$jjj%2]."\">\n"; $jjj++; echo "<TD ALIGN=left WIDTH=80% NOWRAP>"; font("-1"); if ($i+1==$num): echo makeIndent($indent."L"); else: echo makeIndent($indent."T"); endif; echo "<A HREF=\"message.php?id=$id\">$subj</A>"; if ($document!=0): echo " $LIL_DOC_IMG"; endif; echo "<BR></TD>\n"; if ($mode>=0): echo "<TD ALIGN=center WIDTH=10% NOWRAP>"; font("-2"); echo date($DATE_FORMAT,$date); echo "</TD>\n"; endif; if ($mode==1): echo "<TD>"; font("-2"); echo " <INPUT TYPE=\"checkbox\" NAME=\"delete[$id]\">"; echo "DEL <BR></TD>\n"; echo "<TD>"; font("-2"); echo " <A HREF=\"etc/edit.php?id=$id\">"; echo "EDIT</A> <BR></TD>\n"; endif; echo "</TR>\n"; if ($i+1==$num): getHeaders($id,$subgroup,$indent."-",$mode); else: getHeaders($id,$subgroup,$indent."I",$mode); endif; $i++; endwhile; endif; }; function showMessage ($mode, $subj, $subgroup, $name, $email, $date, $document, $parent, $post) { /* * Displays a message (!) */ global $FONTFACE, $LIL_DOC_IMG, $MSGS, $DBASE, $USE_DOC_UPLOAD; global $TABLE_WIDTH, $TABLE_MSGS, $MSG_FRAME_COLOR, $MSG_FRAME_COLOR2, $MSG_TEXT_COLOR; global $TEXT_COLOR1, $TEXT_COLOR2; $FT1="<FONT FACE=\"$FONTFACE\" COLOR=\"$TEXT_COLOR1\" SIZE=-1>"; $FT2="<FONT FACE=\"$FONTFACE\" COLOR=\"$TEXT_COLOR2\" SIZE=-1>"; echo "<TABLE BORDER=0 cellpadding=3 cellspacing=0 width=$TABLE_WIDTH BGCOLOR=\"$MSG_FRAME_COLOR2\">\n"; echo "<TR VALIGN=top><TD align=right WIDTH=20%>$FT1 Title:<BR></TD><TD align=left>$FT2<B>$subj</B><BR></TD></TR>\n"; if ($USE_SUBGROUPS): echo "<TR VALIGN=top><TD align=right>$FT1 Play:</TD><TD align=left>$FT2<B>".getSubgroupName($subgroup)."</B></TD></TR>\n"; endif; echo "<TR VALIGN=top><TD align=right>$FT1 Posted by:</TD><TD align=left>$FT2<B>$name</B>"; if ($email!=""): echo " <<a href=\"mailto:$email\">$email</a>>"; endif; echo "</TD></TR>\n"; echo "<TR VALIGN=top><TD align=right>$FT1 Date:</TD><TD align=left>$FT2<B>$date</B></TD></TR>\n"; if ($USE_DOC_UPLOAD && $document!=0): $docinfo=getDocInfo($document); echo "<TR VALIGN=top><TD align=right>$FT1 Attachment:</TD>"; if ($mode=="preview"): echo "<TD align=left>$FT2<B>$docinfo[0]</B> $LIL_DOC_IMG</TD></TR>\n"; else: echo "<TD align=left>$FT2<A HREF=\"getdoc.php?document=$document\"><B>$docinfo[0]</B>$LIL_DOC_IMG</A></TD></TR>\n"; endif; endif; if($parent>0): echo "<TR VALIGN=top><TD align=right>$FT1 Follow-Up To:</TD><TD align=left>$FT2"; $q3=mysql($DBASE, "select subj from $TABLE_MSGS where id=$parent"); $psubj=mysql_result($q3,0,"subj"); if ($mode=="preview"): echo "<B>$psubj</B></TD></TR>\n"; else: echo "<a href=\"message.php?id=$parent\"><B>$psubj</B></a></TD></TR>\n"; endif; elseif($parent<0): echo "<TR VALIGN=top><TD colspan=2>$FT1<I>Direct Parent Deleted Or Expired</I></TD></TR>\n"; endif; echo "<TR VALIGN=top BGCOLOR=\"$MSG_TEXT_COLOR\"><TD colspan=2>$FT2\n"; if ($mode=="preview"): $show=ereg_replace(10,"<BR>",$post); echo "$show\n"; else: $show=file("$MSGS/$post"); $i=0; while($i<count($show)): echo "$show[$i]<BR>\n"; $i++; endwhile; endif; echo "</TD></TR>\n"; }; function showDisclaimer () { /* * Displays the download disclaimer message - a good idea ...! */ echo "<B>You are about to download a document.</B> We do not claim any responsibility for the content of the following file, nor does we guarantee that the file will not harm your system.<P>\n"; echo "If you have any problems with the file, please send your comments to the person who posted the file.<P>\n"; echo "If you are unable to view or open the file on your machine (because you don't have the appropriate application, for example), please ask the person who posted the file to convert it to another format.\n"; }; function deleteMsg ($id) { /* * Deletes a posted message, and any attachments */ global $MSGS, $DOCS, $DBASE, $TABLE_MSGS, $TABLE_DOCS, $USE_DOC_UPLOAD; $q1=@mysql_db_query($DBASE, "select * from $TABLE_MSGS where id=$id"); if(mysql_numrows($q1)!=1 || $q1==-1): echo "<FONT COLOR=\"#800000\">Error: ".mysql_error()."<BR>Message $id not deleted.</FONT><BR>\n"; return(-1); else: $subj=mysql_result($q1,0,"subj"); $parent=mysql_result($q1,0,"parent"); $document=mysql_result($q1,0,"document"); mysql_db_query($DBASE, "delete from $TABLE_MSGS where id=$id"); mysql_db_query($DBASE, "update $TABLE_MSGS set parent=$parent where parent=$id"); if ($USE_DOC_UPLOAD && $document!=0): $q=mysql_db_query($DBASE,"delete from $TABLE_DOCS where document=$document"); $file=sprintf("%-07.7d",$document); $file="$DOCS/d"+$file; unlink($file); $subj="$subj (plus attachment)"; endif; return($subj); endif; }; function commonModHeader ($x) { commonHeader($x); }; function commonModFooter () { commonFooter(); }; ?> Index: php-hosts-web/msgboard/toolbar.php +++ php-hosts-web/msgboard/toolbar.php <?php if (!$USE_SUBGROUPS): $subgroup=0; endif; echo "<a href=\"post.php?subgroup=$subgroup\">$BUTTON_POSTNEW</a> | \n"; echo "<a href=\"list.php?subgroup=$subgroup\">$BUTTON_LISTHEAD</a> | \n"; echo "<a href=\"index.php\">$BUTTON_INDEX</a>\n"; ?> Index: php-hosts-web/msgboard/etc/delete.php +++ php-hosts-web/msgboard/etc/delete.php <?php include("../shared-msgboard.inc"); require 'login.inc'; commonHeader("Moderate Message Board"); title("Moderate Message Board"); if ($mode=="DELETE"): reset($delete); $i=0; $num=0; echo "<UL>\n"; while ($i<count($delete)): $id=key($delete); if ($delete[$id]=="on"): $name=deleteMsg($id); if ($name!=-1): echo "<LI>$id ($name) <B>deleted</B>\n"; $num++; endif; endif; next($delete); $i++; endwhile; echo "</UL>"; echo "Done: <B>$num</B> messages deleted.<P>"; staffToolbar(); commonFooter(); exit; endif; if ($USE_SUBGROUPS): $groupname=getSubgroupName($subgroup); else: $groupname="Message Board"; $subgroup=0; endif; ?> <FORM METHOD="POST" ACTION="delete.php"> <TABLE BORDER=0 CELLPADDING=5 CELLSPACING=0 BGCOLOR="<? echo $MSG_FRAME_COLOR2;?>" WIDTH=100%> <TR VALIGN=bottom> <TD ALIGN=left><? font("-1");?> Messages for<BR></FONT> <? font();?><B><? echo $groupname;?></B><BR></FONT> </TD> </TR> <TR VALIGN=top> <TD> <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%> <? getHeaders(0,$subgroup,"",1);?> </TABLE> </TD></TR> </TABLE><P> <INPUT TYPE="hidden" VALUE="DELETE" NAME="mode"> <INPUT TYPE="submit" VALUE=" Delete "> </FONT></FORM> <? commonFooter();?> Index: php-hosts-web/msgboard/etc/edit.php +++ php-hosts-web/msgboard/etc/edit.php <?php include("../shared-msgboard.inc"); require 'login.inc'; if($mode=="edit"): commonHeader("Edit Message"); title("Edit Message"); $time=time(); $subj=addslashes($subj); $email=addslashes($email); $name=addslashes($name); $query="update $TABLE_MSGS set subj='$subj',email='$email',name='$name' where id=$id"; echo "<!-- $query -->\n"; mysql_db_query($DBASE,$query); $newfile="$MSGS/$id"; $fp=fopen($newfile,"w"); fputs($fp,$txt); fclose($fp); echo "<FONT SIZE=+1><b>Message edited.</b></FONT><P>\n"; echo "<CENTER>\n"; staffToolbar(); echo "</CENTER>\n"; commonFooter(); exit; endif; $query="select * from msgboard_msgs where id=$id"; $q1=mysql_db_query($DBASE,$query); $result=mysql_fetch_array($q1); $groupname=getSubgroupName($result["subgroup"]); commonHeader("Edit Message: $groupname"); title("Edit Message: ".$groupname); ?> <SCRIPT LANGUAGE="Javascript"> <!-- function checkFields() { if (document.forms[0].elements['name'].value == "") { alert("Please enter your name."); document.forms[0].elements['name'].focus(); return false ; } if (document.forms[0].elements['subj'].value == "") { alert("Please enter a title for this posting."); document.forms[0].elements['subj'].focus(); return false ; } if (document.forms[0].elements['txt'].value == "") { alert("You need to enter something for your message."); document.forms[0].elements['txt'].focus(); return false ; } return true; } //--> </SCRIPT> Fields marked with a <? reqStar();?> are required. <FORM ENCTYPE="multipart/form-data" ACTION="edit.php" METHOD="post" onReset="return confirm('Really erase all fields and start over?')" onSubmit="return checkFields();"> <input TYPE="hidden" NAME="mode" value="edit"> <INPUT TYPE="hidden" NAME="id" value=<? echo $result["id"];?> > <TABLE BORDER=0 cellpadding=5 cellspacing=0 WIDTH=<? echo $TABLE_WIDTH;?> BGCOLOR="<? echo $MSG_FRAME_COLOR;?>"> <TR VALIGN=top BGCOLOR="<? echo $MSG_FRAME_COLOR2;?>"> <TD COLSPAN=2><FONT FACE="<? echo $TFONTFACE;?>"><B>Edit Message</B></TD></TR> <TR VALIGN=top> <TD ALIGN=right><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Your Name:</TD> <TD><input name="name" SIZE=40 MAXLENGTH=127 VALUE="<? qecho($result["name"]);?>" ><? reqStar();?></TD> </TR> <TR VALIGN=top> <TD ALIGN=right><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Email Address:</TD> <TD><input name="email" SIZE=40 MAXLENGTH=127 VALUE="<? qecho($result["email"]);?>" ><BR></TD> </TR> <TR VALIGN=top> <TD ALIGN=right><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Title of Message:</TD> <TD><input name="subj" SIZE=40 MAXLENGTH=127 VALUE="<? qecho($result["subj"]);?>" ><? reqStar();?></TD> </TR> <TR VALIGN=top BGCOLOR="<? echo $MSG_FRAME_COLOR2;?>"> <TD COLSPAN=2><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Enter your message below:</TD> </TR> <TR VALIGN=top> <TD ALIGN=right><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Message:</TD> <TD><textarea rows=8 cols=40 name="txt" WRAP="virtual"><? $show=file("$MSGS/".$result["id"]); $i=0; while($i<count($show)): qecho($show[$i]); $i++; endwhile; ?></textarea><? reqStar();?></TD> </TR> <TR VALIGN=top> <TD><BR></TD> <TD ALIGN=left><FONT FACE="<? echo $TFONTFACE;?>" SIZE=-2><B>Note:</B> We reserve the right to edit or delete messages that we deem offensive or inappropriate.<BR></TD> </TR> <? if ($USE_DOC_UPLOAD):?> <TR VALIGN=top BGCOLOR="<? echo $MSG_FRAME_COLOR2;?>"> <TD COLSPAN=2><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1> If you wish to attach a document to this message, enter the filename here.</TD> </TR> <TR VALIGN=top> <TD ALIGN=right> <FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Attachment:</TD> <TD><INPUT NAME="filename" TYPE="file"></TD> </TR> <? endif;?> <TR VALIGN=top BGCOLOR="<? echo $MSG_FRAME_COLOR2;?>"> <TD ALIGN=left><INPUT TYPE="Reset" VALUE=" Clear All "></TD> <TD ALIGN=right><INPUT TYPE="submit" VALUE=" Edit » "> <? if ($USE_DOC_UPLOAD): echo "<FONT FACE=\"$FONTFACE\" SIZE=-2><BR>This may take a while if you have attached a file.\n"; endif;?> </TD> </TR> </TABLE> </form> <? commonFooter();?> Index: php-hosts-web/msgboard/etc/index.php +++ php-hosts-web/msgboard/etc/index.php <?php require("../shared-msgboard.inc"); require 'login.inc'; commonHeader("Moderate Message Board"); title("Moderate Message Board"); introText(); ?> Click on the <? echo $IMG_SHOW; ?> button for a listing of all the comments for a particular section. <P> <? echo "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=5 WIDTH=100%>\n"; echo "<TR BGCOLOR=\"$MSG_FRAME_COLOR2\" VALIGN=bottom>\n"; echo "<TD ALIGN=left>"; font("-1"); echo "Section</TD>\n"; echo "<TD ALIGN=center>"; font("-1"); echo "Number of<BR>Messages</TD>\n"; echo "<TD ALIGN=center>"; font("-1"); echo "Latest<BR>Message</TD>\n"; echo "<TD><BR></TD>\n"; echo "</TR>\n"; $i=0; while (list($id,$section)=each($SUBGROUP)): $bg=$BGCOLOR[$i%2]; echo "<TR BGCOLOR='$bg' VALIGN=middle>\n"; echo "<TD>"; font("-1"); echo $section."<BR></TD>\n"; $query="select count(id) as count, max(date) as last"; $query.=" from msgboard_msgs"; $query.=" where subgroup=".$id; echo "<!-- $query -->\n"; $q2=mysql_db_query($DBASE,$query); $count=mysql_result($q2,0,"count"); $last=date("d-M-Y",mysql_result($q2,0,"last")); if ($count==0): $last="-"; else: endif; mysql_free_result($q2); echo "<TD ALIGN=right>"; font("-1"); echo "$count<BR></TD>\n"; echo "<TD ALIGN=center>"; font("-1"); echo "$last<BR></TD>\n"; echo "<TD>"; font("-1"); if ($count!=0): echo "<A HREF=\"delete.php?subgroup=".$id."\">" . $IMG_SHOW . "</A>"; endif; echo "<BR></TD>"; echo "</TR>\n"; $i++; endwhile; echo "</TABLE>\n"; staffToolbar(); commonFooter(); ?> Index: php-hosts-web/msgboard/etc/toolbar.php +++ php-hosts-web/msgboard/etc/toolbar.php <?php echo "<a href=\"$ROOT_URL\">[ Public Site ]</a>\n"; ?>
Index: php-hosts-web/msgboard/getdoc.php +++ php-hosts-web/msgboard/getdoc.php <?php include("shared-msgboard.inc"); commonHeader(); $FT="<FONT FACE=\"$FONTFACE\">"; $q1=mysql($DBASE,"select * from $TABLE_DOCS where document=$document"); $docinfo=getDocInfo($document); echo "<TABLE BORDER=0 cellpadding=5 cellspacing=0 width=$TABLE_WIDTH BGCOLOR=\"$MSG_FRAME_COLOR2\">\n"; echo "<TR VALIGN=top><TD align=left>$FT<FONT SIZE=-1>\n"; echo "<FONT SIZE=+1><B>Document Download</B></FONT><P>\n"; showDisclaimer(); echo "<P></TD></TR>\n"; echo "<TR VALIGN=top><TD align=left>$FT<FONT SIZE=-1>\n"; echo "<TABLE BORDER=0 WIDTH=100% BGCOLOR=\"$MSG_FRAME_COLOR\" cellpadding=10 cellspacing=0><TR valign=top>\n"; echo "<TD><A HREF=\"getdoc2.php/$document/$docinfo[0]\">$BIG_DOC_IMG</A></TD>\n"; echo "<TD align=left>$FT\n"; echo "Filename: <A HREF=\"getdoc2.php/$document/$docinfo[0]\"><B>$docinfo[0]</B></A><BR>\n"; echo "Size: <B>$docinfo[1] bytes</B><BR>\n"; if ($docinfo[2]!=""): echo "Type: ".$docinfo[2]."<BR>\n"; endif; echo "</TD></TR></TABLE>\n"; echo "<CENTER>Click on the icon or the filename to download.</CENTER>\n"; echo "</TD></TR></TABLE>\n"; commonFooter(); ?> Index: php-hosts-web/msgboard/getdoc2.php +++ php-hosts-web/msgboard/getdoc2.php <?php include("shared-msgboard.inc"); $file=strtok($PATH_INFO,"/"); $file=strtok("/"); $newfile=sprintf("%-07.7d",$file); $newfile="$DOCS/d"+$newfile; $docinfo=getDocInfo($file); $filesize=$docinfo[1]; if ($docinfo[2]==""): $filetype="binary/x-cbmbin"; else: $filetype=$docinfo[2]; endif; Header("Content-type: $filetype"); Header("Content-Length: $filesize"); ReadFile($newfile);?> Index: php-hosts-web/msgboard/index.php +++ php-hosts-web/msgboard/index.php <?php require 'shared-msgboard.inc'; commonHeader("Message Board"); ?> <h3>Message Board</h3> <? introText(); ?> <P> Click on <? echo $IMG_SHOW; ?> for a listing of all the comments for a particular <? echo $SUBGROUP_TITLE; ?>. To add your own comments, click on <? echo $IMG_ADD; ?>. </P> <? echo "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=5 WIDTH=100%>\n"; echo "<TR BGCOLOR=\"$MSG_FRAME_COLOR2\" VALIGN=bottom>\n"; echo "<TD ALIGN=left>"; font("-1"); echo $SUBGROUP_TITLE."</TD>\n"; echo "<TD ALIGN=center>"; font("-1"); echo "Number of<BR>Messages</TD>\n"; echo "<TD ALIGN=center>"; font("-1"); echo "Latest<BR>Message</TD>\n"; echo "<TD><BR></TD>\n"; echo "<TD><BR></TD>\n"; echo "</TR>\n"; $i=0; while (list($id,$section)=each($SUBGROUP)): $bg=$BGCOLOR[$i%2]; echo "<TR BGCOLOR='$bg' VALIGN=middle>\n"; echo "<TD>"; font(""); echo $section."<BR></TD>\n"; $query="select count(id) as count, max(date) as last"; $query.=" from msgboard_msgs"; $query.=" where subgroup=".$id; echo "<!-- $query -->\n"; $q2=mysql_db_query($DBASE,$query); $count=mysql_result($q2,0,"count"); $last=date("d-M-Y",mysql_result($q2,0,"last")); if ($count==0): $last="-"; else: endif; mysql_free_result($q2); echo "<TD ALIGN=right>"; font("-1"); echo "$count<BR></TD>\n"; echo "<TD ALIGN=center>"; font("-1"); echo "$last<BR></TD>\n"; echo "<TD>"; font("-1"); if ($count!=0): echo "<A HREF=\"list.php?subgroup=" .$id . "\">" . $IMG_SHOW . "</A>"; endif; echo "<BR></TD>"; echo "<TD>"; font("-1"); echo "<A HREF=\"post.php?subgroup=" . $id . "\">" . $IMG_ADD . "</A>"; echo "<BR></TD>"; echo "</TR>\n"; $i++; endwhile; echo "</TABLE>\n"; commonFooter(); ?> Index: php-hosts-web/msgboard/list.php +++ php-hosts-web/msgboard/list.php <?php include("shared-msgboard.inc"); if ($USE_SUBGROUPS): if (isSet($subgroup)): $groupname=getSubgroupName($subgroup); commonHeader("List Messages: $groupname"); title("List Messages"); else: Header("Location: $ROOT_URL"); exit; endif; else: $subgroup=0; endif; ?> Click on the message title to read that message, or <A HREF="post.php?subgroup=<? echo $subgroup;?>">click here</A> to post a new message. <P> <TABLE BORDER=0 CELLPADDING=5 CELLSPACING=0 BGCOLOR="<? echo $MSG_FRAME_COLOR2;?>" WIDTH=100%> <TR VALIGN=bottom> <TD ALIGN=left><? font("-1");?> Messages for<BR></FONT> <? font();?><B><? echo $groupname;?></B><BR></FONT> </TD> </TR> <TR VALIGN=top> <TD> <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%> <? getHeaders(0,$subgroup,"",0); ?> </TABLE> </TD></TR> </TABLE><P> <CENTER> <? include($TOOLBAR); echo "</CENTER>\n"; commonFooter(); ?> Index: php-hosts-web/msgboard/message.php +++ php-hosts-web/msgboard/message.php <?php include("shared-msgboard.inc"); $q1=mysql($DBASE,"select * from $TABLE_MSGS where id=$id"); $parent=intval(mysql_result($q1,0,"parent")); $subj=mysql_result($q1,0,"subj"); $email=mysql_result($q1,0,"email"); $name=mysql_result($q1,0,"name"); $date=mysql_result($q1,0,"date"); $date=date($DATE_FORMAT,$date); $document=mysql_result($q1,0,"document"); $subgroup=mysql_result($q1,0,"subgroup"); $section=getSubgroupName($subgroup); commonHeader("Message: $section"); title("Message: $section"); showMessage("show",$subj,$subgroup,$name,$email,$date,$document,$parent,$id); $q2=mysql($DBASE, "select id from $TABLE_MSGS where parent=$id and subgroup=$subgroup"); if (mysql_numrows($q2)!=0): echo "<TR VALIGN=top><TD align=left colspan=2><FONT FACE=\"$FONTFACE\" SIZE=-1>Follow-ups:<p>\n"; echo "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>\n"; getHeaders($id,$subgroup,"",-1); echo "</TABLE>\n"; echo "</TD></TR>\n"; endif; echo "</TABLE><BR>\n"; echo "<CENTER>\n"; echo "<a href=\"post.php?subgroup=$subgroup&parent=$id\">$BUTTON_POSTFOLLOW</a> | \n"; include($TOOLBAR); echo "</CENTER>\n"; commonFooter(); ?> Index: php-hosts-web/msgboard/post.php +++ php-hosts-web/msgboard/post.php <?php include("shared-msgboard.inc"); $groupname=getSubgroupName($subgroup); commonHeader("Post a New Message: $groupname"); if($mode=="preview"): if ($USE_DOC_UPLOAD && $filename!="none"): $q=mysql($DBASE,"insert into $TABLE_DOCS values (0,'$filename_name',$filename_size,'$filename_type')"); $fileid=mysql_insert_id(); $newfile=sprintf("%-07.7d",$fileid); $newfile="$DOCS/d"+$newfile; $command=QuoteMeta("cp $filename $newfile"); exec($command); chmod($newfile,"0664"); unlink($filename); else: $fileid=0; endif; include("preview.php"); commonFooter(); exit; elseif($mode=="post"): if($parent!=0): title("Post a Follow-Up Message: ".$groupname); else: title("Post a New Message: ".$groupname); endif; $time=time(); $subj=addslashes($subj); $email=addslashes($email); $name=addslashes($name); $query="insert into $TABLE_MSGS values (0,$time,$subgroup,$parent,$type,'$subj','$email','$name',$fileid)"; echo "<!-- $query -->\n"; mysql_db_query($DBASE,$query); $id=mysql_insert_id(); $newfile="$MSGS/$id"; if (file_exists($tempfile)): $command=QuoteMeta("mv $tempfile $newfile"); exec($command); endif; echo "<FONT SIZE=+1><b>Message posted.</b></FONT><P>\n"; echo "<CENTER>\n"; include("toolbar.php"); echo "</CENTER>\n"; commonFooter(); exit; endif; if(isSet($parent)): title("Post a Follow-Up Message: ".$groupname); else: title("Post a New Message: ".$groupname); endif; ?> <SCRIPT LANGUAGE="Javascript"> <!-- function checkFields() { if (document.forms[0].elements['name'].value == "") { alert("Please enter your name."); document.forms[0].elements['name'].focus(); return false ; } if (document.forms[0].elements['subj'].value == "") { alert("Please enter a title for this posting."); document.forms[0].elements['subj'].focus(); return false ; } if (document.forms[0].elements['txt'].value == "") { alert("You need to enter something for your message."); document.forms[0].elements['txt'].focus(); return false ; } return true; } //--> </SCRIPT> Fields marked with a <? reqStar();?> are required. <FORM ENCTYPE="multipart/form-data" ACTION="post.php" METHOD="post" onReset="return confirm('Really erase all fields and start over?')" onSubmit="return checkFields();"> <input TYPE="hidden" NAME="mode" value="preview"> <INPUT TYPE="hidden" NAME="type" value="<? echo $HTML;?>"> <INPUT TYPE="hidden" NAME="subgroup" value=<? echo $subgroup;?> > <input TYPE="hidden" NAME="MAX_FILE_SIZE" VALUE="<? echo $MAX_DOC_SIZE;?>"> <? $subj=""; if(isSet($parent)): echo "<input type=\"hidden\" name=\"parent\" value=\"$parent\">"; $q1=mysql($DBASE,"select subj from $TABLE_MSGS where id=$parent"); $subj=mysql_result($q1,0,"subj"); if (!ereg("^Re:",$subj)): $subj="Re: ".$subj; endif; endif; ?> <TABLE BORDER=0 cellpadding=5 cellspacing=0 WIDTH=<? echo $TABLE_WIDTH;?> BGCOLOR="<? echo $MSG_FRAME_COLOR;?>"> <TR VALIGN=top BGCOLOR="<? echo $MSG_FRAME_COLOR2;?>"> <TD COLSPAN=2><FONT FACE="<? echo $TFONTFACE;?>"><B>New Message</B></TD></TR> <TR VALIGN=top> <TD ALIGN=right><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Your Name:</TD> <TD><input name="name" SIZE=40 MAXLENGTH=127><? reqStar();?></TD> </TR> <TR VALIGN=top> <TD ALIGN=right><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Email Address:</TD> <TD><input name="email" SIZE=40 MAXLENGTH=127><BR></TD> </TR> <TR VALIGN=top> <TD ALIGN=right><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Title of Message:</TD> <TD><input name="subj" SIZE=40 value="<? echo $subj;?>" MAXLENGTH=127><? reqStar();?></TD> </TR> <TR VALIGN=top BGCOLOR="<? echo $MSG_FRAME_COLOR2;?>"> <TD COLSPAN=2><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Enter your message below:</TD> </TR> <TR VALIGN=top> <TD ALIGN=right><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Message:</TD> <TD><textarea rows=8 cols=40 name="txt" WRAP="virtual"></textarea><? reqStar();?></TD> </TR> <TR VALIGN=top> <TD><BR></TD> <TD ALIGN=left><FONT FACE="<? echo $TFONTFACE;?>" SIZE=-2><B>Note:</B> We reserve the right to edit or delete messages that we deem offensive or inappropriate.<BR></TD> </TR> <? if ($USE_DOC_UPLOAD):?> <TR VALIGN=top BGCOLOR="<? echo $MSG_FRAME_COLOR2;?>"> <TD COLSPAN=2><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1> If you wish to attach a document to this message, enter the filename here.</TD> </TR> <TR VALIGN=top> <TD ALIGN=right> <FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Attachment:</TD> <TD><INPUT NAME="filename" TYPE="file"></TD> </TR> <? endif;?> <TR VALIGN=top BGCOLOR="<? echo $MSG_FRAME_COLOR2;?>"> <TD ALIGN=left><INPUT TYPE="Reset" VALUE=" Clear All "></TD> <TD ALIGN=right><INPUT TYPE="submit" VALUE=" Preview » "> <? if ($USE_DOC_UPLOAD): echo "<FONT FACE=\"$FONTFACE\" SIZE=-2><BR>This may take a while if you have attached a file.\n"; endif;?> </TD> </TR> </TABLE> </form> <? commonFooter();?> Index: php-hosts-web/msgboard/preview.php +++ php-hosts-web/msgboard/preview.php <?php title ("Preview"); if($name==""): echo "<B>You need to give your name!</B><BR>\n"; echo "<FORM><input type=submit value=\" « Go Back \" onClick=\"history.go(-1);\"></FORM>\n"; if ($USE_DOC_UPLOAD && isset($fileid)): $q=@mysql($DBASE,"delete from $TABLE_DOCS where document=$fileid"); unlink($newfile); endif; exit; endif; if($txt==""): echo "<B>You need to say <I>something</I>!</B><BR>\n"; echo "<FORM><input type=submit value=\" « Go Back \" onClick=\"history.go(-1);\"></FORM>\n"; if ($USE_DOC_UPLOAD && isset($fileid)): $q=@mysql($DBASE,"delete from $TABLE_DOCS where document=$fileid"); unlink($newfile); endif; exit; endif; echo "Your message will look like this:\n"; if(!$subj): $subj="(no title)"; endif; if(!isSet($parent)): $parent=0; endif; $tempfile = tempnam( "/tmp", "phphosts_" ); if ($txt!=""): $fp=fopen($tempfile,"w"); fputs($fp,$txt); fclose($fp); endif; $date=date($DATE_FORMAT); ?> <form method=post action="post.php"> <input type=hidden name="mode" value="post"> <input type=hidden name="type" value=<? echo $type;?>> <input type=hidden name="parent" value=<? echo $parent;?>> <input type=hidden name="name" value="<? qecho($name);?>"> <input type=hidden name="email" value="<? qecho($email);?>"> <input type=hidden name="subj" value="<? qecho($subj);?>"> <input type=hidden name="tempfile" value="<? echo $tempfile;?>"> <input type=hidden name="subgroup" value=<? echo $subgroup;?>> <input type=hidden name="fileid" value=<? echo $fileid;?>> <? showMessage("preview",$subj,$subgroup,$name,$email,$date,$fileid,$parent,$txt); ?> <TR VALIGN=top BGCOLOR="<? echo $MSG_FRAME_COLOR2;?>"> <TD align=left><input type=button value=" « Go Back " onClick="history.go(-1);"></TD> <TD align=right><input type=submit value=" Post it » "></TD> </TR> </TABLE> </form> Index: php-hosts-web/msgboard/shared-msgboard.inc +++ php-hosts-web/msgboard/shared-msgboard.inc <?php require ("shared.inc"); $conn = mysql_pconnect("localhost","www"); $DBASE="phphosts"; $SYSOP="webmaster@php.net"; $BGTABLE = $COLOR["ltpurple"]; $BGCOLOR[0] = "#F0F0F0"; $BGCOLOR[1] = "#E0E0E0"; $FONTFACE="tahoma,arial,helvetica,sans-serif"; $TITLEFACE=$FONTFACE; function font($size="",$face=0) { global $FONTFACE,$TITLEFACE; echo "<FONT FACE=\""; if ($face): echo "$TITLEFACE\" "; else: echo "$FONTFACE\" "; endif; if ($size!=""): echo "SIZE=$size"; endif; echo ">"; } function title($title,$size="+2",$blank=1) { echo "<h3>" . $title . "</h3>\n"; } function reqStar() { echo "<B>*</B>"; } /* VARIABLE DEFINTIONS */ /* Setup the database: */ $TABLE_MSGS="msgboard_msgs"; /* Setup the directory and URL structures: */ $ROOT_DIR=$SERVER['DOCUMENT_ROOT'].'/msgboard'; $ROOT_URL="http://hosts.php.net/msgboard"; $HOME_URL="http://hosts.php.net"; $MSGS="$ROOT_DIR/msgs"; $GIFS="$ROOT_URL/gifs"; $STAFF_URL="http://hosts.php.net/staff"; $MOD_URL="$ROOT_URL/etc"; $MOD_DIR="$ROOT_DIR/etc"; $TOOLBAR="toolbar.php"; $MOD_TOOLBAR="$MOD_DIR/toolbar.php"; /* Obsolete variables, kept for backwards compatability */ $TXT=1; $HTML=2; /* Pick one of the following: */ /* 1. Document Upload disabled (DEFAULT): */ $USE_DOC_UPLOAD = false; /* 2. Document Upload enabled: */ /* $USE_DOC_UPLOAD = true; $TABLE_DOCS="msgboard_docs"; $DOCS="$ROOT_DIR/docs"; $MAX_DOC_SIZE=1000000; */ /* If $USE_SUBGROUP = true, you will have subgroups, or categories, defined for each message. Write your own code to convert between the subgroup number and the subgroup name! */ $USE_SUBGROUPS = true; $SUBGROUP_TITLE = "Hosting Company"; $query = "select * from $HOSTS_TABLE order by HostName"; $q1 = mysql_db_query($DBASE,$query) or die($query.": ".mysql_error()); while ($result=mysql_fetch_array($q1)) { $SUBGROUP[$result["HostID"]] = $result["HostName"]; } mysql_free_result($q1); function getSubgroupName($id) { global $SUBGROUP; return $SUBGROUP[$id]; } /* Layout variables: */ $DATE_FORMAT="d-M-Y H:i"; $MSG_FRAME_COLOR="#E0E0E0"; /* the colour behind message info */ $MSG_FRAME_COLOR2=$COLOR["ltpurple"]; /* a slightly different version of the above */ $MSG_TEXT_COLOR="#E0E0E0"; /* the colour behind message text */ $TEXT_COLOR1="#000000"; /* colour of "Subject", "Name", etc. */ $TEXT_COLOR2="#000000"; /* colour of message, name, subj */ $MOD_TXT_COLOR="#FF0000"; $TABLE_WIDTH="100%"; $TFONTFACE="TAHOMA,VERDANA,ARIAL,sans-serif"; /* Graphic variables: You can make all the graphics into text by just setting the following variables to text strings. e.g.: $TITLE_POSTNEW="<IMG SRC=\"gifs/post_title.gif\">"; */ $TITLE_MSGBOARD="<FONT SIZE=+2><B>Message Board</B></FONT>"; $TITLE_POSTNEW="<FONT SIZE=+1><B>Post New Message</B></FONT>"; $TITLE_POSTFOLLOWUP="<FONT SIZE=+1><B>Post Follow-Up Message</B></FONT>"; $TITLE_PREVIEW="<FONT SIZE=+1><B>Preview Message</B></FONT>"; $BUTTON_INDEX="<FONT SIZE=-1> " . $SUBGROUP_TITLE . " Listing </FONT>"; $BUTTON_POSTNEW="<FONT SIZE=-1> Add a Message </FONT>"; $BUTTON_POSTFOLLOW="<FONT SIZE=-1> Reply to Message </FONT>"; $BUTTON_LISTHEAD="<FONT SIZE=-1> Show All Messages </FONT>"; $LIL_DOC_IMG="<IMG SRC=\"$GIFS/lil-doc.gif\" ALT=\"Attachment\" WIDTH=16 HEIGHT=16 BORDER=0>"; $BIG_DOC_IMG="<IMG SRC=\"$GIFS/big-doc.gif\" ALT=\"Attachment\" WIDTH=32 HEIGHT=32 BORDER=0>"; $IMG_SHOW = "<b>Show</b>"; $IMG_ADD = "<b>Add</b>"; /* FUNCTION DEFINITIONS */ function introText () { /* * Intro blurb on the intro page */ ?> <P> This Message Board has been developed so that users can comment on the hosting companies listed on this site. Try and keep your comments on-topic, and free of inappropriate language. </P> <? }; function getDocInfo ($fileid) { /* * Returns information on an attached document */ global $DBASE, $TABLE_DOCS; UnSet($return); $q1=mysql($DBASE,"select * from $TABLE_DOCS where document=$fileid"); if (mysql_numrows($q1)==0): $return[0]=-1; else: $return[0]=mysql_result($q1,0,"filename"); $return[1]=mysql_result($q1,0,"filesize"); $return[2]=mysql_result($q1,0,"filetype"); endif; return($return); }; function makeIndent($x) { $return="<IMG SRC=\"/gifs/spacer.gif\" ALT=\" \" WIDTH=8 HEIGHT=18 BORDER=0 ALIGN=top>"; $i=1; while ($i<strlen($x)): $c=substr($x,$i,1); switch ($c) { case "-": $return.="<IMG SRC=\"/gifs/spacer.gif\" ALT=\" \" WIDTH=16 HEIGHT=18 BORDER=0 ALIGN=top>"; break; case "L": $return.="<IMG SRC=\"/gifs/arrow0.gif\" ALT=\" +-\" WIDTH=16 HEIGHT=18 BORDER=0 ALIGN=top>"; break; case "T": $return.="<IMG SRC=\"/gifs/arrow1.gif\" ALT=\" |-\" WIDTH=16 HEIGHT=18 BORDER=0 ALIGN=top>"; break; case "I": $return.="<IMG SRC=\"/gifs/arrow2.gif\" ALT=\" | \" WIDTH=16 HEIGHT=18 BORDER=0 ALIGN=top>"; break; } $i++; endwhile; return($return); }; function getHeaders ($parent,$subgroup,$indent,$mode=0) { /* * Threads the message headers * if $mode=1, it's the moderator function */ global $DBASE, $TABLE_MSGS, $ROOT_DIR, $MSGS, $ROOT_URL, $MOD_URL, $LIL_DOC_IMG; global $BGCOLOR, $DATE_FORMAT,$jjj; $query="select * from $TABLE_MSGS where parent=$parent and subgroup=$subgroup order by date desc"; $q1=mysql_db_query($DBASE, $query); $num=mysql_numrows($q1); if ($num>0): $i=0; while ($i<$num): $id=mysql_result($q1,$i,"id"); $date=mysql_result($q1,$i,"date"); $subj=mysql_result($q1,$i,"subj"); $document=mysql_result($q1,$i,"document"); echo "<TR VALIGN=middle BGCOLOR=\"".$BGCOLOR[$jjj%2]."\">\n"; $jjj++; echo "<TD ALIGN=left WIDTH=80% NOWRAP>"; font("-1"); if ($i+1==$num): echo makeIndent($indent."L"); else: echo makeIndent($indent."T"); endif; echo "<A HREF=\"message.php?id=$id\">$subj</A>"; if ($document!=0): echo " $LIL_DOC_IMG"; endif; echo "<BR></TD>\n"; if ($mode>=0): echo "<TD ALIGN=center WIDTH=10% NOWRAP>"; font("-2"); echo date($DATE_FORMAT,$date); echo "</TD>\n"; endif; if ($mode==1): echo "<TD>"; font("-2"); echo " <INPUT TYPE=\"checkbox\" NAME=\"delete[$id]\">"; echo "DEL <BR></TD>\n"; echo "<TD>"; font("-2"); echo " <A HREF=\"etc/edit.php?id=$id\">"; echo "EDIT</A> <BR></TD>\n"; endif; echo "</TR>\n"; if ($i+1==$num): getHeaders($id,$subgroup,$indent."-",$mode); else: getHeaders($id,$subgroup,$indent."I",$mode); endif; $i++; endwhile; endif; }; function showMessage ($mode, $subj, $subgroup, $name, $email, $date, $document, $parent, $post) { /* * Displays a message (!) */ global $FONTFACE, $LIL_DOC_IMG, $MSGS, $DBASE, $USE_DOC_UPLOAD; global $TABLE_WIDTH, $TABLE_MSGS, $MSG_FRAME_COLOR, $MSG_FRAME_COLOR2, $MSG_TEXT_COLOR; global $TEXT_COLOR1, $TEXT_COLOR2; $FT1="<FONT FACE=\"$FONTFACE\" COLOR=\"$TEXT_COLOR1\" SIZE=-1>"; $FT2="<FONT FACE=\"$FONTFACE\" COLOR=\"$TEXT_COLOR2\" SIZE=-1>"; echo "<TABLE BORDER=0 cellpadding=3 cellspacing=0 width=$TABLE_WIDTH BGCOLOR=\"$MSG_FRAME_COLOR2\">\n"; echo "<TR VALIGN=top><TD align=right WIDTH=20%>$FT1 Title:<BR></TD><TD align=left>$FT2<B>$subj</B><BR></TD></TR>\n"; if ($USE_SUBGROUPS): echo "<TR VALIGN=top><TD align=right>$FT1 Play:</TD><TD align=left>$FT2<B>".getSubgroupName($subgroup)."</B></TD></TR>\n"; endif; echo "<TR VALIGN=top><TD align=right>$FT1 Posted by:</TD><TD align=left>$FT2<B>$name</B>"; if ($email!=""): echo " <<a href=\"mailto:$email\">$email</a>>"; endif; echo "</TD></TR>\n"; echo "<TR VALIGN=top><TD align=right>$FT1 Date:</TD><TD align=left>$FT2<B>$date</B></TD></TR>\n"; if ($USE_DOC_UPLOAD && $document!=0): $docinfo=getDocInfo($document); echo "<TR VALIGN=top><TD align=right>$FT1 Attachment:</TD>"; if ($mode=="preview"): echo "<TD align=left>$FT2<B>$docinfo[0]</B> $LIL_DOC_IMG</TD></TR>\n"; else: echo "<TD align=left>$FT2<A HREF=\"getdoc.php?document=$document\"><B>$docinfo[0]</B>$LIL_DOC_IMG</A></TD></TR>\n"; endif; endif; if($parent>0): echo "<TR VALIGN=top><TD align=right>$FT1 Follow-Up To:</TD><TD align=left>$FT2"; $q3=mysql($DBASE, "select subj from $TABLE_MSGS where id=$parent"); $psubj=mysql_result($q3,0,"subj"); if ($mode=="preview"): echo "<B>$psubj</B></TD></TR>\n"; else: echo "<a href=\"message.php?id=$parent\"><B>$psubj</B></a></TD></TR>\n"; endif; elseif($parent<0): echo "<TR VALIGN=top><TD colspan=2>$FT1<I>Direct Parent Deleted Or Expired</I></TD></TR>\n"; endif; echo "<TR VALIGN=top BGCOLOR=\"$MSG_TEXT_COLOR\"><TD colspan=2>$FT2\n"; if ($mode=="preview"): $show=ereg_replace(10,"<BR>",$post); echo "$show\n"; else: $show=file("$MSGS/$post"); $i=0; while($i<count($show)): echo "$show[$i]<BR>\n"; $i++; endwhile; endif; echo "</TD></TR>\n"; }; function showDisclaimer () { /* * Displays the download disclaimer message - a good idea ...! */ echo "<B>You are about to download a document.</B> We do not claim any responsibility for the content of the following file, nor does we guarantee that the file will not harm your system.<P>\n"; echo "If you have any problems with the file, please send your comments to the person who posted the file.<P>\n"; echo "If you are unable to view or open the file on your machine (because you don't have the appropriate application, for example), please ask the person who posted the file to convert it to another format.\n"; }; function deleteMsg ($id) { /* * Deletes a posted message, and any attachments */ global $MSGS, $DOCS, $DBASE, $TABLE_MSGS, $TABLE_DOCS, $USE_DOC_UPLOAD; $q1=@mysql_db_query($DBASE, "select * from $TABLE_MSGS where id=$id"); if(mysql_numrows($q1)!=1 || $q1==-1): echo "<FONT COLOR=\"#800000\">Error: ".mysql_error()."<BR>Message $id not deleted.</FONT><BR>\n"; return(-1); else: $subj=mysql_result($q1,0,"subj"); $parent=mysql_result($q1,0,"parent"); $document=mysql_result($q1,0,"document"); mysql_db_query($DBASE, "delete from $TABLE_MSGS where id=$id"); mysql_db_query($DBASE, "update $TABLE_MSGS set parent=$parent where parent=$id"); if ($USE_DOC_UPLOAD && $document!=0): $q=mysql_db_query($DBASE,"delete from $TABLE_DOCS where document=$document"); $file=sprintf("%-07.7d",$document); $file="$DOCS/d"+$file; unlink($file); $subj="$subj (plus attachment)"; endif; return($subj); endif; }; function commonModHeader ($x) { commonHeader($x); }; function commonModFooter () { commonFooter(); }; ?> Index: php-hosts-web/msgboard/toolbar.php +++ php-hosts-web/msgboard/toolbar.php <?php if (!$USE_SUBGROUPS): $subgroup=0; endif; echo "<a href=\"post.php?subgroup=$subgroup\">$BUTTON_POSTNEW</a> | \n"; echo "<a href=\"list.php?subgroup=$subgroup\">$BUTTON_LISTHEAD</a> | \n"; echo "<a href=\"index.php\">$BUTTON_INDEX</a>\n"; ?> Index: php-hosts-web/msgboard/etc/delete.php +++ php-hosts-web/msgboard/etc/delete.php <?php include("../shared-msgboard.inc"); require 'login.inc'; commonHeader("Moderate Message Board"); title("Moderate Message Board"); if ($mode=="DELETE"): reset($delete); $i=0; $num=0; echo "<UL>\n"; while ($i<count($delete)): $id=key($delete); if ($delete[$id]=="on"): $name=deleteMsg($id); if ($name!=-1): echo "<LI>$id ($name) <B>deleted</B>\n"; $num++; endif; endif; next($delete); $i++; endwhile; echo "</UL>"; echo "Done: <B>$num</B> messages deleted.<P>"; staffToolbar(); commonFooter(); exit; endif; if ($USE_SUBGROUPS): $groupname=getSubgroupName($subgroup); else: $groupname="Message Board"; $subgroup=0; endif; ?> <FORM METHOD="POST" ACTION="delete.php"> <TABLE BORDER=0 CELLPADDING=5 CELLSPACING=0 BGCOLOR="<? echo $MSG_FRAME_COLOR2;?>" WIDTH=100%> <TR VALIGN=bottom> <TD ALIGN=left><? font("-1");?> Messages for<BR></FONT> <? font();?><B><? echo $groupname;?></B><BR></FONT> </TD> </TR> <TR VALIGN=top> <TD> <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%> <? getHeaders(0,$subgroup,"",1);?> </TABLE> </TD></TR> </TABLE><P> <INPUT TYPE="hidden" VALUE="DELETE" NAME="mode"> <INPUT TYPE="submit" VALUE=" Delete "> </FONT></FORM> <? commonFooter();?> Index: php-hosts-web/msgboard/etc/edit.php +++ php-hosts-web/msgboard/etc/edit.php <?php include("../shared-msgboard.inc"); require 'login.inc'; if($mode=="edit"): commonHeader("Edit Message"); title("Edit Message"); $time=time(); $subj=addslashes($subj); $email=addslashes($email); $name=addslashes($name); $query="update $TABLE_MSGS set subj='$subj',email='$email',name='$name' where id=$id"; echo "<!-- $query -->\n"; mysql_db_query($DBASE,$query); $newfile="$MSGS/$id"; $fp=fopen($newfile,"w"); fputs($fp,$txt); fclose($fp); echo "<FONT SIZE=+1><b>Message edited.</b></FONT><P>\n"; echo "<CENTER>\n"; staffToolbar(); echo "</CENTER>\n"; commonFooter(); exit; endif; $query="select * from msgboard_msgs where id=$id"; $q1=mysql_db_query($DBASE,$query); $result=mysql_fetch_array($q1); $groupname=getSubgroupName($result["subgroup"]); commonHeader("Edit Message: $groupname"); title("Edit Message: ".$groupname); ?> <SCRIPT LANGUAGE="Javascript"> <!-- function checkFields() { if (document.forms[0].elements['name'].value == "") { alert("Please enter your name."); document.forms[0].elements['name'].focus(); return false ; } if (document.forms[0].elements['subj'].value == "") { alert("Please enter a title for this posting."); document.forms[0].elements['subj'].focus(); return false ; } if (document.forms[0].elements['txt'].value == "") { alert("You need to enter something for your message."); document.forms[0].elements['txt'].focus(); return false ; } return true; } //--> </SCRIPT> Fields marked with a <? reqStar();?> are required. <FORM ENCTYPE="multipart/form-data" ACTION="edit.php" METHOD="post" onReset="return confirm('Really erase all fields and start over?')" onSubmit="return checkFields();"> <input TYPE="hidden" NAME="mode" value="edit"> <INPUT TYPE="hidden" NAME="id" value=<? echo $result["id"];?> > <TABLE BORDER=0 cellpadding=5 cellspacing=0 WIDTH=<? echo $TABLE_WIDTH;?> BGCOLOR="<? echo $MSG_FRAME_COLOR;?>"> <TR VALIGN=top BGCOLOR="<? echo $MSG_FRAME_COLOR2;?>"> <TD COLSPAN=2><FONT FACE="<? echo $TFONTFACE;?>"><B>Edit Message</B></TD></TR> <TR VALIGN=top> <TD ALIGN=right><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Your Name:</TD> <TD><input name="name" SIZE=40 MAXLENGTH=127 VALUE="<? qecho($result["name"]);?>" ><? reqStar();?></TD> </TR> <TR VALIGN=top> <TD ALIGN=right><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Email Address:</TD> <TD><input name="email" SIZE=40 MAXLENGTH=127 VALUE="<? qecho($result["email"]);?>" ><BR></TD> </TR> <TR VALIGN=top> <TD ALIGN=right><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Title of Message:</TD> <TD><input name="subj" SIZE=40 MAXLENGTH=127 VALUE="<? qecho($result["subj"]);?>" ><? reqStar();?></TD> </TR> <TR VALIGN=top BGCOLOR="<? echo $MSG_FRAME_COLOR2;?>"> <TD COLSPAN=2><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Enter your message below:</TD> </TR> <TR VALIGN=top> <TD ALIGN=right><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Message:</TD> <TD><textarea rows=8 cols=40 name="txt" WRAP="virtual"><? $show=file("$MSGS/".$result["id"]); $i=0; while($i<count($show)): qecho($show[$i]); $i++; endwhile; ?></textarea><? reqStar();?></TD> </TR> <TR VALIGN=top> <TD><BR></TD> <TD ALIGN=left><FONT FACE="<? echo $TFONTFACE;?>" SIZE=-2><B>Note:</B> We reserve the right to edit or delete messages that we deem offensive or inappropriate.<BR></TD> </TR> <? if ($USE_DOC_UPLOAD):?> <TR VALIGN=top BGCOLOR="<? echo $MSG_FRAME_COLOR2;?>"> <TD COLSPAN=2><FONT FACE="<? echo $FONTFACE;?>" SIZE=-1> If you wish to attach a document to this message, enter the filename here.</TD> </TR> <TR VALIGN=top> <TD ALIGN=right> <FONT FACE="<? echo $FONTFACE;?>" SIZE=-1>Attachment:</TD> <TD><INPUT NAME="filename" TYPE="file"></TD> </TR> <? endif;?> <TR VALIGN=top BGCOLOR="<? echo $MSG_FRAME_COLOR2;?>"> <TD ALIGN=left><INPUT TYPE="Reset" VALUE=" Clear All "></TD> <TD ALIGN=right><INPUT TYPE="submit" VALUE=" Edit » "> <? if ($USE_DOC_UPLOAD): echo "<FONT FACE=\"$FONTFACE\" SIZE=-2><BR>This may take a while if you have attached a file.\n"; endif;?> </TD> </TR> </TABLE> </form> <? commonFooter();?> Index: php-hosts-web/msgboard/etc/index.php +++ php-hosts-web/msgboard/etc/index.php <?php require("../shared-msgboard.inc"); require 'login.inc'; commonHeader("Moderate Message Board"); title("Moderate Message Board"); introText(); ?> Click on the <? echo $IMG_SHOW; ?> button for a listing of all the comments for a particular section. <P> <? echo "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=5 WIDTH=100%>\n"; echo "<TR BGCOLOR=\"$MSG_FRAME_COLOR2\" VALIGN=bottom>\n"; echo "<TD ALIGN=left>"; font("-1"); echo "Section</TD>\n"; echo "<TD ALIGN=center>"; font("-1"); echo "Number of<BR>Messages</TD>\n"; echo "<TD ALIGN=center>"; font("-1"); echo "Latest<BR>Message</TD>\n"; echo "<TD><BR></TD>\n"; echo "</TR>\n"; $i=0; while (list($id,$section)=each($SUBGROUP)): $bg=$BGCOLOR[$i%2]; echo "<TR BGCOLOR='$bg' VALIGN=middle>\n"; echo "<TD>"; font("-1"); echo $section."<BR></TD>\n"; $query="select count(id) as count, max(date) as last"; $query.=" from msgboard_msgs"; $query.=" where subgroup=".$id; echo "<!-- $query -->\n"; $q2=mysql_db_query($DBASE,$query); $count=mysql_result($q2,0,"count"); $last=date("d-M-Y",mysql_result($q2,0,"last")); if ($count==0): $last="-"; else: endif; mysql_free_result($q2); echo "<TD ALIGN=right>"; font("-1"); echo "$count<BR></TD>\n"; echo "<TD ALIGN=center>"; font("-1"); echo "$last<BR></TD>\n"; echo "<TD>"; font("-1"); if ($count!=0): echo "<A HREF=\"delete.php?subgroup=".$id."\">" . $IMG_SHOW . "</A>"; endif; echo "<BR></TD>"; echo "</TR>\n"; $i++; endwhile; echo "</TABLE>\n"; staffToolbar(); commonFooter(); ?> Index: php-hosts-web/msgboard/etc/toolbar.php +++ php-hosts-web/msgboard/etc/toolbar.php <?php echo "<a href=\"$ROOT_URL\">[ Public Site ]</a>\n"; ?>