Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
[MOD] ShoutBox username colour by class
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2 Only Mods Complete

Unknown User
2007-11-09 04:33:38
Pretty sure I saw this requested somewhere.. can't find where so here goes...

Thanks go out to TS for this, as usual  :)

Original post is [url="http://www.torrenttrader.org/index.php?showtopic=3962"]http://www.torrenttrader.org/index.php?showtopic=3962[/url]

If you used the color mod for the online users, you should use the same colors...

In shoutbox.php, find:

echo "<div align='right' style='float: right'><a

href='".$site_config['SITEURL']."/shoutbox.php?del=".$row['msgid']."' style='font-size: 8px'>[D]</a><div>";

}
Below, add:


$a = mysql_query("SELECT class FROM `users` WHERE id = $row[userid] ");

$a = @mysql_fetch_row($a);

switch ($a[0]) {

case 7: // Admin

$user = "<font color=blue>$row[user]</font>";  

break;

case 6: // Super Moderator

$user = "<font color=orange>$row[user]</font>";

break;

case 5: // Moderator

$user = "<font color=brown>$row[user]</font>";

break;

case 4: // Uploader  

$user = "<font color=green>$row[user]</font>";  

break;

case 3: // VIP  

$user = "<font color=red>$row[user]</font>";

break;

case 2: // Power User

$user = "<font color=purple>$row[user]</font>";

break;

case 1: // Member

$user = "<font color=black>$row[user]</font>";

break;

case "": // System (torrent announce, request announce, etc...)

$user = "</a><font color=#CC66CC><b>$row[user]</b></font>";

break;

default: // User

$user = $row[user];

}





find:

'.$row['user'].'



replace with:

'.$user.'




Blah... sorry TS/FLASH, forgot to add [MOD] to the title :S
Unknown User
2007-11-09 21:29:03
Thanks you friend
Unknown User
2007-11-12 23:45:26
It is a great mod, but we had to take it off. This bit: "     '.$user.'     "   causes some sort of cookie error.

When we had confirm email problem [don't work for most email providers] we had to delete some pending accounts.

When these people signed back up the only name they saw in each instance was their own so they never knew who they were talking to.. We tried a lot of thing [delete cookies, re-register ect].

When i removed that bit the problem was sorted, but obviously this great mod wouldn't work then...

Any ideas as this is a great mod, we'd like to use.
Unknown User
2007-11-13 07:58:25
:) uhh... hmmm... I seriously don't see how it can affect them that way... all it does is wrap colors codes around $row[user] so in theory what you're saying can't be caused by the mod... unless your user classes are different but even then, the problem you're talking about couldn't possibly be related

Just tested it myself, created a new user.. it's working fine   :(

I think it's that random shoutbox problems where users cant talk that's haunting you... I had that in 1.x and some of my users are reporting it in 2.x too.. I even rewrote the way shoutbox handles logged in users and that problem's still there :P
Unknown User
2007-11-13 16:25:58
:)  Thanks for fast reply. I thought same as you, it shouldn't have any effect. but with mod on it caused the problem all the time. with it off it didn't. It did the same for the first mod that was posted before.  :P

I think you may also be right about the shoutbox gremlin 'cause some of our members have to log out and back in again to shout but not all the time..Problems like this are a nightmare 'cause it seems so random and nearly impossible to figure out.

Shame we can't use mod though cause we got used to colours and now we miss them. But thanx for you're help anyway. If I do get to the bottom of it I'll post.

