Jump to content
xisto Community
Joshthegreat

Simple Shoutbox? I only know the echo part of php...

Recommended Posts

Well, does anyone have a nice simple shoutbox php code? It's just I've been looking for one for a while but they all seems to have millions of files attached with them and everything. Just wondering if theres anything simpler out there?

Share this post


Link to post
Share on other sites

Here's one I made myself, if you still need it:

<form method="POST" action="comment.php">Name: <input type="text" name="name"><br>Message:<br><textarea name="message" rows="10" cols="45"></textarea><br><input type="submit" name="submit" value="Post Message"><input type="reset" value="Reset"></form>
This is the input box, you can put this wherever you want. Also, name the file "comment.php" or change the form action.

<?php$submit = $_POST['submit'];if($submit == true){        $filename = 'comment/comments.html';        $name = $_POST['name'];        $name = stripslashes($name);        $name = strip_tags($name);        $time = date("\P\o\s\\t\e\d \o\\n l F jS Y \a\\t g:i:s A");        $message = $_POST['message'];        $message = stripslashes($message);        $message = strip_tags($message, '<b><i><u>');        $comment = "<tr><td width=\"100%\"><i><b>From:</b></i> $name</td></tr><tr><td width=\"100%\"><i><b>$time</b></i></td></tr><tr><td width=\"100%\"><i><b>Message:</b></i><br>$message<br><div><hr width=\"50%\"></div></td></tr>\n";        $handle = fopen($filename, 'a');        fwrite($handle, $comment);        fclose($handle);}include 'comment/comments.html';?>
This is the PHP code, it doesn't matter if it's above or below the input. You also need a directory called "comment" with a file called "comments.html" (or you can change that--it's like that because I made it on my school's server and it uses AFS for permissions).

You can see this in action at http://forums.xisto.com/no_longer_exists/

Share this post


Link to post
Share on other sites

Thanks beeseeven,I hate to use the script from third party websites with pop-ups and ads. It is much better to have our own even though it may be simple. I wish to put this in my site. Can we also include style sheet to the shoutbox?

Share this post


Link to post
Share on other sites

i have s simple script which used mysql instead.

this script makes use of a template system. if you know php then feel free to modify this to suit your need. otherwise just tell me and i will modify it for you.

if (isset($_GET['submit'])) {	$strip_var_list = array("shout_name" => "name", "shout_website" => "website", "shout_msg" => "msg");		while(list($var, $param) = @each($strip_var_list)) {  if (!empty($HTTP_POST_VARS[$param])) {  	$$var = trim(htmlspecialchars($HTTP_POST_VARS[$param]));  }	}		$shout_time = time();		$sql = "INSERT INTO shoutbox (shout_name, shout_website, shout_date, shout_msg)  VALUES ('{$shout_name}', '{$shout_website}', {$shout_time}, '{$shout_msg}')";		if(!($result = $db->query($sql))) {  die(mysql_error());	}		header("Location: shout.php?show");} elseif (isset($_GET['show'])) {	$template->set_filenames(array(  "body" => "shout-body.html")	);		$current_time = time();		$sql = "DELETE FROM shoutbox  WHERE shout_date <= " . ($current_time - 172800);		if(!($result = $db->query($sql))) {  die(mysql_error());	}		$sql = "SELECT *  FROM shoutbox  ORDER BY shout_date DESC";		if(!($result = $db->query($sql))) {  die(mysql_error());	}		while ($shout[] = $db->fetchrow($result));		if (count($shout) > 1 && ($total_shout = count($shout) - 1)) {  for ($x = 0; $x < $total_shout; $x++) {  	$template->assign_block_vars("shout_row", array(    "NAME" => $shout[$x]['shout_name'],    "WEBSITE" => $shout[$x]['shout_website'],    "DATE" => date("M-d-Y", $shout[$x]['shout_date']),    "MESSAGE" => $shout[$x]['shout_msg'])  	);  }	}		$template->pparse("body");}

Share this post


Link to post
Share on other sites

I've got 4 files for my integrated shoutbox:

shoutbox_body.tpl:

<HEAD><link rel="stylesheet" href="templates/{T_NAME}/{T_HEAD_STYLESHEET}" type="text/css"></HEAD><body bgcolor="{T_TR_COLOR3}" text="{T_BODY_TEXT}" link="{T_BODY_LINK}" vlink="{T_BODY_VLINK}"> <form method=POST action="{U_SHOUTBOX}">{ERROR_BOX}<table width="100%" height="26" cellpadding="0" cellspacing="0" border="0" class="row1"><tr>  	<td class="row1" align="center" valign="middle" width="100%">    <center><span class="gensmall">  <!-- BEGIN switch_auth_post -->  <input type="text" class="liteoption" name="message" value="{SHOUT_OLD}" size="15"/>   <input type="submit" class="mainoption" value="{L_SHOUT_SUBMIT}" name="shout" />	<!-- END switch_auth_post -->	<!-- BEGIN switch_auth_no_post -->    {L_SHOUTBOX_LOGIN} 	<!-- END switch_auth_no_post -->     <input type="submit" class="liteoption" value="{L_SHOUT_REFRESH}" name="refresh" /></center>    </span>      <center>  	</td></tr></table>   <iframe src="{U_SHOUTBOX_VIEW}" align="left" width="100%" height="165" frameborder="0" marginheight="0" marginwidth="0" allowtransparency="true">  </iframe></form></body>

