News:

The "Support Requests" forum is now viewable by guests.

Main Menu

Homemade PHP Shoutbox has some errors, help if you have the time

Started by sixthcrusifix, December 03, 2005, 10:37:39 AM

Previous topic - Next topic

sixthcrusifix

This shoutbox DID work before I edited it and now I don't know what I did. It had to be changed though it was really stupid and used like 1000 <? ?> tags instad of putting it in one. It has 2 big errors:

1. I get the following error message in teh shoutbox:


Notice: Undefined variable: message in /fpgs/fpgshttpd/sixthcrusifix/shoutbox.php on line 49


2. Instead of the the name showing up I get the text "name=". I dunno why either.


Here is the actuall code (you can see the shoutbox HERE



<?php include("shoutbbcode.php");

include("defaultcss.php");

?>


<body bgcolor="009800">

<table align="left" cellpadding="0" cellspacing="0" background="http://crystalchasm.net/Content.gif" bordercolor="#FFFFFF" >

<tr>

<td>

<img src="http://crystalchasm.net/CategoryS.gif">

</td>

</tr>
<tr><td>
<div align="center">
<b>The Final Destiny</b></div>
</tr></td>
<tr>

<td><div style="width: 669; height:210;
overflow: auto; font-family: Verdana,
Tahoma, Helvetica, sans-serif; font-size:
11px; color: #aa00aa; scrollbar-arrow-color:#FFFFFF;
scrollbar-track-color:#009800; scrollbar-face-color:#009800;
scrollbar-highlight-color:#00aa00; scrollbar-3dlight-color:#00ff00;
scrollbar-darkshadow-color:#003300; scrollbar-shadow-color:#005500;">
<div align="center">
<?
//the host, name, and password for your mysql
$conn = @mysql_connect("localhost","sixthcrusifix","•••••••");

//select the database
$DB = @mysql_select_db("DATA");


if(isset($submit)) 

{
   //use the PHP date function for the time
   $time=date("h:ia d/j/y");
   $SQL = "INSERT INTO shoutbox1 (id,name,message,time)
      VALUES ('NULL','$name', '$message','$time')";

   // inserting it into the shoutbox table which we made in the mysql statements before
   $result=MYSQL_QUERY($SQL,$conn)  or die(mysql_error()) ;

}

?>
<?
//returning the last 5 messages
$result = mysql_query("select * from shoutbox1 order by id desc limit 10") or die(mysql_error()) ;

//the while loop
while($r=mysql_fetch_array($result))
{
   //getting each variable from the table
   $time=$r["time"];
   $id=$r["id"];
   $message=$r["message"];
   $name=$r["name"];

include("shoutbbcode.php");
echo(" $b $name $b_ $br $message3 $br$br ");
}


?>



</div>
</tr>
</td>

<tr>

<td bgcolor="#009800">

<img src="http://crystalchasm.net/Category_bottum.gif">

</td>

</tr>

</td>

</tr>

</table>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<div align="center">

<form action="<? echo($PHP_SELF) ?>" method="post">

<INPUT TYPE='TEXT' value='name' NAME='name' SIZE=30 maxlength='100'>

<INPUT TYPE='TEXT' value='message' NAME='message' SIZE=30 maxlength='69'>

<input type="submit" NAME="submit" value="submit">

</form></div>





here is the source of shoutbbcode.php if you need it:



<?php
  if(isset($message) )
{
#Section 1, Bold, Underline and Italic

  $bb_code_1 = array("[b]","[u]","[i]","[bui]","[ui]","[iu]","[bi]","[ib]","[iub]","[ubi]","[uib]","[biu]");
$bb_output_1 =array("<b>","<u>","<i>","<b><u><i>","<u><i>","<i><u>","<b><i>","<i><b>","<i><u><b>","<u><b><i>","<u><i><b>","<b><i><u>");
$message2 = str_replace($bb_code_1,$bb_output_1,$message);

  $bb_endcode_1 = array("[/b]","[/u]","[/i]","[/bui]","[/ui]","[/iu]","[/bi]","[/ib]","[/iub]","[/ubi]","[/uib]","[/biu]");
$bb_endput_1 =array("</b>","</u>","</i>","</b></u></i>","</u></i>","</i></u>","</b></i>","</i></b>","</i></u></b>","</u></b></i>","</u></i></b>","</b></i></u>");
$message3 = str_replace($bb_endcode_1,$bb_endput_1,$message2);


#Section 2, other comoon tags

}
?>
Visite me website at http://www.sixthcrusifix.com

admin

For the "Notice" message, you can eliminate those by selecting the default error reporting level of "All But Notice & Strict" which will show you all errors accept E_Notice and E_Strict in your PHP scripts.

As for the code you entered, unless the board converted the characters, your file does not contain the <,>,=, etc characters, but their HTML equivilents.

Thank you,
FreePgs.com Admin