MyBB Community Forums

Full Version: Extra File Chatbox - Problem with implementing AVATAR inside chat
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello

i made core modifications inside this Chatbox (deleted XSS Attacks etc etc.....), but i have problem implement an avatar

well, i started with
define("IN_MYBB", 1);
define('NO_ONLINE', 1);
require_once("../global.php");

then i wanted echo an variable:
$clean_link = $mybb->user['avatars'];
$avatar = "<img src='$clean_link' style='width: 30px; height: 30px;' title='".$clean_link."' alt='".$clean_link ."'>";

But the result cannot be visited/see/saw (dont know correct word of "patrzenie (PL)"):

[Image: 2UNJB.png]


Any1 know how to have it work?
You do not concantenate the line correctly.
$avatar = "<img src='$clean_link' style='width: 30px; height: 30px;' title='".$clean_link."' alt='".$clean_link ."'>"; 
Should be:
$avatar = '<img src="' . $clean_link . '" style="width: 30px; height: 30px;" title="' . $clean_link . '" alt="' . $clean_link . '">'; 

Added formatting which doesn't matter but you forgot to concantenate the fist variable and that's the issue.

EDIT: also it's $mybb->user['avatar'] without s. But that will display avatar of the person viewing your forum atm and I don't think it's your purpose.
(2013-05-16, 08:30 PM)Destroy666 Wrote: [ -> ]You do not concantenate the line correctly.
$avatar = "<img src='$clean_link' style='width: 30px; height: 30px;' title='".$clean_link."' alt='".$clean_link ."'>"; 
Should be:
$avatar = '<img src="' . $clean_link . '" style="width: 30px; height: 30px;" title="' . $clean_link . '" alt="' . $clean_link . '">'; 

Added formatting which doesn't matter but you forgot to concantenate the fist variable and that's the issue.

EDIT: also it's $mybb->user['avatar'] without s. But that will display avatar of the person viewing your forum atm and I don't think it's your purpose.

Thanks for fix, i also forget to add inside GLOBAL the $mybb Big Grin
can be closed Big Grin
If you are interesed of my version, i'm continuing this chatbox and i added a new options like:
* Users online with Avatars.
* Any shout can be deleted by user, or moderator can delete all shouts.
* language files for ACP configuration of chatbox
* BBCode enabled for specify groups
* Image blink for refreshing chat.

But still have problem with one bug on this chatbox. Doubled shouts when you use navigation left arrow (back) in your explorer.
If someone can help, i will be so glad Smile
[attachment=29508]
You can download this chatbox Extra File Chatbox 3.7.0
is called flood, you can make a check of latest sended message (lets call it $msg_sent) and make it .... Le me php xD

..........
if($last_msg === $sent_msg) {
//flood
} else {
//send it
}
.........
This feature is installed on this chat.
Try to edit file chatbox/config.php
and change option.
from
$config['checkflood'] = false;
to
$config['checkflood'] = true;

########### CHECK FLOOD #################
function is_flood($ip, $message)
{
	global $fcbfile;
	$ls = unserialize(file_get_contents($fcbfile['ds_lastshout']));
	return ($ls['ip'] == $ip  AND $ls['message'] == $message) ? true : false;
}

But this is very simple flood checking Wink
If you want to have a powerfully foold checking, you need to store messages from all users like a last shout from any poster user.
let me work on it very carefully Big Grin
When I try to download it on your site it says;
Quote:Protection died IPs active, this IP range is not allowed !
Try again to download it, finally removed some IP Range.