shoutbox_max_body.tpl:
<script language="JavaScript" type="text/javascript" src="templates/post_message.js"></script><table width="100%" cellspacing="0" cellpadding="2" border="0" align="center"><tr> <td align="left" valign="bottom"><span class="gensmall"> <!-- BEGIN switch_user_logged_in -->{LAST_VISIT_DATE}<br /><!-- END switch_user_logged_in -->{CURRENT_TIME}<br /></span><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a></span></td></tr></table>{POST_PREVIEW_BOX}{ERROR_BOX}<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0" class="forumline"><form action="{U_SHOUTBOX}" method="post" name="post" onsubmit="return checkForm(this)">	<tr>   <th class="thHead" colspan="2" height="25"><b>{L_SHOUT_TEXT}</b></th>	</tr>	<!-- BEGIN switch_username_select -->	<tr>   <td class="row1"><span class="gen"><b>{L_USERNAME}</b></span></td>  <td class="row2"><span class="genmed"><input type="text" class="post" tabindex="1" name="username" size="25" maxlength="25" value="{USERNAME}" /></span></td>	</tr>	<!-- END switch_username_select -->	<tr>    <td class="row1" valign="top">   <table width="100%" border="0" cellspacing="0" cellpadding="1">    <tr>   	<td valign="middle" align="center"> <br />     <table width="100" border="0" cellspacing="0" cellpadding="5">    <tr align="center">       <td colspan="{S_SMILIES_COLSPAN}" class="gensmall"><b>{L_EMOTICONS}</b></td>    </tr>    <!-- BEGIN smilies_row -->    <tr align="center" valign="middle">      <!-- BEGIN smilies_col -->      <td><img src="{smilies_row.smilies_col.SMILEY_IMG}" border="0" onmouseover="this.style.cursor='hand';" onclick="emoticon('{smilies_row.smilies_col.SMILEY_CODE}');" alt="{smilies_row.smilies_col.SMILEY_DESC}" title="{smilies_row.smilies_col.SMILEY_DESC}" /></a></td>      <!-- END smilies_col -->    </tr>    <!-- END smilies_row -->    <!-- BEGIN switch_smilies_extra -->    <tr align="center">       <td colspan="{S_SMILIES_COLSPAN}"><span  class="nav"><a href="{U_MORE_SMILIES}" onclick="window.open('{U_MORE_SMILIES}', '_phpbbsmilies', 'HEIGHT=300,resizable=yes,scrollbars=yes,WIDTH=250');return false;" target="_phpbbsmilies" class="nav">{L_MORE_SMILIES}</a></span></td>    </tr>    <!-- END switch_smilies_extra -->     </table>  	</td>    </tr>  </table>   </td>   <td class="row2" valign="top"><span class="gen"> <span class="genmed"> </span>   <table width="450" border="0" cellspacing="0" cellpadding="2">    <tr align="right" valign="middle">   	<td>     <p dir="rtl" style="margin-top: 0; margin-bottom: 0" align="left"><span class="gen">      <span class="genmed">       <select name="fc" onChange="BBCfc()" onMouseOver="helpline('fc')"         <option style="color:darkred; background-color: {T_TD_COLOR1}" value="darkred" class="genmed" dir="ltr">              <option selected>Font Color</option>              <option style="color:black; value="{T_FONTCOLOR1}" value="{T_FONTCOLOR1}">{L_COLOR_DEFAULT}</option>              <option value="darkred">{L_COLOR_DARK_RED}</option>       <option style="color:red; background-color: {T_TD_COLOR1}" value="red" class="genmed">{L_COLOR_RED}</option>       <option style="color:orange; background-color: {T_TD_COLOR1}" value="orange" class="genmed">{L_COLOR_ORANGE}</option>       <option style="color:brown; background-color: {T_TD_COLOR1}" value="brown" class="genmed">{L_COLOR_BROWN}</option>       <option style="color:yellow; background-color: {T_TD_COLOR1}" value="yellow" class="genmed">{L_COLOR_YELLOW}</option>       <option style="color:green; background-color: {T_TD_COLOR1}" value="green" class="genmed">{L_COLOR_GREEN}</option>       <option style="color:olive; background-color: {T_TD_COLOR1}" value="olive" class="genmed">{L_COLOR_OLIVE}</option>       <option style="color:cyan; background-color: {T_TD_COLOR1}" value="cyan" class="genmed">{L_COLOR_CYAN}</option>       <option style="color:blue; background-color: {T_TD_COLOR1}" value="blue" class="genmed">{L_COLOR_BLUE}</option>       <option style="color:darkblue; background-color: {T_TD_COLOR1}" value="darkblue" class="genmed">{L_COLOR_DARK_BLUE}</option>       <option style="color:indigo; background-color: {T_TD_COLOR1}" value="indigo" class="genmed">{L_COLOR_INDIGO}</option>       <option style="color:violet; background-color: {T_TD_COLOR1}" value="violet" class="genmed">{L_COLOR_VIOLET}</option>       <option style="color:white; background-color: {T_TD_COLOR1}" value="white" class="genmed">{L_COLOR_WHITE}</option>       <option style="color:black; background-color: {T_TD_COLOR1}" value="black" class="genmed">{L_COLOR_BLACK}</option>     </select>   <select name="fs" onChange="BBCfs()" onMouseOver="helpline('fs')"          <option value="7" class="genmed" dir="ltr">              <option selected>Font Size</option>              {L_FONT_TINY}</option>       <option value="9" class="genmed">{L_FONT_SMALL}</option>       <option value="12" class="genmed">{L_FONT_NORMAL}</option>       <option value="18" class="genmed">{L_FONT_LARGE}</option>       <option  value="24" class="genmed">{L_FONT_HUGE}</option>    	</select> <span lang="ar-sy"> </span><select name="ft" onChange="BBCft()" onMouseOver="helpline('ft')"         <option style="color:black; background-color: #FFFFFF " value="{L_ARIAL}" class="genmed" dir="ltr">                                          <option selected>Font type</option>                                          <option value="Arial">Default font                                          </option><option style="color:black; background-color: #FFFFFF " value="Andalus" class="genmed">Andalus</option> <option style="color:black; background-color: #FFFFFF " value="Arial" class="genmed">Arial</option> <option style="color:black; background-color: #FFFFFF " value="Comic Sans MS" class="genmed">Comic Sans MS</option> <option style="color:black; background-color: #FFFFFF " value="Courier New" class="genmed">Courier New</option>                                           <option value="Lucida Console">Lucida Console                                          </option><option style="color:black; background-color: #FFFFFF " value="Microsoft Sans Serif" class="genmed">Microsoft Sans Serif</option> <option style="color:black; background-color: #FFFFFF " value="Symbol" class="genmed">Symbol</option> <option style="color:black; background-color: #FFFFFF " value="Tahoma" class="genmed">Tahoma</option> <option style="color:black; background-color: #FFFFFF " value="Times New Roman" class="genmed">Times New Roman</option> <option style="color:black; background-color: #FFFFFF " value="Traditional Arabic" class="genmed">Traditional Arabic</option> <option style="color:black; background-color: #FFFFFF " value="Verdana" class="genmed">Verdana</option> <option style="color:black; background-color: #FFFFFF " value="Webdings" class="genmed">Webdings</option> <option style="color:black; background-color: #FFFFFF " value="Wingdings" class="genmed">Wingdings</option>                                   </select></span></span></span><p dir="rtl" style="margin-top: 0; margin-bottom: 0">              <span class="genmed"><span style="font-size: 5pt"> </span></span></td>    </tr>    <span class="gen">     <tr>   	<td width="450">      <table width="100%" border="0" cellspacing="0" cellpadding="0">    <tr>                         <td>                           <table width="100%" border="0" cellspacing="0" cellpadding="0">                                 <tr>                                   <td>                                  <p dir="ltr" align="left"><span class="gen">       <span class="genmed">              <span lang="ar-sy"> </span><img border="0" src="bbcode_box/images/justify.gif" name="justify" type="image" onClick="BBCjustify()" onMouseOver="helpline('justify')" style="border-style: outset; border-width: 1" alt="justify"><img border="0" src="bbcode_box/images/right.gif" name="right" type="image" onClick="BBCright()" onMouseOver="helpline('right')" style="border-style: outset; border-width: 1" alt="right"><img border="0" src="bbcode_box/images/center.gif" name="center" type="image" onClick="BBCcenter()" onMouseOver="helpline('center')" style="border-style: outset; border-width: 1" alt="center"><img border="0" src="bbcode_box/images/left.gif" name="left" type="image" onClick="BBCleft()" onMouseOver="helpline('left')" style="border-style: outset; border-width: 1" alt="left">                                     <img border="0" src="bbcode_box/images/bold.gif" name="bold" type="image" onClick="BBCbold()" onMouseOver="helpline('b')" style="border-style: outset; border-width: 1" alt="bold"><img border="0" src="bbcode_box/images/italic.gif" name="italic" type="image" onClick="BBCitalic()" onMouseOver="helpline('i')" style="border-style: outset; border-width: 1" alt="italic"><img border="0" src="bbcode_box/images/under.gif" name="under" type="image" onClick="BBCunder()" onMouseOver="helpline('u')" style="border-style: outset; border-width: 1" alt="under line"><img border="0" src="bbcode_box/images/strike.gif" name="strike" type="image" onClick="BBCstrike()" onMouseOver="helpline('strike')" style="border-style: outset; border-width: 1" alt="strike"><img border="0" src="bbcode_box/images/sup.gif" name="sup" type="image" onClick="BBCsup()" onMouseOver="helpline('sup')" style="border-style: outset; border-width: 1" alt="sup"><img border="0" src="bbcode_box/images/sub.gif" name="sub" type="image" onClick="BBCsub()" onMouseOver="helpline('sub')" style="border-style: outset; border-width: 1" alt="sub">                                     <img border="0" src="bbcode_box/images/fade.gif" name="fade" type="image" onClick="BBCfade()" onMouseOver="helpline('fade')" style="border-style: outset; border-width: 1" alt="fade"><img border="0" src="bbcode_box/images/grad.gif" name="grad" type="image" onClick="BBCgrad()" onMouseOver="helpline('grad')" style="border-style: outset; border-width: 1" alt="gradient">                                     <img border="0" src="bbcode_box/images/rtl.gif" name="dirrtl" type="image" onClick="BBCdir('rtl')" onMouseOver="helpline('rtl')" style="border-style: outset; border-width: 1" alt="Right to Left"><img border="0" src="bbcode_box/images/ltr.gif" name="dirltr" type="image" onClick="BBCdir('ltr')" onMouseOver="helpline('ltr')" style="border-style: outset; border-width: 1" alt="Left to Right">                                     <img border="0" src="bbcode_box/images/marqd.gif" name="marqd" type="image" onClick="BBCmarqd()" onMouseOver="helpline('marqd')" style="border-style: outset; border-width: 1" alt="Marque to down"><img border="0" src="bbcode_box/images/marqu.gif" name="marqu" type="image" onClick="BBCmarqu()" onMouseOver="helpline('marqu')" style="border-style: outset; border-width: 1" alt="Marque to up"><img border="0" src="bbcode_box/images/marql.gif" name="marql" type="image" onClick="BBCmarql()" onMouseOver="helpline('marql')" style="border-style: outset; border-width: 1" alt="Marque to left"><img border="0" src="bbcode_box/images/marqr.gif" name="marqr" type="image" onClick="BBCmarqr()" onMouseOver="helpline('marqr')" style="border-style: outset; border-width: 1" alt="Marque to right"></span></td>                                 </tr>                                 <tr>                                   <td dir="rtl">                                  <p align="right" dir="rtl" style="margin-top: 0; margin-bottom: 0">                                  <span style="font-size: 5pt"> </span><p align="left" dir="ltr" style="margin-top: 0; margin-bottom: 0"><span class="gen">      <span class="genmed">               <img border="0" src="bbcode_box/images/code.gif" name="code" type="image" onClick="BBCcode()" onMouseOver="helpline('code')" style="border-style: outset; border-width: 1" alt="Code"><img border="0" src="bbcode_box/images/php.gif" name="php" type="image" onClick="BBCphp()" onMouseOver="helpline('php')" style="border-style: outset; border-width: 1" alt="PHP"><img border="0" src="bbcode_box/images/quote.gif" name="quote" type="image" onClick="BBCquote()" onMouseOver="helpline('quote')" style="border-style: outset; border-width: 1" alt="Quote">  <img border="0" src="bbcode_box/images/list.gif" name="list" type="image" onClick="BBClist()" onMouseOver="helpline('list')" style="border-style: outset; border-width: 1" alt="List">                                     <img border="0" src="bbcode_box/images/google.gif" name="google" type="image" onClick="BBCgoogle()" onMouseOver="helpline('google')" style="border-style: outset; border-width: 1" alt="google">                                    <img border="0" src="bbcode_box/images/url.gif" name="url" type="image" onClick="BBCurl()" onMouseOver="helpline('url')" style="border-style: outset; border-width: 1" alt="URL"><img border="0" src="bbcode_box/images/email.gif" name="email" type="image" onClick="BBCmail()" onMouseOver="helpline('mail')" style="border-style: outset; border-width: 1" alt="Email"><img border="0" src="bbcode_box/images/web.gif" name="web" type="image" onClick="BBCweb()" onMouseOver="helpline('web')" style="border-style: outset; border-width: 1" alt="Wep Page">                                     <img border="0" src="bbcode_box/images/img.gif" name="img" type="image" onClick="BBCimg()" onMouseOver="helpline('img')" style="border-style: outset; border-width: 1" alt="Image"><img border="0" src="bbcode_box/images/flash.gif" name="flash" type="image" onClick="BBCflash()" onMouseOver="helpline('flash')" style="border-style: outset; border-width: 1" alt="Flash"><img border="0" src="bbcode_box/images/video.gif" name="video" type="image" onClick="BBCvideo()" onMouseOver="helpline('video')" style="border-style: outset; border-width: 1" alt="Video"><img border="0" src="bbcode_box/images/sound.gif" name="stream" type="image" onClick="BBCstream()" onMouseOver="helpline('stream')" style="border-style: outset; border-width: 1" alt="Stream"><img border="0" src="bbcode_box/images/ram.gif" name="ram" type="image" onClick="BBCram()" onMouseOver="helpline('ram')" style="border-style: outset; border-width: 1" alt="Real Media">                                     <img border="0" src="bbcode_box/images/hr.gif" name="hr" type="image" onClick="BBChr()" onMouseOver="helpline('hr')" style="border-style: outset; border-width: 1" alt="H-Line">                                     <img border="0" src="bbcode_box/images/plain.gif" name="plain" type="image" onClick="BBCplain()" onMouseOver="helpline('plain')" style="border-style: outset; border-width: 1" alt="Remove BBcode">  <img border="0" src="bbcode_box/images/you.gif" name="you" type="image" onClick="BBCyou()" onMouseOver="helpline('you')" style="border-style: outset; border-width: 1" alt="you"></span></td>                                 </tr>                           </table>                         </td>                   </tr>      </table>  	</td>    </tr>    <tr>   	<td colspan="9"> <span class="gensmall">      <input type="text" name="helpbox" size="45" maxlength="100" style="width:450px; font-size:10px" class="helpline" value="{L_STYLES_TIP}" />     </span></td>    </tr>    <tr>   	<td colspan="9"><span class="gen">      <textarea name="message" rows="8" cols="35" wrap="virtual" style="width:450px" tabindex="3" class="post" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this); typeQuietly(this, event);">{MESSAGE}</textarea>     </span></td>    </tr>  </table>  </span></td>	</tr>	<tr>    <td class="row1" valign="top"><span class="gen"><b>{L_OPTIONS}</b></span><br /><span class="gensmall">{HTML_STATUS}<br />{BBCODE_STATUS}<br />{SMILIES_STATUS}</span></td>   <td class="row2"><span class="gen"> </span>   <table cellspacing="0" cellpadding="1" border="0">    <!-- BEGIN switch_html_checkbox -->    <tr>   	<td>      <input type="checkbox" name="disable_html" {S_HTML_CHECKED} />  	</td>  	<td><span class="gen">{L_DISABLE_HTML}</span></td>    </tr>    <!-- END switch_html_checkbox -->    <!-- BEGIN switch_bbcode_checkbox -->    <tr>   	<td>      <input type="checkbox" name="disable_bbcode" {S_BBCODE_CHECKED} />  	</td>  	<td><span class="gen">{L_DISABLE_BBCODE}</span></td>    </tr>    <!-- END switch_bbcode_checkbox -->  </table>   </td>	</tr>	<tr>    <td class="cat" colspan="2" align="center" height="28"> {S_HIDDEN_FORM_FIELDS}<input type="submit" tabindex="5" name="refresh" class="mainoption" value="{L_SHOUT_REFRESH}" /> <input type="submit" tabindex="5" name="preview" class="mainoption" value="{L_SHOUT_PREVIEW}" /> <input type="submit" accesskey="s" tabindex="6" name="shout" class="mainoption" value="{L_SHOUT_SUBMIT}" /></td>	</tr>  </table></form>  <table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">	<tr>     <td align="right" valign="bottom" class="gensmall"> <span class="nav">	{PAGINATION}</span></td>	</tr></table><table border="0" cellpadding="4" cellspacing="1" width="100%" class="forumline">	<tr align="right">  <td class="cat" colspan="2" height="28" align="center"><b> {L_SHOUTBOX} <b/></td>	</tr>	<tr>  <th class="thLeft" width="160" height="26" nowrap="nowrap">{L_AUTHOR}</th>  <th class="thRight" nowrap="nowrap">{L_MESSAGE}</th>	</tr>	<!-- BEGIN shoutrow -->	<tr>   <td width="160" align="left" valign="top" class="{shoutrow.ROW_CLASS}">  	<span class="name"><b>{shoutrow.SHOUT_USERNAME}</b></span><br />  	<span class="postdetails">{shoutrow.USER_RANK}<br />  	{shoutrow.RANK_IMAGE}<br/>  	{shoutrow.USER_AVATAR}<br /><br/>{shoutrow.USER_JOINED}</span></td>  <td class="{shoutrow.ROW_CLASS}" width="100%" height="28" valign="top">  	<table width="100%" border="0" cellspacing="0" cellpadding="0">  	<tr>    <td width="100%"><a href="{shoutrow.U_MINI_POST}"><img src="{shoutrow.MINI_POST_IMG}" width="12" height="9" alt="{shoutrow.L_MINI_POST_ALT}" title="{shoutrow.L_MINI_POST_ALT}" border="0" /></a><span class="postdetails">{L_POSTED}: {shoutrow.TIME}</span></td>    <td valign="top" align="right" nowrap="nowrap">{shoutrow.QUOTE_IMG}{shoutrow.EDIT_IMG}{shoutrow.CENSOR_IMG}{shoutrow.DELETE_IMG}{shoutrow.IP_IMG}</td></form>  	</tr>  	<tr>     <td colspan="2"><hr/></td>  	</tr>  	<tr>    <td colspan="2"><span class="postbody">{shoutrow.SHOUT}{shoutrow.SIGNATURE}</span></td>  	</tr>  	</table>  </td>	</tr>	<tr>   <td class="spaceRow" colspan="2" height="1"><img src="images/spacer.gif" alt="" width="1" height="1" /></td>	</tr>	<!-- END shoutrow --></table>  <table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">	<tr>    <td align="left" valign="top"><span class="gensmall">{S_TIMEZONE}</span></td>   <td align="right" valign="bottom" class="gensmall"> <span class="nav">	{PAGINATION}</span></td>	</tr></table>

