Welcome To ClubChat

Get The Script   ClubChat Support Forums

If you like our script, please rate it at HotScripts.com

Hi everyone... Here is my contribution to the PHP-Nuke community. I discovered PHP-Nuke and I must say, I'm impressed :) . I am working on a PHP chat program ( was initially based on mod_perl and since I decided to use PHP-Nuke, decided to code it purely in PHP ) and this is it.

It is feature rich ... Some of the features available for the chat room

Best part is, it runs on PHP and mySQL and no Java ;)

CHANGELOG

Version 1.3 ( 20th November 2001 )

create table if not exists $prefix_chatlastpm (
		uid        bigint(11)
		towho      varchar(100)) type = myisam
Version 1.21 ( 15th November 2001 )

No change in database structure

Changes in eng-lang.txt

define("_CCADMROOMSENT","Message send to room ...");
define("_CCADMSITESENT","Message send to whole site ...");
define("_CCCURROOMLBL","Current Room");
define("_CCALLROOMLBL","All Rooms");
define("_CCADMSENDBTN","Broadcast Message");
Version 1.2 ( 14th November 2001 )

No change in database structure

Version 1.10 ( 7th November 2001 )

Insert new row to nuke_chatsettings

insert into nuke_chatsettings (id,value) values('forcepropercase','N')

Added 2 tables

create table if not exists nuke_chatreplace (
			orgword     varchar(100),
			repword     varchar(100) ) type = myisam

create table if not exists nuke_usersettings (
		  	uid         bigint(11),
		  	id          varchar(10),
		  	value       varchar(40) ) type = myisam

Changes in eng-lang.txt

define("_CCWORDREPTITLE","Word Replace Management");
define("_CCREMPHRASEBTN","Remove Phrase");
define("_CCADDPHRASEBTN","Add");
define("_CCACTPHRASEBTN","Activate");
define("_CCORGPHRASELBL","Phrase");
define("_CCREPPHRASELBL","Replaced With");
define("_CCDISPHRASEBTN","Disable");
define("_CCROOMNONAMEERR","Can't create a room with no name...");
define("_CCFONTCOLORLBL","Font Color");
define("_CCSHOWBGLBL","Disable Backgrounds");

$chatsettings = array(  'entchatmesg'   => 'Enter Chat Message',
		'entroommesg'   => 'Enter Room Message',
		'refreshrate'   => 'Chat Refresh Rate',
		'premesg'       => 'Chat PreMessage',
		'logoffmesg'    => 'Logoff Message',
		'leaveroommesg' => 'Leave Room Message',
		'windowwidth'   => 'Chat Window Width',
		'windowheight'  => 'Chat Window Height',
		'admpremesg'    => 'Administrator PreMessage',
		'mesgshown'     => 'Show Previous Messages',
		'userscolwidth' => 'Users List Column Width',
		'maximage'      => 'Max Image Per Convo',
		'forcepropercase'      => 'Force Proper Case',
		'idletime'      => 'User Idle Time');

INSTALLATION

Unzip the package and you will have the following files : FTP clubchat.php and chatclass.php into your PHP-Nuke directory. Using a text editor, open eng-lang.txt, copy the whole file and add/append it into your PHP-Nuke languages/lang-english.txt file and save the file. Make sure that the PHP-Nuke images/ directory is writeable for the user that runs the httpd daemon ( in my case the user is httpd ).