PS: " '.$user.' " This is NOT the problem, that was a result of early morning and very late night. I was thinking jibberish by then   :(

If you delete an account then sign up again with same username the problem becomes more apparent.
Unknown User
2007-11-13 17:54:56
"avi-torrents, post: 35093":
If you delete an account then sign up again with same username the problem becomes more apparent.

Care to explain? That's how I tested my invite system, by deleting and recreating the same 5 usernames a bunch of times...
Unknown User
2007-11-13 22:46:40
Hmmm. The way you did it is exactly what we are having problems with, so it must be a bug created by one of our mods or hacks. I'll have a good look through code and get back to you if I fix it. Thanks for you're time mate.
Unknown User
2007-11-16 01:08:14
Works like a charm thanks
Unknown User
2008-03-21 12:32:50
Thank you, Ezerbeth!

I've just installed this on a supermoded 2.04 and works great, no problems at all.
Unknown User
2008-04-14 18:16:55
Unknown User
2008-06-19 16:26:15
hi,

works fine for me.

many thanks!
Unknown User
2008-06-23 08:43:42
Thanks  :mellow:  this a great mod !!!
Unknown User
2008-07-09 10:47:05
Thx its great !
Unknown User
2010-01-31 19:18:58
works fine thanks
Unknown User
2010-03-03 00:04:13
i tryed this out on my site and it took my shoutbox out car1nt post smilyes or mass can some one tell me what im doing rong

?

<?

//

//  TorrentTrader v2.x

// This file was last updated: 25/Feb/2008 by TorrentialStorm

//

// [url="http://www.torrenttrader.org"]http://www.torrenttrader.org[/url]

//

//

require_once("backend/functions.php");

dbconn(false);

if ($site_config['SHOUTBOX']){

//DELETE MESSAGES

if (isset($_GET['del'])){

if (is_numeric($_GET['del'])){

$query = "SELECT * FROM shoutbox WHERE msgid=".$_GET['del'] ;

$result = mysql_query($query);

}else{

echo "invalid msg id STOP TRYING TO INJECT SQL";

exit;

}

$row = mysql_fetch_row($result);

if ($row && ($CURUSER["edit_users"]=="yes" || $CURUSER['username'] == $row[1])) {

$query = "DELETE FROM shoutbox WHERE msgid=".$_GET['del'] ;

write_log("<B><font color=orange>Shout Deleted: </font> Deleted by   ".$CURUSER['username']."</b>");

mysql_query($query);

}

}

//INSERT MESSAGE

if (!empty($_POST['message']) && $CURUSER) {

$_POST['message'] = sqlesc($_POST['message']);

$query = "SELECT COUNT(*) FROM shoutbox WHERE message=".$_POST['message']." AND user='".$CURUSER['username']."' AND UNIX_TIMESTAMP('".get_date_time()."')-UNIX_TIMESTAMP(date) < 30";

$result = mysql_query($query);

$row = mysql_fetch_row($result);

if ($row[0] == '0') {

$query = "INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, '".$CURUSER['username']."', ".$_POST['message'].", '".get_date_time()."', '".$CURUSER['id']."')";

mysql_query($query);

}

}

//GET CURRENT USERS THEME AND LANGUAGE

if ($CURUSER){

$ss_a = @mysql_fetch_array(@mysql_query("select uri from stylesheets where id=" . $CURUSER["stylesheet"])) or die(mysql_error());

if ($ss_a)

$THEME = $ss_a["uri"];

$lng_a = @mysql_fetch_array(@mysql_query("select uri from languages where id=" . $CURUSER["language"])) or die(mysql_error());

if ($lng_a)

$LANGUAGE = $lng_a["uri"];

}else{//not logged in so get default theme/language

$ss_a = mysql_fetch_array(mysql_query("select uri from stylesheets where id='" . $site_config['default_theme'] . "'")) or die(mysql_error());

if ($ss_a)

$THEME = $ss_a["uri"];

$lng_a = mysql_fetch_array(mysql_query("select uri from languages where id='" . $site_config['default_language'] . "'")) or die(mysql_error());

if ($lng_a)

$LANGUAGE = $lng_a["uri"];

}

if(!isset($_GET['history'])){

?>

<HTML>

<HEAD>

<TITLE><?=$site_config['SITENAME']?>Shoutbox</TITLE>

<META HTTP-EQUIV="refresh" content="300">

<link rel="stylesheet" type="text/css" href="<?=$site_config['SITEURL']?>/themes/<?=$THEME?>/theme.css" />

</HEAD>

<body class="shoutbox_body">

<?

echo '<div class="shoutbox_contain"><table border="0" background="#ffffff" style="width: 99%; table-layout:fixed">';

}else{

stdhead();

begin_frame("Shoutbox History");

echo '<div class="shoutbox_history">';

$query = 'SELECT COUNT(*) FROM shoutbox';

$result = mysql_query($query);

$row = mysql_fetch_row($result);

echo '<div align="middle">Pages: ';

$pages = round($row[0] / 100) + 1;

$i = 1;

while ($pages > 0){

echo "<a href='".$site_config['SITEURL']."/shoutbox.php?history=1&page=".$i."'>[".$i."]</a>&nbsp;";

$i++;

$pages--;

}

echo '</div></br><table border="0" background="#ffffff" style="width: 99%; table-layout:fixed">';

}

if (isset($_GET['history'])) {

if (isset($_GET['page'])) {

if($_GET['page'] > '1') {

$lowerlimit = $_GET['page'] * 100 - 100;

$upperlimit = $_GET['page'] * 100;

}else{

$lowerlimit = 0;

$upperlimit = 100;

}

}else{

$lowerlimit = 0;

$upperlimit = 100;

}

$query = 'SELECT * FROM shoutbox ORDER BY msgid DESC LIMIT '.$lowerlimit.','.$upperlimit;

}else{

$query = 'SELECT * FROM shoutbox ORDER BY msgid DESC LIMIT 20';

}

$result = mysql_query($query);

$alt = false;

while ($row = mysql_fetch_assoc($result)) {

if ($alt){

echo '<tr class="shoutbox_noalt">';

$alt = false;

}else{

echo '<tr class="shoutbox_alt">';

$alt = true;

}

echo '<td style="font-size: 9px; width: 118px;">';

echo "<div align='left' style='float: left'>";

echo date('jS M, g:ia', utc_to_tz_time($row['date']));

echo "</div>";

if ( ($CURUSER["edit_users"]=="yes") || ($CURUSER['username'] == $row['user']) ){

echo "<div align='right' style='float: right'><a href='".$site_config['SITEURL']."/shoutbox.php?del=".$row['msgid']."' style='font-size: 8px'>[D]</a><div>";

}

$a = mysql_query("SELECT class FROM `users` WHERE id = $row[userid] ");

$a = @mysql_fetch_row($a);

switch ($a[0]) {

case 7: // Admin

$user = "<font color=blue>$row[user]</font>";

break;

case 6: // Super Moderator

$user = "<font color=orange>$row[user]</font>";

break;

case 5: // Moderator

$user = "<font color=brown>$row[user]</font>";

break;

case 4: // Uploader

$user = "<font color=green>$row[user]</font>";

break;

case 3: // VIP

$user = "<font color=red>$row[user]</font>";

break;

case 2: // Power User

$user = "<font color=purple>$row[user]</font>";

break;

case 1: // Member

$user = "<font color=black>$row[user]</font>";

break;

case "": // System (torrent announce, request announce, etc...)

$user = "</a><font color=#CC66CC><b>$row[user]</b></font>";

break;

default: // User

$user = '.$user.'

}

echo '</td><td style="font-size: 12px; padding-left: 5px"><a href="'.$site_config['SITEURL'].'/account-details.php?id='.$row['userid'].'" target="_parent"><b>'.$row['user'].':</b></a>&nbsp;&nbsp;'.nl2br(format_comment($row['message']));

echo '</td></tr>';

}

?>

</table>

</div>

<br>

<?

//if the user is logged in, show the shoutbox, if not, dont.

if(!isset($_GET['history'])) {

if (isset($CURUSER)){

echo "<form name='shoutboxform' action='".$site_config['SITEURL']."/shoutbox.php' method='post'>";

echo "<CENTER><table width=100% border=0 cellpadding=1 cellspacing=1>";

echo "<tr class='shoutbox_messageboxback'>";

echo "<td width='75%' align=center>";

echo "<input type='text' name='message' class='shoutbox_msgbox'>";

echo "</td>";

echo "<td>";

echo "<input type='submit' name='submit' value='".SHOUT."' class='shoutbox_shoutbtn'>";

echo "</td>";

echo "<td>";

echo "<a href=".$site_config['SITEURL']."/backend/smilies.php?action=display target=_blank><small>".SMILES."</small></a>";

echo " - <a href=".$site_config['SITEURL']."/tags.php target=_blank><small>".TAGS."</small></a>";

echo "<br>";

echo "<a href='shoutbox.php'><small>".REFRESH."</small></a>";

echo " - <a href='".$site_config['SITEURL']."/shoutbox.php?history=1' target=_blank><small>".HISTORY."</small></a>";

echo "</td>";

echo "</tr>";

echo "</table></CENTER>";

echo "</form>";

}else{

echo "<br /><div class='shoutbox_error'>You must login to shout.</div>";

}

}

if(!isset($_GET['history'])){

echo "</BODY></HTML>";

}else{

end_frame();

stdfoot();

}

}//END IF $SHOUTBOX

else{

echo "Shoubox is disabled. Please do not direct link here";

}

?>
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728