shoutbox_max_guest_body.tpl:
<table width="100%" cellspacing="0" cellpadding="2" border="0" align="center"><tr> <td align="left" valign="bottom"><span class="gensmall"> <!-- BEGIN switch_user_logged_in -->{LAST_VISIT_DATE}<br /><!-- END switch_user_logged_in -->{CURRENT_TIME}<br /></span><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a></span></td></tr></table><table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0" class="forumline"><form action="{U_SHOUTBOX}" method="post" name="post" onsubmit="return checkForm(this)">	<tr>    <td class="cat" colspan="2" align="center" height="28"> {S_HIDDEN_FORM_FIELDS}<input type="submit" tabindex="1" name="refresh" class="mainoption" value="{L_SHOUT_REFRESH}" /> </td>	</tr></table></form>  <table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">	<tr>     <td align="right" valign="bottom" class="gensmall"> <span class="nav">	{PAGINATION}</span></td>	</tr></table><table border="0" cellpadding="4" cellspacing="1" width="100%" class="forumline">	<tr align="right">  <td class="cat" colspan="2" height="28" align="center"><b> {L_SHOUTBOX} <b/></td>	</tr>	<tr>  <th class="thLeft" width="160" height="26" nowrap="nowrap">{L_AUTHOR}</th>  <th class="thRight" nowrap="nowrap">{L_MESSAGE}</th>	</tr>	<!-- BEGIN shoutrow -->	<tr>   <td width="160" align="left" valign="top" class="{shoutrow.ROW_CLASS}">  	<span class="name"><b>{shoutrow.SHOUT_USERNAME}</b></span><br />  	<span class="postdetails">{shoutrow.USER_RANK}<br />  	{shoutrow.RANK_IMAGE}<br/>  	{shoutrow.USER_AVATAR}<br /><br/>{shoutrow.USER_JOINED}</span></td>  <td class="{shoutrow.ROW_CLASS}" width="100%" height="28" valign="top">  	<table width="100%" border="0" cellspacing="0" cellpadding="0">  	<tr>    <td width="100%"><a href="{shoutrow.U_MINI_POST}"><img src="{shoutrow.MINI_POST_IMG}" width="12" height="9" alt="{shoutrow.L_MINI_POST_ALT}" title="{shoutrow.L_MINI_POST_ALT}" border="0" /></a><span class="postdetails">{L_POSTED}: {shoutrow.TIME}</span></td>    <td valign="top" align="right" nowrap="nowrap">{shoutrow.QUOTE_IMG}{shoutrow.EDIT_IMG}{shoutrow.DELETE_IMG}{shoutrow.IP_IMG}</td></form>  	</tr>  	<tr>     <td colspan="2"><hr/></td>  	</tr>  	<tr>    <td colspan="2"><span class="postbody">{shoutrow.SHOUT}{shoutrow.SIGNATURE}</span></td>  	</tr>  	</table>  </td>	</tr>	<tr>   <td class="spaceRow" colspan="2" height="1"><img src="images/spacer.gif" alt="" width="1" height="1" /></td>	</tr>	<!-- END shoutrow --></table>  <table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">	<tr>    <td align="left" valign="top"><span class="gensmall">{S_TIMEZONE}</span></td>   <td align="right" valign="bottom" class="gensmall"> <span class="nav">	{PAGINATION}</span></td>	</tr></table>

