multiple chatrooms

565
.
hi there ive coded a single flat file that provides multiple chatrooms where a user can select the room they want and their messages will show up in that selected room. Ive stil got to do whos online part and add admin clear chat and delete message over the next few days.
Прикрепленные файлы:
.
andyh2017
here is the second screenshot if anyone likes this idea ill post it here in this topic when its completed.
note this is for john cms 6
Прикрепленные файлы:
.
the first screen shot but with the total chatters fixed and working shows all users in chat
Прикрепленные файлы:
.
first of all we need to add this code to incfiles/core.php at line 85
 $rid = isset($_REQUEST['rid']) ? abs(intval($_REQUEST['rid'])) : false;      
and we also need to add a new function to incfiles/classes/counters.php
this function will enable us to show total amount of chatters in all rooms.
if you decide to add more rooms you will need to modify to suit your needs.

 static function chatrooms()
    {
                     $place0 = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `place` = 'Chat Rooms' "), 0);
                     $place1 = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `place` = 'Aussie Chat' "), 0);
                     $place2 = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `place` = 'Kiwi Chat' "), 0);
                     $place3 = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `place` = 'Uk Chat' "), 0);
                     $place4 = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `place` = 'World Chat' "), 0);
                     $place5 = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `place` = 'Teen Chat' "), 0);
                     $place6 = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `place` = 'Adult Chat' "), 0);


                      $totalplace = $place0 + $place1 + $place2 + $place3 + $place4 + $place5 + $place6;
                      $total = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `place` = '".$totalplace."' "), 0);
                      return $totalplace;
    }
now add the rooms and messages to your database

--
-- Table structure for table `chat_messages`
--

CREATE TABLE `chat_messages` (
  `id` int(20) NOT NULL,
  `rid` int(15) NOT NULL,
  `uid` int(15) NOT NULL,
  `name` varchar(150) NOT NULL,
  `message` varchar(250) NOT NULL,
  `private` int(12) NOT NULL DEFAULT '0',
  `time` int(15) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;




-- --------------------------------------------------------

--
-- Table structure for table `chat_rooms`
--

CREATE TABLE `chat_rooms` (
  `rid` int(12) NOT NULL,
  `chatroom` varchar(150) NOT NULL,
  `position` int(12) NOT NULL DEFAULT '0',
  `censored` int(12) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `chat_rooms`
--

INSERT INTO `chat_rooms` (`rid`, `chatroom`, `position`, `censored`) VALUES
(1, 'Aussie Chat', 1, 0),
(2, 'Kiwi Chat', 2, 0),
(3, 'Uk Chat', 3, 0),
(4, 'World Chat', 4, 0),
(5, 'Teen Chat', 5, 0),
(6, 'Adult Chat', 0, 0);
Прикрепленные файлы:
.
if people show more interest in this project ive got avatars showing in chat rooms and the whos online in the chatroom working now and also smilies intergrated with the script.. the reason I started this project is because I personally believe john cms has potential to be bigger. and as there are no multiple chatrooms being coded for this script I think chatrooms can be something to make the script more popular. And as the saying goes Sharing is Caring
Прикрепленные файлы:
Всего: 5