News:

SMF 2.1.2 has been released! Take it for a spin! Read more.

Main Menu

SMF Shoutbox

Started by Deep, March 15, 2006, 08:09:52 AM

Previous topic - Next topic

Deep

Link to Mod

Hi there!

I wrote this shoutbox mod because of two reasons:
1. I wasn´t clever enough to modify Grudge´s Ultimate Shoutbox in the way i liked. I wanted to have a shoutbox with a little bit more "chat feeling". So i decided to program a shoutbox which exactly fits my needs.
2. I am new to PHP and to SMF, so this was a chance to improve my knowledge about these things. In fact, this was the very first time i coded PHP. I am very impressed of the clear structure of SMF.

The shoutbox appears above the board index of the default theme. You can adjust some things using the configuration / features and options menu.

Sample screenshot:


By the way, i have stolen some source code from Grudge. Thank you, Grudge! :-)

There is an additional german language pack available.

If you find a bug, please leave a comment to me. Thank you.

Deep

PS.: Sorry for my poor english.

keith021773

Installed fine even though I am not using the default theme.  I am using dark-blue.    It was visible on the main page but in the chatbox itself it was giving me a internal server error.   How can I fix this?  Thanks.

hawkie2006

im getting the same internal error
what up with this ?

scoobyx

same problem


The requested URL /mysite/sboxDB.php was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/1.3.34 Server at www.mysite.com Port 80

:'(

InterxWeb

24.     Execute Modification     ./Sources/Subs.php     Test failed

... probablly my fault somehow, lol

Deep

#5
@keith021773, @hawkie2006, @scoobyx:

The problem you experienced is new to me.
Please take a look at the sources directory (by default it is /smf/Sources) of your forum. Do you find the file sboxDB.php in this directory? If not, please extract this file out of the shoutbox archive and put it manually into this directory using ftp. But if the file is already in this directory,  please check it´s permission attributes. The file must be readable for anybody. Do you get the same error after having chmod it to 777?


@InterxWeb:

Well, in deed there is a real chance, that´s it could be your fault. In Subs.php the shoutbox installer wants to add a procedure after the existing procedure template_footer(). The installer looks for the following code to identify the end of this procedure:

log_error('Copyright removed!!');
}
}


Do you have modified the procedure and removed the log_error command? Maybe because you have removed the copyright?  ;)

However. Take a look at the file sbox_v1.04.mod inside the shoutbox zip archive,
Replace the following code..

<edit file>
$sourcedir/Subs.php
</edit file>

<search for>
log_error('Copyright removed!!');
}
}
</search for>

<add after>

function sbox()
{
global $sourcedir;

include_once("$sourcedir/sbox.php");
sbox_display();
}

</add after>


..with this code:

<edit file>
$sourcedir/Subs.php
</edit file>

<search for>
// Debugging.
function db_debug_junk()
</search for>

<add before>

function sbox()
{
global $sourcedir;

include_once("$sourcedir/sbox.php");
sbox_display();
}

</add before>


After you have modified sbox_v1.04.mod inside the shoutbox archive, please upload the archive and try to install the mod again.

Deep

qtime