shoutbox_view_body.tpl:
<HEAD><META http-equiv="refresh" content="120;url={U_SHOUTBOX_VIEW}?auto_refresh=1"><link rel="stylesheet" href="templates/{T_NAME}/{T_HEAD_STYLESHEET}" type="text/css"></HEAD><body bgcolor="{T_BODY_BGCOLOR}" text="{T_BODY_TEXT}" link="{T_BODY_LINK}" vlink="{T_BODY_VLINK}"> <table width="100%" height="100%" cellpadding="0" cellspacing="1" border="0" class="forumline"><!-- BEGIN shoutrow --><tr>	<td class="{shoutrow.ROW_CLASS}" width="100%" heigth="100%">   <table border="0"; cellspacing="0" cellpadding="0" width="100%">     <tr>       <td align="right" width="100%"><span class="gensmall">{shoutrow.TIME}<br />	<b>{shoutrow.USERNAME}</b></span></td>     </tr>     <tr>       <td align="left" width="100%"><span class="gensmall">{shoutrow.SHOUT}<br/></span></td>     </tr>          </table>	</td></tr><!-- END shoutrow --></table></body>

These are all located in my templates/"yourtemplate" folder...


Peace

Share this post


Link to post
Share on other sites

you completely posted all your templates you didn't post the actual php script. maybe you should post it you wish so that he may have an idea or learn how you did it.

Share this post


Link to post
Share on other sites

Wow... I forgot I had posted this. Well thanks for the amazing response. Beeseven. That simple script is exactly what I'm looking for but I'm kind of a bit weirded out by the layout. Mobious, do I need to set anything up on my Xisto host in order to use yours? You say you'll edit the template for anyone who doesnt know php..? Sounds great. But if there is anything I need to set up on the host before I can use it I need to know, sorry I'm a bit of a newbie to php and MySQL.Thanks, in advance of it all going down smoothly.

Share this post


Link to post
Share on other sites

you completely posted all your templates you didn't post the actual php script. maybe you should post it you wish so that he may have an idea or learn how you did it.

56427[/snapback]


True... I'm sorry lol but here's the real php file

Shoutbox.php:

<?php/*************************************************************************** *                               shoutbox.php *                            ------------------- *   begin                :  Feb, 2003 *   author               : Niels Chr. Denmark <ncr@db9.dk> (http://mods.db9.dk) * * version 1.0.3 * * History: *   0.9.0. - initial BETA *   0.9.1. - header added *   0.9.2. - shout can now be submitted by hitting enter *   0.9.3. - now support view back in time, + maximized view *   0.9.4. - now support preview in the maximized version *   0.9.5. - corrected currupted message if special combination *   0.9.6. - guest can't shout *   0.9.7. - shoutbox.php no longer support maximazed versin, instead sepperate file is offered *   1.0.0. - removed the DB stylesheet information, to speed up page load *   1.0.1. - corrected that guests username is stored correctly,when submitting a shout *   1.0.2. - corrected a bug regarding flood control *   1.0.3. - now displaying flood error more nicely, when shoutbox is inside a frame/iframe * * a fully phpBB2 integrated shoutbox * ***************************************************************************//*************************************************************************** * *   This program is free software; you can redistribute it and/or modify *   it under the terms of the GNU General Public License as published by *   the Free Software Foundation; either version 2 of the License, or *   (at your option) any later version. * ***************************************************************************/define('IN_PHPBB', true);$phpbb_root_path = './';include($phpbb_root_path . 'extension.inc');include($phpbb_root_path . 'common.'.$phpEx);include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_shoutbox.' . $phpEx);include($phpbb_root_path . 'includes/bbcode.'.$phpEx);define ('NUM_SHOUT', 20);//// Start session management//$userdata = session_pagestart($user_ip, PAGE_SHOUTBOX_MAX);init_userprefs($userdata);//// End session management//// // Start auth check // switch ($userdata['user_level']) {    case ADMIN :    case MOD :   $is_auth['auth_mod'] = 1;    default:          $is_auth['auth_read'] = 1;          $is_auth['auth_view'] = 1;          if ($userdata['user_id']==ANONYMOUS)          {             $is_auth['auth_delete'] = 0;             $is_auth['auth_post'] = 1;          } else          {             $is_auth['auth_delete'] = 1;             $is_auth['auth_post'] = 1;          } } if( !$is_auth['auth_read'] ) {    message_die(GENERAL_MESSAGE, $lang['Not_Authorised']); } // // End auth check //$refresh = (isset($HTTP_POST_VARS['auto_refresh']) || isset($HTTP_POST_VARS['refresh'])) ? 1 : 0;$submit = (isset($HTTP_POST_VARS['shout']) && isset($HTTP_POST_VARS['message'])) ? 1 : 0;//// Set toggles for various options//if ( !$board_config['allow_html'] ){	$html_on = 0;}else{	$html_on = ( $submit || $refresh || preview) ? ( ( !empty($HTTP_POST_VARS['disable_html']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_html'] : $userdata['user_allowhtml'] );}if ( !$board_config['allow_bbcode'] ){	$bbcode_on = 0;}else{	$bbcode_on = ( $submit || $refresh || preview) ? ( ( !empty($HTTP_POST_VARS['disable_bbcode']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_bbcode'] : $userdata['user_allowbbcode'] );}if ( !$board_config['allow_smilies'] ){	$smilies_on = 0;}else{	$smilies_on = ( $submit || $refresh || preview) ? ( ( !empty($HTTP_POST_VARS['disable_smilies']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_smilies'] : $userdata['user_allowsmile'] );}if ($refresh){	$message = ( !empty($HTTP_POST_VARS['message']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['message']))) : '';	if (!empty($message))	{  $template->assign_var('MESSAGE',$message);	}} elseif ($submit || isset($HTTP_POST_VARS['message'])){	$current_time = time();	//	// Flood control	//  $where_sql = ( $userdata['user_id'] == ANONYMOUS ) ? "shout_ip = '$user_ip'" : 'shout_user_id = ' . $userdata['user_id'];  $sql = "SELECT MAX(shout_session_time) AS last_post_time  FROM " . SHOUTBOX_TABLE . "  WHERE $where_sql";	if ( $result = $db->sql_query($sql) )	{  if ( $row = $db->sql_fetchrow($result) )  {  	if ( $row['last_post_time'] > 0 && ( $current_time - $row['last_post_time'] ) < $board_config['flood_interval'] )  	{    $error = true;    $error_msg .= ( !empty($error_msg) ) ? '<br />' . $lang['Flood_Error'] : $lang['Flood_Error'];  	}  }	}	// Check username	if ( !empty($username) )	{  $username = htmlspecialchars(trim(strip_tags($username)));  if ( !$userdata['session_logged_in'] || ( $userdata['session_logged_in'] && $username != $userdata['username'] ) )  {  	include($phpbb_root_path . 'includes/functions_validate.'.$phpEx);  	$result = validate_username($username);  	if ( $result['error'] )  	{    $error_msg .= ( !empty($error_msg) ) ? '<br />' . $result['error_msg'] : $result['error_msg'];  	}  }	}	$message = (isset($HTTP_POST_VARS['message'])) ? trim($HTTP_POST_VARS['message']) : '';	// insert shout !	if (!empty($message) && $is_auth['auth_post'] && !$error)	{  include_once($phpbb_root_path . 'includes/functions_post.'.$phpEx);  $bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : '';  $message = prepare_message(trim($message), $html_on, $bbcode_on, $smilies_on, $bbcode_uid);  $sql = "INSERT INTO " . SHOUTBOX_TABLE. " (shout_text, shout_session_time, shout_user_id, shout_ip, shout_username, shout_bbcode_uid,enable_bbcode,enable_html,enable_smilies)     VALUES ('$message', '".time()."', '".$userdata['user_id']."', '$user_ip', '".$username."', '".$bbcode_uid."',$bbcode_on,$html_on,$smilies_on)";  if (!$result = $db->sql_query($sql))   {  	message_die(GENERAL_ERROR, 'Error inserting shout.', '', __LINE__, __FILE__, $sql);  }  // auto prune  if ($board_config['prune_shouts'])  {  	$sql = "DELETE FROM " . SHOUTBOX_TABLE. " WHERE shout_session_time<=".(time()-86400*$board_config['prune_shouts']);  	if (!$result = $db->sql_query($sql))   	{    message_die(GENERAL_ERROR, 'Error autoprune shouts.', '', __LINE__, __FILE__, $sql);  	}  }	}} // see if we need offsetif ((isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['start'])) && !$submit){	$start=(isset($HTTP_POST_VARS['start'])) ? intval($HTTP_POST_VARS['start']) : intval($HTTP_GET_VARS['start']);} else $start=0;	//	// Show simple shoutbox	//	if ( $is_auth['auth_post'] )	{  $template->assign_block_vars('switch_auth_post', array());	}		else	{	  $template->assign_block_vars('switch_auth_no_post', array());	}	$template->set_filenames(array(       	'body' => 'shoutbox_body.tpl'));$template->assign_vars(array( 	'U_SHOUTBOX' => append_sid("shoutbox.$phpEx?start=$start"),	'U_SHOUTBOX_VIEW' => append_sid("shoutbox_view.$phpEx?start=$start"),	'T_HEAD_STYLESHEET' => $theme['head_stylesheet'],	'T_NAME' => $theme['template_name'],	'L_SHOUTBOX' => $lang['Shoutbox'],	'L_SHOUT_PREVIEW' => $lang['Preview'],	'L_SHOUT_SUBMIT' => $lang['Go'],	'L_SHOUT_TEXT' => $lang['Shout_text'],	'L_SHOUT_REFRESH' => $lang['Shout_refresh'],	'SHOUT_VIEW_SIZE' => ($max) ? $max : 0,	'S_HIDDEN_FIELDS' => $s_hidden_fields	));	if( $error_msg != '' )	{  $template->set_filenames(array(  	'reg_header' => 'error_body.tpl')  );  $template->assign_vars(array(  	'ERROR_MESSAGE' => $error_msg)  );  $template->assign_var_from_handle('ERROR_BOX', 'reg_header');  $message = ( !empty($HTTP_POST_VARS['message']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['message']))) : '';  $template->assign_var('MESSAGE',$message);	}$template->pparse('body'); ?>

Shoutbox_max.php:
<?php

/***************************************************************************

*                               shoutbox_max.php

*                            -------------------

*   begin                :  Feb, 2003

*   author               : Niels Chr. Denmark <ncr@db9.dk> (http://mods.db9.dk)

*

* a fully phpBB2 integrated shoutbox

* version 1.0.0.

*

* History:

*   0.9.0. - initial BETA

*   0.9.1. - header added

*   0.9.2. - shout can now be submitted by hitting enter

*   0.9.3. - now support view back in time, + maximized view

*   0.9.4. - now support preview in the maximized version

*   0.9.5. - corrected currupted message if special combination

*   0.9.6. - guest can't shout

*   0.9.7. - max only version

*   0.9.8. - improved some permission control

*   0.9.9. - improved delete control

*   0.9.10. - support auto prune

*   0.9.11. - redirect corrected

*   0.9.12. - guests should not have ranks assigned

*   0.9.13. - corrected guests names

*   1.0.0. - corrected a bug regarding flood control

*

***************************************************************************/

 

/***************************************************************************

*

*   This program is free software; you can redistribute it and/or modify

*   it under the terms of the GNU General Public License as published by

*   the Free Software Foundation; either version 2 of the License, or

*   (at your option) any later version.

*

***************************************************************************/

 

define('IN_PHPBB', true);

$phpbb_root_path = './';

require_once($phpbb_root_path . 'extension.inc');

require_once($phpbb_root_path . 'common.'.$phpEx);

include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_shoutbox.' . $phpEx);

require_once($phpbb_root_path . 'includes/bbcode.'.$phpEx);

 

define ('NUM_SHOUT', 20);

//

// Start session management

//

$userdata = session_pagestart($user_ip, PAGE_SHOUTBOX_MAX);

init_userprefs($userdata);

//

// End session management

//

 

//

// Start auth check

//

switch ($userdata['user_level'])

{

  case ADMIN :

  case MOD :   $is_auth['auth_mod'] = 1;

  default:

        $is_auth['auth_read'] = 1;

        $is_auth['auth_view'] = 1;

        if ($userdata['user_id']==ANONYMOUS)

        {

           $is_auth['auth_delete'] = 0;

           $is_auth['auth_post'] = 1;

        } else

        {

           $is_auth['auth_delete'] = 1;

           $is_auth['auth_post'] = 1;

        }

}

 

if( !$is_auth['auth_read'] )

{

  message_die(GENERAL_MESSAGE, $lang['Not_Authorised']);

}

 

//

// End auth check

//

$forum_id=PAGE_SHOUTBOX_MAX;

$refresh = (isset($HTTP_POST_VARS['auto_refresh']) || isset($HTTP_POST_VARS['refresh'])) ? 1 : 0;

$preview = (isset($HTTP_POST_VARS['preview'])) ? 1 : 0;

$submit = (isset($HTTP_POST_VARS['shout']) && isset($HTTP_POST_VARS['message'])) ? 1 : 0;

if ( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) )