Log in as an admin for your PHP-Nuke installation ( i.e. http://www.yoursite.com/admin.php ). Once logged in, enter the following URL to start setting up your chatroom http://www.yoursite.com/clubchat.php ( replace www.yoursite.com to you actual domain ),

Run the script as an admin and it will create the necessary tables

This chat allows a user to have a single primary account with PHP-Nuke but unlimited aliases. When a user registers a new alias, it will look up the PHP-Nuke user tables and also ClubChat alias table ( $prefix_chatalias ) for duplicates. This prevents an alias having the same handle as a primary account. To prevent a new PHP-Nuke account having the same handle as an existing alias, edit the user.php and insert the following line inside the userCheck() function

if (mysql_num_rows(mysql_query("select alias from $prefix"._chatusers." where alias='$uname'")) > 0) $stop = "<center>"._NICKTAKEN."</center><br>";

For example

function userCheck($uname, $email) {
    global $stop, $prefix;
    if ((!$email) || ($email=="") || (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$",$email))) $stop = "<center>"._ERRORINVEMAIL."</center>
"; if (strrpos($email,' ') > 0) $stop = "</center>"._ERROREMAILSPACES."<center>"; if ((!$uname) || ($uname=="") || (ereg("[^a-zA-Z0-9_-]",$uname))) $stop = "<center>"._ERRORINVNICK."</center>
"; if (strlen($uname) > 25) $stop = "</center>"._NICK2LONG."</center>"; if (eregi("^((root)|(adm)|(linux)|(webmaster)|(admin)|(god)|(administrator)|(administrador)|(nobody)|(anonymous)|(anonimo)|(anónimo)|(operator))$",$uname)) $stop = "<center>"._NAMERESERVED.""; if (strrpos($uname,' ') > 0) $stop = "</center>"._NICKNOSPACES."</center>"; if (mysql_num_rows(mysql_query("select uname from $prefix"._users." where uname='$uname'")) > 0) $stop = "<center>"._NICKTAKEN."</center>
"; # Added to prevent a user registering a user name with an existing alias for chatroom if (mysql_num_rows(mysql_query("select alias from $prefix"._chatusers." where alias='$uname'")) > 0) $stop = "<center>"._NICKTAKEN."</center>
"; if (mysql_num_rows(mysql_query("select email from $prefix"._users." where email='$email'")) > 0) $stop = "<center>"._EMAILREGISTERED."</center>
"; return($stop); }
This step is optional but highly recommended.

CAVEATS

This script is only tested on Linux and FreeBSD with PHP-Nuke 5.2 and MySQL 3.23.43. It works extremely well on IE version 5.0 and above .. It doesn't work on anything else except IE :p

In IE.. There is an annoying clicking sound if your sound volume is way up .. This is a Window feature.. To get rid of the clicking sound .. Run Your Windows Control panel locate the Sounds icon ( Sounds And Multimedia for Windows 2000 ) . Locate the Start Navigation event .. and choose none for that event

User Commands

User commands starts with a . ( e.g. .aries )

Available commands ( for all users )

Available commands ( for admins only ) : Viewable by all in the current room where the admin issues the command

PERFORMANCE TIPs

Running a chatroom with PHP and MySQl is extremely resource intensive. You need loads of RAM, a fast CPU and a fast net connection. Some things you can do :

Have fun with it and enjoy... Go ahead and use it .. it's free .. but I would appreciate it if you give credit when credit is due ... and if you encounter a bug and fixed it, please do inform me abt it and I will add your fixes.. If you add a nice cool feature to it, inform me too so I can add it to the main code as well..

I know some parts of the code is extremely bad :p forgive me, but I will improve on it as I go along

HISTORY

I started a web site with eShare version 3.0 and yes it is bad. Security is poor, no native language support. But I do like the clean interface and performance is pretty good. Then moved to version 4.0 and security is still bad ( Lycos abandoned eShare and most sites having eShare was hacked to death ).So i said feck it and decide to try to see if there is anything better out there. most of them costs loads of dough and i want something on the cheap ( free even :p ) Tried those free chats ( Java based, HTML based, IRC ) but none seemed to cut it. It's just plain text chat ( which is good if you have lot's of people chatting but bad when ya site have very few hits )

Then I saw some really nice chats based on Perl and PHP .. They're simple and costs nothing. Then i started to study them and understand and started to pull together all the cool stuff i've seen in bits and pieces here and there and voila .. this piece of software is born. it has soo many features in one single script ( well actually 2 ). It has ignore, booting, anti flood, smileys, public and private rooms, private messages in fact, it does almost everything except make coffee ( that could be in the next release :p ).

Granted HTML based chats are slow resource hogs ( I'd be the first to admit that ) but there are advantages namely, all you need is a browser and HTML ( also Perl and PHP ) is pretty easy to code and freely available. So for more bang for the buck, it beats those chats that you have to pay good money for ( in either case, I think I'd rather spend my hard earned money to upgrade my hardware then buy a proprietary software then have to put in requests after requests for features ya want today but they'll only consider adding if demand is there or they'll promise you the next release ).


SourceForge Logo