#6
This is what I see in the shout box: Any suggestions?
'; switch ($_REQUEST['action']) { case "write": if ((!$context['user']['is_guest']) || ($modSettings['sbox_GuestAllowed'] == "1")) { // empty messages are not allowed $content=$_REQUEST['sboxText']; if(chop($content."") != "") { // get actual weekday $days = array($txt['sbox_Sunday'],$txt['sbox_Monday'],$txt['sbox_Tuesday'],$txt['sbox_Wednesday'],$txt['sbox_Thurday'],$txt['sbox_Friday'],$txt['sbox_Saturday']); $day=$days[date("w")]; // weekday $date=$day." | ". date("G:i"); // time // handle spacial characters $content=addslashes($content); // insert shout message into database $sql = "insert into ".$db_prefix."sbox_content (name,content,time) values ('".$user_info['username']."','".$content."','$date')"; db_query($sql,__FILE__,__LINE__); // delete old shout messages (get id of last shouting and delete all shoutings as defined in settings $result = db_query("select id from ".$db_prefix."sbox_content where name='".$user_info['username']."' and content='".$content."' and time='$date'",__FILE__,__LINE__); $rows = mysql_fetch_assoc($result) ; $sql = "delete from ".$db_prefix."sbox_content where id < '".($rows["id"]-$modSettings['sbox_MaxLines'])."'"; db_query($sql,__FILE__,__LINE__); } } break; case "kill": if ($context['user']['is_admin']) { $id = "".$_REQUEST['kill']; if ($id != "") { $sql = "delete from ".$db_prefix."sbox_content where id=".$id.""; db_query($sql,__FILE__,__LINE__); } } break; } // close header and open body echo ' '; // get smilie path $themedir = $settings['default_theme_url']; // smf theme path $imgdir = $themedir."/images/"; // smilie path // get shout messages out of database $result = db_query("select * from ".$db_prefix."sbox_content order by id desc, time asc limit ".$modSettings['sbox_MaxLines'],__FILE__,__LINE__); if(mysql_num_rows($result)) { $count=0; // counter to distinguish font color while($row = mysql_fetch_assoc($result)) { $count = $count + 1; // increase counter $name = $row["name"]; // user name $date = $row["time"]; // shouting date and time $content = stripslashes($row['content']); // shouting content // replace smilie code with path to smilie image $content = str_replace ($txt['sbox_smilie01_code'], ''.$txt['sbox_smilie01_text'].'', $content); $content = str_replace ($txt['sbox_smilie02_code'], ''.$txt['sbox_smilie02_text'].'', $content); $content = str_replace ($txt['sbox_smilie03_code'], ''.$txt['sbox_smilie03_text'].'', $content); $content = str_replace ($txt['sbox_smilie04_code'], ''.$txt['sbox_smilie04_text'].'', $content); $content = str_replace ($txt['sbox_smilie05_code'], ''.$txt['sbox_smilie05_text'].'', $content); $content = str_replace ($txt['sbox_smilie06_code'], ''.$txt['sbox_smilie06_text'].'', $content); $content = str_replace ($txt['sbox_smilie07_code'], ''.$txt['sbox_smilie07_text'].'', $content); $content = str_replace ($txt['sbox_smilie08_code'], ''.$txt['sbox_smilie08_text'].'', $content); $content = str_replace ($txt['sbox_smilie09_code'], ''.$txt['sbox_smilie09_text'].'', $content); $content = str_replace ($txt['sbox_smilie10_code'], ''.$txt['sbox_smilie10_text'].'', $content); $content = str_replace ($txt['sbox_smilie11_code'], ''.$txt['sbox_smilie11_text'].'', $content); $content = str_replace ($txt['sbox_smilie12_code'], ''.$txt['sbox_smilie12_text'].'', $content); $content = str_replace ($txt['sbox_smilie13_code'], ''.$txt['sbox_smilie13_text'].'', $content); $content = str_replace ($txt['sbox_smilie14_code'], ''.$txt['sbox_smilie14_text'].'', $content); $content = str_replace ($txt['sbox_smilie15_code'], ''.$txt['sbox_smilie15_text'].'', $content); // display shouting message and use a different color each second row if ($count % 2) echo '
'; else echo '
'; if ($context['user']['is_admin']) echo '[X]'; echo '[ '.$date.' ] <'.$name.'> '.$content.'
'; } echo ' '; } ?>


my forum error log:
Apply Filter: Only show the error messages of this URL  http://myip/test/index.php?action=packages;sa=install2;package=sbox_v1.04.zip
Apply Filter: Only show the errors with the same message
8: Undefined variable: db_name
File: C:\Program Files\Apache Group\Apache2\htdocs\test\Packages\temp\sbox_setup.php
Line: 52

http://myip/test/index.php?action=packages;sa=install2;package=sbox_v1.04.zip
Apply Filter: Only show the errors with the same message
2: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Access denied for user 'ODBC'@'localhost' (using password: NO)
File: C:\Program Files\Apache Group\Apache2\htdocs\test\Packages\temp\sbox_setup.php
Line: 51

