TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 195,856
  • Total Topics: 21,292
  • Online today: 1,096
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 493
  • Total: 494
  • @rjen

Adding who's chatting box to smf 1.1 RC1 Helios multi theme

Started by Amay_Zing, November 14, 2005, 07:59:51 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Amay_Zing

I have tried inserting this code as per documentation

// flashchat users
echo '
<tr>
<td class="catbg" colspan="2">FlashChat Users</td>
</tr>
<tr>
<td class="windowbg">&nbsp;</td>
<td class="windowbg2" width="100%"><iframe frameborder="0" height="100" src="', $GLOBALS['boardurl'], '/chat/info_embedded.php" style="width: 100%; margin: 0; padding: 0; border: 0; overflow: hidden;" scrolling="no" border="0" allowtransparency="true"></iframe></td>
</tr>';

but it don't work.  Any ideas guys as to where I am going wrong?

Thanks

gerrymo

There is code for this in code block snippets. It should work OK in most themes.

Amay_Zing

it takes ages to get a reply on Flashchat forums and sometimes they don't  >:(

Where are snippets?

gerrymo


Amay_Zing

Thanks bud

Just tried the link and I am getting an error - the topic seems to be missing or is off limits to you :(

gerrymo

Put the code below into a right or left php block.


global $boardurl;
echo '
<iframe frameborder="0" height="100" src="', $boardurl, '/chat/info_embedded.php" style="width: 100%; margin: 0; padding: 0; border: 0; overflow: hidden;" scrolling="no" border="0" allowtransparency="true"></iframe>';


The path should be your path to the chat directory (Above it is: /chat/info_embedded.php)
Scrolling can be changed to suit you.

pheasant_plucker

In flashchat change the info.php file to this



header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");


/**
If this file is not in the FlashChat root folder, then change this
path to the location of the inc/common.php file.
*/
include_once('inc/common.php');

ChatServer::purgeExpired();

/**
Retrieves the number of users who are chatting in any room.
Leave the $room parameter empty to return the number of users in all room.
*/
function numusers( $room = "" )
{
if($room) {
$stmt = new Statement("SELECT COUNT(*) AS numb FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE userid IS NOT NULL AND roomid=?");
$rs = $stmt->process($room);
} else {
$stmt = new Statement("SELECT COUNT(*) AS numb FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE userid IS NOT NULL");
$rs = $stmt->process();
}

$rec = $rs->next();

return $rec?$rec['numb']:0;
}

/**
Retrieves a list of the users (by login ID) who are in $room.
Leave the $room parameter empty to return a list of all users in all rooms.
*/
function usersinroom( $room = "" )
{
$cms = $GLOBALS['fc_config']['cms'];
$list = array();

if($room) {
$stmt = new Statement("SELECT userid, state, color, lang, roomid FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE userid IS NOT NULL AND roomid=?");
$rs = $stmt->process($room);
} else {
$stmt = new Statement("SELECT userid, state, color, lang, roomid FROM {$GLOBALS['fc_config']['db']['pref']}connections WHERE userid IS NOT NULL");
$rs = $stmt->process();
}

while($rec = $rs->next()) $list[] = array_merge($cms->getUser($rec['userid']), $rec);

return $list;
}

/**
Retrieves a list of all available rooms, as an array.
*/
function roomlist()
{
$list = array();

// populate $list with the names of all available rooms
$stmt = new Statement("SELECT * FROM {$GLOBALS['fc_config']['db']['pref']}rooms WHERE ispublic IS NOT NULL");
$rs = $stmt->process();

while($rec = $rs->next()) $list[] = $rec;

//result will be an array of arrays like ('id' => <room id>, 'updated' = <timestamp>, 'created' => <timestamp>, 'name' => <room name>, 'ispublic' => <public flag>, 'ispermanent' => <autoclose flag>)
return $list;
}


$rooms = roomlist();
$roomnumb = sizeof($rooms);
?>

<html>
<title>Who's in the chat?</title>

<body>


<?php
if($roomnumb) {

ÂÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ, foreach($rooms as $room) {





ÂÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  $users usersinroom($room['id']);

ÂÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  foreach( $users as $user ) {
ÂÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  echo $user['login']. ", ";
ÂÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  Ãƒâ€šÃ,  }ÂÃ,  }ÂÃ,  }

?>



</body>
</html>


then in your tpadmin create a PHPblock in the place you want it then add the code include(URL TO Your Webspace/FlashChat/info.php');   for example mine is include('http://www.rcmodelflyers.co.uk/4um/FlashChat/info.php');

This will list the names of users in the chat in a box.

Gerry


This website is proudly hosted on Crocweb Cloud Website Hosting.