{

$mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];

}

else

{

$mode = '';

}

 

//

// Set toggles for various options

//

if ( !$board_config['allow_html'] )

{

$html_on = 0;

}

else

{

$html_on = ( $submit || $refresh || preview) ? ( ( !empty($HTTP_POST_VARS['disable_html']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_html'] : $userdata['user_allowhtml'] );

}

if ( !$board_config['allow_bbcode'] )

{

$bbcode_on = 0;

}

else

{

$bbcode_on = ( $submit || $refresh || preview) ? ( ( !empty($HTTP_POST_VARS['disable_bbcode']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_bbcode'] : $userdata['user_allowbbcode'] );

}

 

if ( !$board_config['allow_smilies'] )

{

$smilies_on = 0;

}

else

{

$smilies_on = ( $submit || $refresh || preview) ? ( ( !empty($HTTP_POST_VARS['disable_smilies']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_smilies'] : $userdata['user_allowsmile'] );

}

if( !$userdata['session_logged_in'] || ( $mode == 'editpost' && $post_info['poster_id'] == ANONYMOUS ) )

{

$template->assign_block_vars('switch_username_select', array());

}

$username = ( !empty($HTTP_POST_VARS['username']) ) ? $HTTP_POST_VARS['username'] : '';

// Check username

if ( !empty($username) )

{

$username = htmlspecialchars(trim(strip_tags($username)));

if ( !$userdata['session_logged_in'])

{

 require_once($phpbb_root_path . 'includes/functions_validate.'.$phpEx);

 $result = validate_username($username);

 if ( $result['error'] )

 {

  $error = true;

  $error_msg .= ( !empty($error_msg) ) ? '<br />' . $result['error_msg'] : $result['error_msg'];

 }

}

}

 

if ($refresh || $preview)

{

$message = ( !empty($HTTP_POST_VARS['message']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['message']))) : '';

if (!empty($message))

{

 if ($preview)

 {

  require_once($phpbb_root_path . 'includes/functions_post.'.$phpEx);

  $orig_word = array();

  $replacement_word = array();

  obtain_word_list($orig_word, $replacement_word);

  $bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : '';

  $preview_message = stripslashes(prepare_message(addslashes(unprepare_message($message)), $html_on, $bbcode_on, $smilies_on, $bbcode_uid));

 

  if( $bbcode_on )

  {

   $preview_message = bbencode_second_pass($preview_message, $bbcode_uid);

  }

  if( !empty($orig_word) )

  {

   $preview_message = ( !empty($preview_message) ) ? preg_replace($orig_word, $replacement_word, $preview_message) : '';

  }

  $preview_message = make_clickable($preview_message);

  if( $smilies_on )

  {

   $preview_message = smilies_pass($preview_message);

  }

  $preview_message = str_replace("\n", '<br />', $preview_message);

  $template->set_filenames(array(

   'preview' => 'posting_preview.tpl')

  );

  $template->assign_vars(array(

   'USERNAME' => $username,

   'POST_DATE' => create_date($board_config['default_dateformat'], time(), $board_config['board_timezone']),

   'MESSAGE' => $preview_message,

   'L_POSTED' => $lang['Posted'],

   'L_PREVIEW' => $lang['Preview'])

  );

  $template->assign_var_from_handle('POST_PREVIEW_BOX', 'preview');

 }

}

} else

if ($submit || isset($HTTP_POST_VARS['message']))

{

$current_time = time();

//

// Flood control

//

 $where_sql = ( $userdata['user_id'] == ANONYMOUS ) ? "shout_ip = '$user_ip'" : 'shout_user_id = ' . $userdata['user_id'];

 $sql = "SELECT MAX(shout_session_time) AS last_post_time

 FROM " . SHOUTBOX_TABLE . " WHERE $where_sql";

if ( $result = $db->sql_query($sql) )

{

 if ( $row = $db->sql_fetchrow($result) )

 {

  if ( $row['last_post_time'] > 0 && ( $current_time - $row['last_post_time'] ) < $board_config['flood_interval'] )

  {

   $error = true;

   $error_msg .= ( !empty($error_msg) ) ? '<br />' . $lang['Flood_Error'] : $lang['Flood_Error'];

//    message_die(GENERAL_MESSAGE, $lang['Flood_Error']);

  }

 }

}

 

$message = (isset($HTTP_POST_VARS['message'])) ? trim($HTTP_POST_VARS['message']) : '';

// insert shout !

if (!empty($message) && $is_auth['auth_post'] && !$error)

{

 require_once($phpbb_root_path . 'includes/functions_post.'.$phpEx);

 $bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : '';

 $message = prepare_message(trim($message), $html_on, $bbcode_on, $smilies_on, $bbcode_uid);

 $sql = "INSERT INTO " . SHOUTBOX_TABLE. " (shout_text, shout_session_time, shout_user_id, shout_ip, shout_username, shout_bbcode_uid,enable_bbcode,enable_html,enable_smilies)

   VALUES ('$message', '".time()."', '".$userdata['user_id']."', '$user_ip', '".$username."', '".$bbcode_uid."',$bbcode_on,$html_on,$smilies_on)";

 if (!$result = $db->sql_query($sql))

 {

  message_die(GENERAL_ERROR, 'Error inserting shout.', '', __LINE__, __FILE__, $sql);

 }

 // auto prune

 if ($board_config['prune_shouts'])

 {

  $sql = "DELETE FROM " . SHOUTBOX_TABLE. " WHERE shout_session_time<=".(time()-86400*$board_config['prune_shouts']);

  if (!$result = $db->sql_query($sql))

  {

   message_die(GENERAL_ERROR, 'Error autoprune shouts.', '', __LINE__, __FILE__, $sql);

  }

 }

 $message='';

 $username='';

}

} else

if ($mode=='delete' || $mode=='censor')

{

// make shout inavtive

if ( isset($HTTP_GET_VARS[POST_POST_URL]) || isset($HTTP_POST_VARS[POST_POST_URL]) )

{

 $post_id = (isset($HTTP_POST_VARS[POST_POST_URL])) ? intval($HTTP_POST_VARS[POST_POST_URL]) : intval($HTTP_GET_VARS[POST_POST_URL]);

}

else

{

 message_die(GENERAL_ERROR, 'Error no shout id specifyed for delete/censor.', '', __LINE__, __FILE__);

}

$sql = "SELECT s.shout_user_id FROM " . SHOUTBOX_TABLE . " s WHERE s.shout_id='$post_id'";

if ( !($result = $db->sql_query($sql)) )

{

 message_die(GENERAL_ERROR, 'Could not get shoutbox information', '', __LINE__, __FILE__, $sql);

}

$shout_identifyer = $db->sql_fetchrow($result);

$user_id = $shout_identifyer['shout_user_id'];

 

if ( (($userdata['user_id'] == $user_id && $is_auth['auth_delete']) || $is_auth['auth_mod']) && $mode=='censor')

{

 $sql = "UPDATE ".SHOUTBOX_TABLE." SET shout_active='".$userdata['user_id']."' WHERE shout_id='$post_id'";

 if (!$result = $db->sql_query($sql))

 {

  message_die(GENERAL_ERROR, 'Error censor shout.', '', __LINE__, __FILE__, $sql);

 }

} else

if ( $is_auth['auth_mod'] && $mode=='delete')

{

 $sql = "DELETE FROM ".SHOUTBOX_TABLE." WHERE shout_id='$post_id'";

 if (!$result = $db->sql_query($sql))

 {

  message_die(GENERAL_ERROR, 'Error removing shout.', '', __LINE__, __FILE__, $sql);

 }

} else

message_die(GENERAL_MESSAGE, 'Not allowed.', '', __LINE__, __FILE__);

} else

if ($mode=='ip')

{

// show the ip

if ( !$is_auth['auth_mod'])

{

 message_die(GENERAL_MESSAGE, 'Not allowed.', '', __LINE__, __FILE__);

}

if ( isset($HTTP_GET_VARS[POST_POST_URL]) || isset($HTTP_POST_VARS[POST_POST_URL]) )

{

 $post_id = (isset($HTTP_POST_VARS[POST_POST_URL])) ? intval($HTTP_POST_VARS[POST_POST_URL]) : intval($HTTP_GET_VARS[POST_POST_URL]);

}

else

{

 message_die(GENERAL_ERROR, 'Error no shout id specifyed for show ip', '', __LINE__, __FILE__);

}

$sql = "SELECT s.shout_user_id, shout_username, shout_ip FROM " . SHOUTBOX_TABLE . " s WHERE s.shout_id='$post_id'";

if ( !($result = $db->sql_query($sql)) )

{

 message_die(GENERAL_ERROR, 'Could not get shoutbox information', '', __LINE__, __FILE__, $sql);

}

$shout_identifyer = $db->sql_fetchrow($result);

$poster_id = $shout_identifyer['shout_user_id'];

$rdns_ip_num = ( isset($HTTP_GET_VARS['rdns']) ) ? $HTTP_GET_VARS['rdns'] : "";

 

$ip_this_post = decode_ip($shout_identifyer['shout_ip']);

$ip_this_post = ( $rdns_ip_num == $ip_this_post ) ? gethostbyaddr($ip_this_post) : $ip_this_post;

require_once($phpbb_root_path . 'includes/page_header.'.$phpEx);

 

//

// Set template files

//

$template->set_filenames(array(

 'viewip' => 'modcp_viewip.tpl')

);

$template->assign_vars(array(

 'L_IP_INFO' => $lang['IP_info'],

 'L_THIS_POST_IP' => $lang['This_posts_IP'],

 'L_OTHER_IPS' => $lang['Other_IP_this_user'],

 'L_OTHER_USERS' => $lang['Users_this_IP'],

 'L_LOOKUP_IP' => $lang['Lookup_IP'],

 'L_SEARCH' => $lang['Search'],

 'SEARCH_IMG' => $images['icon_search'],

 'IP' => $ip_this_post,

 'U_LOOKUP_IP' => append_sid("shoutbox_max.$phpEx?mode=ip&" . POST_POST_URL . "=$post_id&rdns=" . $ip_this_post))

 );

 

//

// Get other IP's this user has posted under

//

$sql = "SELECT shout_ip, COUNT(*) AS postings

 FROM " . SHOUTBOX_TABLE . "

 WHERE shout_user_id = $poster_id

 GROUP BY shout_ip

 ORDER BY " . (( SQL_LAYER == 'msaccess' ) ? 'COUNT(*)' : 'postings' ) . " DESC";

if ( !($result = $db->sql_query($sql)) )

{

 message_die(GENERAL_ERROR, 'Could not get IP information for this user', '', __LINE__, __FILE__, $sql);

}

if ( $row = $db->sql_fetchrow($result) )

{

 $i = 0;

 do

 {

   if ( $row['shout_ip'] == $post_row['shout_ip'] )

   {

    $template->assign_vars(array(

     'POSTS' => $row['postings'] . ' ' . ( ( $row['postings'] == 1 ) ? $lang['Post'] : $lang['Posts'] ))

    );

    continue;

   }

 

   $ip = decode_ip($row['shout_ip']);

   $ip = ( $rdns_ip_num == $row['shout_ip'] || $rdns_ip_num == 'all') ? gethostbyaddr($ip) : $ip;

 

   $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];

   $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

 

   $template->assign_block_vars('iprow', array(

    'ROW_COLOR' => '#' . $row_color,

    'ROW_CLASS' => $row_class,

    'IP' => $ip,

    'POSTS' => $row['postings'] . ' ' . ( ( $row['postings'] == 1 ) ? $lang['Post'] : $lang['Posts'] ),

 

    'U_LOOKUP_IP' => append_sid("shoutbox_max.$phpEx?mode=ip&" . POST_POST_URL . "=$post_id&rdns=" . $row['shout_ip']))

   );

 

   $i++;

  }

  while ( $row = $db->sql_fetchrow($result) );

 }

 

 //

 // Get other users who've posted under this IP

 //

 $sql = "SELECT u.user_id, u.username, COUNT(*) as postings

  FROM " . USERS_TABLE ." u, " . POSTS_TABLE . " p

  WHERE p.poster_id = u.user_id

   AND p.poster_ip = '" . $shout_identifyer['shout_ip'] . "'

  GROUP BY u.user_id, u.username

  ORDER BY " . (( SQL_LAYER == 'msaccess' ) ? 'COUNT(*)' : 'postings' ) . " DESC";

 

 if ( !($result = $db->sql_query($sql)) )

 {

  message_die(GENERAL_ERROR, 'Could not get posters information based on IP', '', __LINE__, __FILE__, $sql);

 }

 

 if ( $row = $db->sql_fetchrow($result) )

 {

  $i = 0;

  do

  {

   $id = $row['user_id'];

//    $username = ( $id == ANONYMOUS ) ? $lang['Guest'] : $row['username'];

   $shout_username = ( $id == ANONYMOUS && $row['username'] == '' ) ? $lang['Guest'] : $row['username'];

 

   $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];

   $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

 

   $template->assign_block_vars('userrow', array(

    'ROW_COLOR' => '#' . $row_color,

    'ROW_CLASS' => $row_class,

    'SHOUT_USERNAME' => $shout_username,

    'POSTS' => $row['postings'] . ' ' . ( ( $row['postings'] == 1 ) ? $lang['Post'] : $lang['Posts'] ),

    'L_SEARCH_POSTS' => sprintf($lang['Search_user_posts'], $shout_username),

 

    'U_PROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$id"),

    'U_SEARCHPOSTS' => append_sid("search.$phpEx?search_author=" . urlencode($shout_username) . "&showresults=topics"))

   );

 

   $i++;

  }

  while ( $row = $db->sql_fetchrow($result) );

 }

 

 

 $template->pparse('viewip');

require_once($phpbb_root_path . 'includes/page_tail.'.$phpEx);

exit;

}

 

//

// display the defult page

//

 

// see if we need offset

if ((isset($HTTP_POST_VARS['start']) || isset($HTTP_GET_VARS['start'])) && !$submit)

{

$start=(isset($HTTP_POST_VARS['start'])) ? intval($HTTP_POST_VARS['start']) : intval($HTTP_GET_VARS['start']);

}

else

{

$start=0;

}

 

require_once($phpbb_root_path . 'includes/functions_post.'.$phpEx);

require_once($phpbb_root_path . 'includes/page_header.'.$phpEx);

 

//

// Was a highlight request part of the URI?

//

$highlight_match = $highlight = '';

if (isset($HTTP_GET_VARS['highlight']))

{

  // Split words and phrases

$highlight = trim(strip_tags(htmlspecialchars($HTTP_GET_VARS['highlight'])));

  $words = explode(' ', $highlight);

 

  for($i = 0; $i < count($words); $i++)

  {

     if ( trim($words[$i]) != '' )

     {

        $highlight_match .= (($highlight_match != '') ? '|' : '') . str_replace('*', '\w*', phpbb_preg_quote($words[$i], '#'));

     }

  }

  unset($words);

  $highlight = urlencode($highlight);

}

 

 

$sql = "SELECT *

FROM " . RANKS_TABLE . "

ORDER BY rank_special, rank_min";

if ( !($result = $db->sql_query($sql)) )

{

message_die(GENERAL_ERROR, "Could not obtain ranks information.", '', __LINE__, __FILE__, $sql);

}

 

$ranksrow = array();

while ( $row = $db->sql_fetchrow($result) )

{

$ranksrow[] = $row;

}

$db->sql_freeresult($result);

 

//

// Define censored word matches

//

$orig_word = array();

$replacement_word = array();

obtain_word_list($orig_word, $replacement_word);

 

// get statistics

$sql = "SELECT COUNT(*) as total FROM " . SHOUTBOX_TABLE;

if ( !($result = $db->sql_query($sql)) )

{

 message_die(GENERAL_ERROR, 'Could not get shoutbox stat information', '', __LINE__, __FILE__, $sql);

}

$total_shouts = $db->sql_fetchrow($result);

$total_shouts = $total_shouts['total'];

// parse post permission

if ($is_auth['auth_post'])

{

 $template->set_filenames(array('body' => 'shoutbox_max_body.tpl'));

} else

{

 $template->set_filenames(array('body' => 'shoutbox_max_guest_body.tpl'));

}

// Generate pagination for shoutbox view

$pagination = ( $highlight_match ) ? generate_pagination("shoutbox_max.$phpEx?highlight=".$highlight, $total_shouts, $board_config['posts_per_page'], $start) : generate_pagination("shoutbox_max.$phpEx?dummy=1", $total_shouts, $board_config['posts_per_page'], $start);

 

// Generate smilies listing for page output

generate_smilies('inline', PAGE_SHOUTBOX_MAX);

 

//

// Smilies toggle selection

//

if ( $board_config['allow_smilies'] )

{

 $smilies_status = $lang['Smilies_are_ON'];

 $template->assign_block_vars('switch_smilies_checkbox', array());

}

else

{

 $smilies_status = $lang['Smilies_are_OFF'];

}

//

// HTML toggle selection

//

if ( $board_config['allow_html'] )

{

 $html_status = $lang['HTML_is_ON'];

 $template->assign_block_vars('switch_html_checkbox', array());

}

else

{

 $html_status = $lang['HTML_is_OFF'];

}

//

// BBCode toggle selection

//

if ( $board_config['allow_bbcode'] )

{

 $bbcode_status = $lang['BBCode_is_ON'];

 $template->assign_block_vars('switch_bbcode_checkbox', array());

}

else

{

 $bbcode_status = $lang['BBCode_is_OFF'];

}

 

//

// display the shoutbox

//

$sql = "SELECT s.*, u.* FROM " . SHOUTBOX_TABLE . " s, ".USERS_TABLE." u

 WHERE s.shout_user_id=u.user_id ORDER BY s.shout_session_time DESC LIMIT $start, ".$board_config['posts_per_page'];

if ( !($result = $db->sql_query($sql)) )

{

 message_die(GENERAL_ERROR, 'Could not get shoutbox information', '', __LINE__, __FILE__, $sql);

}

 $all_ranks = array();

 init_ranks($all_ranks);

 

 while ($shout_row = $db->sql_fetchrow($result))

 {

  $i++;

  $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];

  $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];

  $user_id = $shout_row['shout_user_id'];

  $shout_username = ( $user_id == ANONYMOUS ) ? (( $shout_row['shout_username'] == '' ) ? $lang['Guest'] : $shout_row['shout_username'] ) : "<a href='".append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=".$shout_row['shout_user_id'])."' target='_top'>".$shout_row['username']."</a>";

 

  $user_profile = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id");

  $user_posts = ( $shout_row['user_id'] != ANONYMOUS ) ? $lang['Posts'] . ': ' . $shout_row['user_posts'] : '';

  $user_from = ( $shout_row['user_from'] && $shout_row['user_id'] != ANONYMOUS ) ? $lang['Location'] . ': ' . $shout_row['user_from'] : '';

  $user_joined = ( $shout_row['user_id'] != ANONYMOUS ) ? $lang['Joined'] . ': ' . create_date($lang['DATE_FORMAT'], $shout_row['user_regdate'], $board_config['board_timezone']) : '';

  if ( $shout_row['user_avatar_type'] && $user_id != ANONYMOUS && $shout_row['user_allowavatar'] )

  {

   switch( $shout_row['user_avatar_type'] )

   {

    case USER_AVATAR_UPLOAD:

     $user_avatar = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $shout_row['user_avatar'] . '" alt="" border="0" />' : '';

     break;

    case USER_AVATAR_REMOTE:

     $user_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $shout_row['user_avatar'] . '" alt="" border="0" />' : '';

     break;

    case USER_AVATAR_GALLERY:

     $user_avatar = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $shout_row['user_avatar'] . '" alt="" border="0" />' : '';

     break;

   }

   $user_avatar = ($shout_row['user_avatar_url']) ? '<a href="'.$shout_row['user_avatar_url'].'">'.$user_avatar.'</a>' : $user_avatar;

  } else $user_avatar='';

  $shout = (! $shout_row['shout_active']) ? $shout_row['shout_text'] : $lang['Shout_censor'].(($is_auth['auth_mod']) ? '<br/><hr/><br/>'.$shout_row['shout_text'] : '');

  $user_sig = ( $shout_row['enable_sig'] && $shout_row['user_sig'] != '' && $board_config['allow_sig'] ) ? $shout_row['user_sig'] : '';

  $user_sig_bbcode_uid = $shout_row['user_sig_bbcode_uid'];

 

 

  $user_rank = '';

  $rank_image = '';

  if ( $shout_row['user_rank'])

  {

   for($j = 0; $j < count($ranksrow); $j++)

   {

    if ( $shout_row['user_rank'] == $ranksrow[$j]['rank_id'] && $ranksrow[$j]['rank_special'] )

    {

     $rank_temp = get_user_rank($shout_row);

     $user_rank = $rank_temp['rank_title'];

     //$user_rank = ($shout_row['user_id'] != ANONYMOUS) ? $ranksrow[$j]['rank_title'] : '';

     $rank_image = ( $ranksrow[$j]['rank_image'] && $shout_row['user_id'] != ANONYMOUS) ? '<img src="' . $ranksrow[$j]['rank_image'] . '" alt="' . $user_rank . '" title="' . $user_rank . '" border="0" /><br />' : '';

    }

   }

  } else

  {

   for($j = 0; $j < count($ranksrow); $j++)

   {

    if ( $shout_row['user_posts'] >= $ranksrow[$j]['rank_min'] && !$ranksrow[$j]['rank_special'] )

    {

     $rank_temp = get_user_rank($shout_row);

     $user_rank = $rank_temp['rank_title'];

//      $user_rank = ($shout_row['user_id'] != ANONYMOUS) ? $ranksrow[$j]['rank_title'] : '';

     $rank_image = ( $ranksrow[$j]['rank_image'] && $shout_row['user_id'] != ANONYMOUS) ? '<img src="' . $ranksrow[$j]['rank_image'] . '" alt="' . $user_rank . '" title="' . $user_rank . '" border="0" /><br />' : '';

    }

   }

  }

 

  if ( $user_sig != '' )

  {

   $user_sig = make_clickable($user_sig);

  }

  $message = make_clickable($message);

 

//

   // Highlight active words (primarily for search)

   //

   if ($highlight_match)

   {

      $shout = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace('#\b(" . $highlight_match . ")\b#i', '<span style=\"color:#" . $theme['fontcolor3'] . "\"><b>\\\\1</b></span>', '\\0')", '>' . $shout . '<'), 1, -1));

   }

//

// Replace naughty words

//

if ( count($orig_word) )

{

 if ( $user_sig != '' )

 {

  $user_sig = preg_replace($orig_word, $replacement_word, $user_sig);

 }

 $shout = preg_replace($orig_word, $replacement_word, $shout);

}

 

  if ( $smilies_on && $shout != '' && $shout_row['enable_smilies'])

  {

   $shout = smilies_pass($shout);

  }

  $shout = bbencode_second_pass($shout,$shout_row['shout_bbcode_uid']);

 

if ( $is_auth['auth_mod'] && $is_auth['auth_delete'])

{

 $temp_url = append_sid("shoutbox_max.$phpEx?mode=ip&" . POST_POST_URL . "=" . $shout_row['shout_id']);

 $ip_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_ip'] . '" alt="' . $lang['View_IP'] . '" title="' . $lang['View_IP'] . '" border="0" /></a>';

 $ip = '<a href="' . $temp_url . '">' . $lang['View_IP'] . '</a>';

 

 $temp_url = append_sid("shoutbox_max.$phpEx?mode=delete&" . POST_POST_URL . "=" . $shout_row['shout_id']);

 $delshout_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_delpost'] . '" alt="' . $lang['Delete_post'] . '" title="' . $lang['Delete_post'] . '" border="0" /></a> ';

 $delshout = '<a href="' . $temp_url . '">' . $lang['Delete_post'] . '</a>';

 

 $temp_url = append_sid("shoutbox_max.$phpEx?mode=censor&" . POST_POST_URL . "=" . $shout_row['shout_id']);

 $censorshout_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_censor'] . '" alt="' . $lang['Censor'] . '" title="' . $lang['Censor'] . '" border="0" /></a> ';

 $censorshout = '<a href="' . $temp_url . '">' . $lang['Delete_post'] . '</a>';

}

else

{

 $ip_img = '';

 $ip = '';

 

 if ( $userdata['user_id'] == $user_id && $is_auth['auth_delete'] )

 {

  $temp_url = append_sid("shoutbox_max.$phpEx?mode=censor&" . POST_POST_URL . "=" . $shout_row['shout_id']);

  $censorshout_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_censor'] . '" alt="' . $lang['Censor'] . '" title="' . $lang['Censor'] . '" border="0" /></a> ';

  $censorshout = '<a href="' . $temp_url . '">' . $lang['Delete_post'] . '</a>';

 }

 else

 {

  $delshout_img = '';

  $delshout = '';

  $censorshout_img = '';

  $censorshout = '';

 }

}

 $template->assign_block_vars('shoutrow', array(

  'ROW_COLOR' => '#' . $row_color,

  'ROW_CLASS' => $row_class,

  'SHOUT' => $shout,

  'TIME' => create_date($board_config['default_dateformat'], $shout_row['shout_session_time'], $board_config['board_timezone']),

  'SHOUT_USERNAME' => $shout_username,

  'U_VIEW_USER_PROFILE' => $user_profile,

  'USER_RANK' => $user_rank,

  'RANK_IMAGE' => $rank_image,

  'IP_IMG' => $ip_img,

  'IP' => $ip,

 

  'MINI_POST_IMG' => $images['icon_minipost'],

  'U_MINI_POST' => 'shoutbox_max.' . $phpEx . '?dummy=1&start=' . $start .'#'. $shout_row['shout_id'],

 

  'DELETE_IMG' => $delshout_img,

  'DELETE' => $delshout,

  'CENSOR_IMG' => $censorshout_img,

  'CENSOR' => $censorshout,

  'USER_JOINED' => $user_joined,

  'USER_POSTS' => $user_posts,

  'USER_FROM' => $user_from,

  'USER_AVATAR' => $user_avatar,

  'U_SHOUT_ID' => $shout_row['shout_id']

  ));

}

 

//

// Show post options

//

if ( $is_auth['auth_post'] )

{

 $template->assign_block_vars('switch_auth_post', array());

}

else

{

 $template->assign_block_vars('switch_auth_no_post', array());

}

 $template->assign_vars(array(

  'USERNAME' => $username,

  'PAGINATION' => $pagination,

  'NUMBER_OF_SHOUTS' => $total_shouts,

  'HTML_STATUS' => $html_status,

  'MESSAGE' => $message,

  'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="' . append_sid("faq.$phpEx?mode=bbcode") . '" target="_phpbbcode">', '</a>'),

 'L_SHOUTBOX_LOGIN' => $lang['Login_join'],

 'L_POSTED' => $lang['Posted'],

 'L_AUTHOR' => $lang['Author'],

 'L_MESSAGE' => $lang['Message'],

'U_SHOUTBOX' => append_sid("shoutbox_max.$phpEx?start=$start"),

'T_NAME' => $theme['template_name'],

'L_SHOUTBOX' => $lang['Shoutbox'],

'L_SHOUT_PREVIEW' => $lang['Preview'],

'L_SHOUT_SUBMIT' => $lang['Go'],

'L_SHOUT_TEXT' => $lang['Shout_text'],

'L_SHOUT_REFRESH' => $lang['Shout_refresh'],

'S_HIDDEN_FIELDS' => $s_hidden_fields,

 

'SMILIES_STATUS' => $smilies_status,

'L_BBCODE_B_HELP' => $lang['bbcode_b_help'],

'L_BBCODE_I_HELP' => $lang['bbcode_i_help'],

'L_BBCODE_U_HELP' => $lang['bbcode_u_help'],

'L_BBCODE_Q_HELP' => $lang['bbcode_q_help'],

'L_BBCODE_C_HELP' => $lang['bbcode_c_help'],

'L_BBCODE_L_HELP' => $lang['bbcode_l_help'],

'L_BBCODE_O_HELP' => $lang['bbcode_o_help'],

'L_BBCODE_P_HELP' => $lang['bbcode_p_help'],

'L_BBCODE_W_HELP' => $lang['bbcode_w_help'],

'L_BBCODE_A_HELP' => $lang['bbcode_a_help'],

'L_BBCODE_S_HELP' => $lang['bbcode_s_help'],

'L_BBCODE_F_HELP' => $lang['bbcode_f_help'],

'L_EMPTY_MESSAGE' => $lang['Empty_message'],

 

'L_FONT_COLOR' => $lang['Font_color'],

'L_COLOR_DEFAULT' => $lang['color_default'],

'L_COLOR_DARK_RED' => $lang['color_dark_red'],

'L_COLOR_RED' => $lang['color_red'],

'L_COLOR_ORANGE' => $lang['color_orange'],

'L_COLOR_BROWN' => $lang['color_brown'],

'L_COLOR_YELLOW' => $lang['color_yellow'],

'L_COLOR_GREEN' => $lang['color_green'],

'L_COLOR_OLIVE' => $lang['color_olive'],

'L_COLOR_CYAN' => $lang['color_cyan'],

'L_COLOR_BLUE' => $lang['color_blue'],

'L_COLOR_DARK_BLUE' => $lang['color_dark_blue'],

'L_COLOR_INDIGO' => $lang['c

Share this post


Link to post
Share on other sites

here's the code I use in mine.I DON'T KNOW IF THIS IS THE EASIEST CODE OUT THERE BUT IT MIGHT HELP. :D //FORMS PAGE / SHOUT BOX ENTRY<html><head><title>shoutbox</title><script><!--/* clears default values from input boxes */function clearText(thefield){if (thefield.defaultValue==thefield.value)thefield.value = ""}//--> </SCRIPT></head><body bgcolor="#B1BB96"><form action="goguest.php" method=post> <table border=0 style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0" width="89"><tr> <td width="112" align="left"> <p align="center"><font face="Trebuchet MS" size="1" color="#B9C49C"> <input type="text" name="name" onfocus=clearText(this) size=20 maxlength= 30 style="border-style:solid; border-width:1; font-family: Trebuchet MS; font-size:8pt; padding-left:4; padding-right:4; padding-top:1; padding-bottom:1; background-color:#B9C49C" value="your name"></font></td></tr><tr> <td width="112" align="left"> <p align="center"><font face="Trebuchet MS" size="1"> <input type="text" name="message" onfocus=clearText(this) size=20 maxlength= 100 style="border-style:solid; border-width:1; font-family: Trebuchet MS; font-size:8pt; padding-left:4; padding-right:4; padding-top:1; padding-bottom:1; background-color:#B9C49C" value="your message"></font></td></tr><tr> <td width="112" align="left"> <p align="center"><font face="Trebuchet MS" size="1"> <input type="text" name="url" onfocus=clearText(this) size=20 maxlength= 100 style="border-style:solid; border-width:1; font-family: Trebuchet MS; font-size:8pt; padding-left:4; padding-right:4; padding-top:1; padding-bottom:1; background-color:#B9C49C" value="http://www.your-url.com/;</tr><tr><td align=left width="96"><font size="1" face="Trebuchet MS"> <INPUT class=button type=submit value="shout" name=Submit style="float: left; font-family:Trebuchet MS; font-size:8pt"> <INPUT class=button type=reset value="reset" name=Submit2 style="float: left; font-family:Trebuchet MS; font-size:8pt"></font></td></tr></table> </form> </body></html>//PROCESS ENTRY FROM THE FORMS PAGE<?php //create short variable names $msg = $HTTP_POST_VARS['message']; $nme = $HTTP_POST_VARS['name']; $url = $HTTP_POST_VARS['url']; $DOCUMENT_ROOT = $HTTP_SERVER_VARS['DOCUMENT_ROOT'];?><html><head> <title>GuestBook Results</title></head><body bgcolor="b1bc94" "><?php $date = date('H:i, jS F'); if( $nme == "" || $msg == "") { echo '<p><font face="Trebuchet MS" size="2">You did not fill in all the fields!</font></p>'; echo '<p><font face="Trebuchet MS" size="2"><a href="guestbook.htm">back</a></font></p>'; } else { $outputstring = '<i><font color="#A9300D"><a target="_blank" style="text-decoration: none" href="forums.xisto.com'.$url.': ".'</font>'.$msg."\n"; // open file for appending $fp = fopen("guest.txt", 'a'); flock($fp, LOCK_EX); if (!$fp) { echo '<p><font face="trebuchet ms" size="2">The message could not be processed at this time. ' .'Please try again later.</font></p></body></html>'; exit; } fwrite($fp, $outputstring); flock($fp, LOCK_UN); fclose($fp); echo '<p><font face="trebuchet ms" size="2">Thank you...Please reload your browser to see your addition</font></p>'; }?></body></html>//VIEW ENTRIES<?php //create short variable name $DOCUMENT_ROOT = $HTTP_SERVER_VARS['DOCUMENT_ROOT'];?><html><head> <title>Guestbook</title></head><body leftmargin="5" bgcolor="#B1BB96" vlink="#535353" link="#535353"><style><!--body{scrollbar-face-color: #B9C3A0;scrollbar-shadow-color: #B9C3A0;scrollbar-highlight-color: #b1bc94;scrollbar-3dlight-color: #B1BC94;scrollbar-darkshadow-color: #B9C3A0;scrollbar-track-color: #B1BC94;scrollbar-arrow-color: #000000; }--></style><?php@ $fp = fopen("guest.txt", 'r'); if (!$fp) { echo '<p><font face="trebuchet ms" size="1">No guests yet.</font></p>'; exit; } while (!feof($fp)) { $guests= fgets($fp, 999); echo '<font face="Trebuchet MS" size="1">'.$guests.'</font><br />'; } fclose($fp);?></body></html>

Share this post


Link to post
Share on other sites

Well, I'm spoiled for choice.... Not sure which one I should take at all... Maybe if, eerm. I don't know... The ones I've seen look good. Leiaah, Is it possible that for your should box you can have the actual form not in a pop-up? And as it alos possible with yours to say only have 10shouts a page etc?

Share this post


Link to post
Share on other sites

Wow... I forgot I had posted this. Well thanks for the amazing response.

Beeseven. That simple script is exactly what I'm looking for but I'm kind of a bit weirded out by the layout. Mobious, do I need to set anything up on my Xisto host in order to use yours? You say you'll edit the template for anyone who doesnt know php..? Sounds great. But if there is anything I need to set up on the host before I can use it I need to know, sorry I'm a bit of a newbie to php and MySQL.

Thanks, in advance of it all going down smoothly.

56468[/snapback]


you just need to setup a new mysql table. for the template system and the db class, i'll just send mine. for the template, you are the one who will edit it. you will make it so that it will match your site.

Share this post


Link to post
Share on other sites

Well, I don't know how to set up a MySQL table so I'm not sure what I'm going to do. I might go with Beesevens really simple shoutbox and customise it with CSS to make it look good.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.