http://myip/test/index.php?action=packages;sa=install2;package=sbox_v1.04.zip
Apply Filter: Only show the errors with the same message
8: Undefined variable: db_passwd
File: C:\Program Files\Apache Group\Apache2\htdocs\test\Packages\temp\sbox_setup.php
Line: 51

http://myip/test/index.php?action=packages;sa=install2;package=sbox_v1.04.zip
Apply Filter: Only show the errors with the same message
8: Undefined variable: db_user
File: C:\Program Files\Apache Group\Apache2\htdocs\test\Packages\temp\sbox_setup.php
Line: 51

Apply Filter: Only show the error messages of this URL  http://myip/test/index.php?action=packages;sa=install2;package=sbox_v1.04.zip
Apply Filter: Only show the errors with the same message
8: Undefined variable: db_server
File: C:\Program Files\Apache Group\Apache2\htdocs\test\Packages\temp\sbox_setup.php
Line: 51

Deep

#7
Hi qtime!

What you see in the shout box is a part of the php source code of the file sboxDB.php.
This file seems to be corrupt. Please extract sboxDB.php out of the shoutbox archive and put it into the sources directory (by default it is /smf/Sources) of your forum.

If the error still occurs after you have done this, please post the content of sboxDB.php here so that i can have a look on it.

Your forum error log sais that the automatic execution of sbox_setup.php failed. This is a very often reported problem, but i have no idea what could be the reason for it.
To fix it, please extract the file sbox_setup.php out of the shoutbox archive and put it into the main directory of you forum and run this script by typing in it´s internet address in your browser (e.g. "http://mysite.com/smf/sbox_setup.php")

Deep

jguzman

#8
Deep,

i'm getting this error in the actual shoutbox box
QuoteDatabase Error
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
File: /home/flashfor/public_html/Sources/sboxDB.php
Line: 119

ps, i'm a noob

and after i install the mod package, it says this

QuoteError creating shoutbox table. SQL Error: No Database Selected
Table: No Database Selected Already exists, skipping.
Table: No Database Selected Already exists, skipping.
Table: No Database Selected Already exists, skipping.
Table: No Database Selected Already exists, skipping.
Table: No Database Selected Already exists, skipping.
Table: No Database Selected Already exists, skipping.
Table: No Database Selected Already exists, skipping.
Table: No Database Selected Already exists, skipping.
Table: No Database Selected Already exists, skipping.
Table: No Database Selected Already exists, skipping.
Table: No Database Selected Already exists, skipping.
Table: No Database Selected Already exists, skipping.
Table: No Database Selected Already exists, skipping.

Deep

Hi jguzman,

here again the automatic execution of sbox_setup.php failed.
Please extract the file sbox_setup.php out of the shoutbox archive and put it into the main directory of you forum and run this script by typing in it´s internet address in your browser (e.g. "http://mysite.com/smf/sbox_setup.php")

Deep

Sava


keith021773

Quote from: Deep on March 16, 2006, 09:28:08 AM
@keith021773, @hawkie2006, @scoobyx:

The problem you experienced is new to me.
Please take a look at the sources directory (by default it is /smf/Sources) of your forum. Do you find the file sboxDB.php in this directory? If not, please extract this file out of the shoutbox archive and put it manually into this directory using ftp. But if the file is already in this directory,  please check it´s permission attributes. The file must be readable for anybody. Do you get the same error after having chmod it to 777?


The file sboxdb.php was in the sources directory, however the files permission was set at 666.   I changed that to 777 and I am still getting the 404 internal server error..   Anything else that might make it work?


Deep

keith021773,

what happens if you try to access the file sboxDB.php directly by typing it´s internet address in your browser (e.g. "http://mysite.com/smf/Sources/sboxDB.php")?

Please keep in mind that linux systems are case sensitive, so you have to use "../ Sources/sboxDB.php" and not "../sources/sboxdb.php".

If you can access the file this way, you perhaps will get some error messages - don´t panic, you can ignore them all. In that case please edit the file sbox.template.php, located in your default themes directory. In sbox.template.php replace any occurance of the string "Sources/sboxDB.php" with the address you typed into the browser to access sboxDB.php. After having saved sbox.template.php you should not get any more 404.

If you can NOT access sboxDB.php by typing it´s address into the browser, there must be something ugly wrong. Is the file really at the place you expect it to be?

Deep

PS. Thank you, Sava!

jguzman

Quote from: Deep on March 17, 2006, 05:30:28 AM
Hi jguzman,

here again the automatic execution of sbox_setup.php failed.
Please extract the file sbox_setup.php out of the shoutbox archive and put it into the main directory of you forum and run this script by typing in it´s internet address in your browser (e.g. "hxxp:mysite.com/smf/sbox_setup.php [nonactive]")

Deep

awesome deep.  that worked like a charm.

very very cool mod.

keith021773

Quote from: Deep on March 17, 2006, 08:55:11 AM
keith021773,

what happens if you try to access the file sboxDB.php directly by typing it´s internet address in your browser (e.g. "http://mysite.com/smf/Sources/sboxDB.php")?

Please keep in mind that linux systems are case sensitive, so you have to use "../ Sources/sboxDB.php" and not "../sources/sboxdb.php".

If you can access the file this way, you perhaps will get some error messages - don´t panic, you can ignore them all. In that case please edit the file sbox.template.php, located in your default themes directory. In sbox.template.php replace any occurance of the string "Sources/sboxDB.php" with the address you typed into the browser to access sboxDB.php. After having saved sbox.template.php you should not get any more 404.

If you can NOT access sboxDB.php by typing it´s address into the browser, there must be something ugly wrong. Is the file really at the place you expect it to be?

Deep

PS. Thank you, Sava!


Thanks for the help so far, but that too didn't work..  I still get the same internal server error..   I'm guessing something is very wrong.   LOL    But like I said, it installed fine.   It's just that in the chatbox itself is where the error pops up...   

qtime

#15
Thx for replying!

Still have the same problem, as I write before.
Here is my sboxDB.php file:
http://rapidshare.de/files/15782233/sboxDB.php.html

I hope you have a clue, because I like to have this mod installed ;)
I tried a completely fresh install of smf 1.1 RC2 (and still have the same problem)

I am using windows xp, apache 2.0.54, PHP 5.1.0b3 (all other mods are doing well).

littleone

Is there a way we can get some permissions to allow moderators to delete shouts?

sprattzer


scoobyx

#18
Quote from: Deep on March 16, 2006, 09:28:08 AM
@keith021773, @hawkie2006, @scoobyx:

The problem you experienced is new to me.
Please take a look at the sources directory (by default it is /smf/Sources) of your forum. Do you find the file sboxDB.php in this directory? If not, please extract this file out of the shoutbox archive and put it manually into this directory using ftp. But if the file is already in this directory,  please check it´s permission attributes. The file must be readable for anybody. Do you get the same error after having chmod it to 777?


No sboxDB.php for me in my sources folder so extracted as mentioned and chmod to 777.

getting the following internal error

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/1.3.34 Server at www.mysite.com Port 80

looks a vast improvement on the orignal mod, any help getting this working much appriciated.

cheers

Scoobyx

p.s one thing to add I have the orignal shoutbox mod installed on my site during installation, presuming this does'nt cause an issue..

ArkServer

#19
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
File: C:\apache\htdocs\sources\sboxdb.php
Line: 119

//edit
its fixed..

but any idea how i can add an hyperlink? like www.happyserver.be (no spam intended) but when i typ the url it doesnt make it "clicky"

//edit 2..

afer some close inspection i think i'll uninstall this mod..
reason:

No idea why it's creating so many processes.. they all slow our server down.
each php process is around 3 to 10mb and i got like 40 of them.. go figure..

i'm not saying that this is because of the mod, but i'm saying that the forum loads a lot slower and takes a lot more resources after i installed it.


Advertisement: