tbdev 08 mod req

Started by rabtb, September 16, 2012, 02:13:42 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Tundracanine

If you getting an white page look at your apache error log and/or php error_log if your server setup to make the php error_log.
If wanting support help please put bare min info like
Os:
U-232 Version:
Php Version:
Tracker type: like xbt or php
Saves on asking more questions just so people can help someone.

rabtb

any advice/help with adding a like button to this iv tryed varous bits of code but keep getting white pages :/ thanks

rabtb

all seems to work perfect now thanks alot much appreciated  8) :)

ShadoW69

QuoteWarning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/source/public_html/shoutbox.php:1) in /home/source/public_html/shoutbox.php on line 7

i wanted to add a check to see if 3 secends have passed since last post, but i has to sleepy last night when i posted, that i forgot to add that... its not a biggy. and yes it gives you an error because your session is already started, you did the right thing by deleting it.

QuoteWarning: in_array() expects parameter 2 to be array, string given in /home/headshot/public_html/shoutbox.php on line 158

as i meantioned i was kind of sleepy so i missed out something:P, the fix for this... change line 157
Code (php) Select
$checkIgnList = !empty( $CURUSER['ignore_list'] ) ? explode( $delimiter, $CURUSER['ignore_list'] ) : '';

with this
Code (php) Select
$checkIgnList = !empty( $CURUSER['ignore_list'] ) ? explode( $delimiter, $CURUSER['ignore_list'] ) : array();

Quotealso got like a tab space after the i before username

its something i put in so that all shouts start from the same x coordinate... if you want to revert back just do the following... delete line 134
Code (html5) Select
.col{ width: 170px; }

line 265 replace <td class='col'> with <td> and delete line 267 which is </td><td>

beside that i think everything should be working now... again if you find any bug or something just feel free to post it up here and i`ll try to fix it asap...  ;D
cheers

rabtb

thanks alot this looks great

so does work just couple things got this first

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/source/public_html/shoutbox.php:1) in /home/source/public_html/shoutbox.php on line 7

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/source/public_html/shoutbox.php:1) in /home/source/public_html/shoutbox.php on line 7

so deleted line 7 all looks good adds and remove from list fine and hide but when i add 1st person i get
Warning: in_array() expects parameter 2 to be array, string given in /home/headshot/public_html/shoutbox.php on line 158
Ignore List updated succesfully.

but any others added after dont give error
also got like a tab space after the i before username

ShadoW69

so i think i have finished the ignore list... the files that will be affected are shoutbox.php, my.php, takeprofedit.php.
SQL:
Code (mysql) Select
ALTER TABLE users ADD ignore_list TEXT NOT NULL

shoutbox.php
Code (php) Select
<?
/*****************************
Hannes' ShoutBox v1.0
*****************************/
require_once("include/bittorrent.php");

session_start();
dbconn();
loggedinorreturn();

if( $CURUSER["shoutboxpos"] == 'no' ){

stdmsg( "", "<center><font color=red><font size=3.5><strong>You are not allowed to use the shoutbox, because your rights have been removed</strong></font>" );
//stdfoot();
exit;

}

### IF YOU HAVE THE get_user_class_color FUNCTION JUST REPLACE DOWN
function getUserClassColor( $c, $u ){

$u = !empty( $u ) ? htmlspecialchars( $u ) : '<em>Unknown</em>';

switch( $c ){

case 17: $usercolor= "<font color='red'>" . $u . "</font>"; break;
case 16: $usercolor= "<font color='red'>" . $u . "</font>"; break;
case 15: $usercolor= "<font color='red'>" . $u . "</font>"; break;
case 14: $usercolor= "<font color='red'>" . $u . "</font>"; break;
case 13: $usercolor= "<font color='red'>" . $u . "</font>"; break;
case 12: $usercolor= "<font color='red'>" . $u . "</font>"; break;
case 11: $usercolor= "<font color='#2587A7'>" . $u . "</font>"; break;
case 10: $usercolor= "<font color='#B000B0'>" . $u . "</font>"; break;
case 9: $usercolor= "<font color='#347235'>" . $u . "</font>"; break;
case 8: $usercolor= "<font color='#0000CC'>" . $u . "</font>"; break;
case 7: $usercolor= "<font color='#6464FF'>" . $u . "</font>"; break;
case 6: $usercolor= "<font color='#FFFF00'>" . $u . "</font>"; break;
case 5: $usercolor= "<font color='#806517'>" . $u . "</font>"; break;
case 4: $usercolor= "<font color='#F87431'>" . $u . "</font>"; break;
case 3: $usercolor= "<font color='#3EA99F'>" . $u . "</font>"; break;
case 2: $usercolor= "<font color='#A74AC7'>" . $u . "</font>"; break;
case 1: $usercolor= "<font color='#E78A61'>" . $u . "</font>"; break;
default: $usercolor= "<font color='#FAAFBE'>" . $u . "</font>";

}

return $usercolor;

}

### SHOULDN`T BE USING THIS, ITS OLD ALSO ITS OUTSIDE OF HTML TAG ( PATCH FOR THIS IS TO USE CSS ex. img{ max-width: 280px; } )
$imgResizeScript = '<script type="text/javascript" src="ncode_imageresizer.js"></script>
<script type="text/javascript">
<!--
NcodeImageResizer.MODE = "newwindow";
NcodeImageResizer.MAXWIDTH = 280;
NcodeImageResizer.MAXHEIGHT = 0;

NcodeImageResizer.Msg1 = "Click this bar to view the full image.";
NcodeImageResizer.Msg2 = "This image has been resized. Click this bar to view the full image.";
NcodeImageResizer.Msg3 = "This image has been resized. Click this bar to view the full image.";
NcodeImageResizer.Msg4 = "Click this bar to view the small image.";
//-->
<!--Image Resizer v0.1 by xam//-->
</script>';

// EDIT SHOUT ?
if( isset( $_GET['edit'] ) && get_user_class() >= UC_MODERATOR && is_valid_id( $_GET['edit'] ) ){

$sql = mysql_query( "SELECT id, text FROM shoutbox WHERE id = " . sqlesc( $_GET['edit'] ) );
$res = mysql_fetch_assoc( $sql );

if( mysql_num_rows( $sql ) == 1 ){

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Edit Shout</title>
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset;?>" />
<style type="text/css">
#specialbox{ border: 1px solid gray; width: 600px; background: #FBFCFA; font: 9px verdana, sans-serif; color: #443; padding: 3px; outline: none; }
#specialbox:focus{ border: 1px solid black; }
.btn{ cursor:pointer; border:outset 1px #ccc; background:#999; color:#666; font-weight:bold; padding: 1px 2px; background:url('<?php echo $pic_base_url;?>formbg.gif') repeat-x left top; }
</style>
<?php echo $imgResizeScript;?>
</head>
<body bgcolor="#F5F4EA">
<form method="post" action="shoutbox.php">
<input type="hidden" name="id" value="<?php echo $res['id'];?>" />
<textarea name="text" cols="10" rows="3" id="specialbox"><?php echo htmlspecialchars$res['text'] );?></textarea>
<input type="submit" name="save" value="Edit shout!" />
</form>
</body>
</html>
<?php

die;

}

}

// UPDATE SHOUT?
if( isset( $_POST['text'] ) && get_user_class() >= UC_MODERATOR && is_valid_id$_POST['id'] ) ){

$text trim$_POST['text'] );
$id = (int)$_POST['id'];

if( !empty( $text ) && !empty( $id ) ){

mysql_query"UPDATE shoutbox SET text = " sqlesc$text ) . " WHERE id = " sqlesc$id ) );

}

}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ShoutBox</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />
<meta http-equiv="refresh" content="2000; url=shoutbox.php" />
<style type="text/css">
a{ color: #000000; font-weight: bold; }
a:hover{ color: #FF0000; }
.small{ font-size: 8pt; font-family: tahoma; width: 100%; border: none; align: left; }
.date{ font-size: 8pt; }
body{ /* background-color: #F0F8FF; */ background-color: #CDC9C9; SCROLLBAR-3DLIGHT-COLOR: #004E98; SCROLLBAR-ARROW-COLOR: #004E98; SCROLLBAR-DARKSHADOW-COLOR: black; SCROLLBAR-BASE-COLOR: black; }
img{ border: none; }
.col{ width: 170px; }
.error{ background: #f7b7a6; padding: 1px 120px; }
.info{ background: #d9f7a6; padding: 1px 120px; }
</style>
<?php echo $imgResizeScript;?>
</head>
<body>
<?

### ADD TO IGNORE LIST
$ignoreID = isset( $_GET['ignore'] ) ? $_GET['ignore'] : false;

if( $ignoreID ){

if( $CURUSER['id'] == $ignoreID ){

echo '<strong class="error">You can`t add yourself to your ignore list.</strong></body></html>';
exit;

}

$delimiter = ',';

$checkIgnList = !empty( $CURUSER['ignore_list'] ) ? explode( $delimiter, $CURUSER['ignore_list'] ) : '';

if( in_array( $ignoreID, $checkIgnList ) ){

echo '<strong class="error">This user is already in your ignore list.</strong></body></html>';
exit;

}

$checkDB = mysql_query( "SELECT id FROM users WHERE id = " . sqlesc( $ignoreID ) );

if( ctype_digit( (string) $ignoreID ) && mysql_num_rows( $checkDB ) == 1 ){

$delimiter = !empty( $CURUSER['ignore_list'] ) ? $delimiter : '';
$newIgnID = mysql_real_escape_string( $delimiter . $ignoreID );

$updateSQL = "UPDATE users SET ignore_list = CONCAT( ignore_list, '{$newIgnID}' ) WHERE id = '{$CURUSER['id']}' LIMIT 1";
$update = mysql_query( $updateSQL );

if( $update ){ echo '<strong class="info">Ignore List updated succesfully.</strong>'; }
else{ echo '<strong class="error">Failed to update ignore list.</strong>'; }

} else {

echo '<strong class="error">Invalid user ID.</strong></body></html>';
exit;

}

}

//deleting messages
if( isset( $_GET['del'] ) && get_user_class() >= UC_MODERATOR ){

$id = (int)$_GET['del'];

$query = "SELECT id FROM shoutbox WHERE id = " . sqlesc( $id );
$result = mysql_num_rows( mysql_query( $query ) );

if( $result != 1 ){

echo "<strong class='error'>Invalid message ID</strong></body></html>";
exit;

} else {

mysql_query( "DELETE FROM shoutbox WHERE id = " . sqlesc( $id ) );

}

}

### INSERT NEW SHOUT
$sent = isset( $_GET['sent'] ) ? $_GET['sent'] : '';
$lastPost = isset( $_SESSION['last_post'] ) ? $_SESSION['last_post'] : 0;

if( $sent == "yes" ){

$userid = $CURUSER["id"];
$username = $CURUSER["username"];
$text = isset( $_GET["shbox_text"] ) ? trim( $_GET["shbox_text"] ) : '';

if( empty( $text ) ){

echo "<strong class='error'>You must write something!</strong>";

} else {

mysql_query( "INSERT INTO shoutbox (userid, username, date, text) VALUES (" . sqlesc( $userid ) . ", " . sqlesc( $username ) . ", UNIX_TIMESTAMP(NOW()), " . sqlesc( $text ) . ")" ) or sqlerr(__FILE__, __LINE__);

}

}

//print "<script type=\"text/javascript\">parent.document.forms[0].shbox_text.value='';</script>";

$ignoreSQL = !empty( $CURUSER['ignore_list'] ) ? "WHERE userid NOT IN( {$CURUSER['ignore_list']} ) " : "";

$res = mysql_query( "SELECT s.*, u.username, u.class, u.donor, u.warned
FROM shoutbox AS s
LEFT JOIN users AS u ON s.userid = u.id
{$ignoreSQL}
ORDER BY date DESC LIMIT 35" ) or sqlerr(__FILE__, __LINE__);

if( mysql_num_rows( $res ) > 0 ){

echo "<table cellspacing='0' cellpadding='2' class='small'>\n";

while( $arr = mysql_fetch_assoc( $res ) ){

$del = $edit = $pm = $ignore = '';
$usercolor = $arr['userid'] == 0 ? "<font color='red'><strong>Announcement</strong></font>" : getUserClassColor( $arr['class'], $arr['username'] );

if( get_user_class() >= UC_MODERATOR ){

$del="<span class='date'><a href='./shoutbox.php?del={$arr['id']}'><strong><font color='black'><img src='pic/button_delete.gif' alt='[D]' title='Delete' /></font></strong></a></span>";
$edit="<span class='date'><a href='./shoutbox.php?edit={$arr['id']}'><strong><font color='black'><img src='pic/button_edit.gif' alt='[E]' title='Edit' /></font></strong></a></span>\n";
$pm = $CURUSER['id'] != $arr['userid'] ? "<span class='date'><a href='./sendmessage.php?receiver={$arr['userid']}' target='_blank'><strong><font color='black'><img src='pic/button_pm1.gif' alt='[PM]' title='PM' /></font></strong></a></span>\n" : "";

}

if( $CURUSER['id'] != $arr['userid'] ){

$ignore = "<span class='date'><a href='./shoutbox.php?ignore={$arr['userid']}' onclick='if(!confirm(\"Are you sure you want to add " . htmlspecialchars( $arr['username'] ) . " to your ignore list?\")){return false;}'><strong><font color='black'><img src='pic/button_ignore.gif' alt='[I]' title='Add " . htmlspecialchars( $arr['username'] ) . " to ignore list' /></font></strong></a></span>";

}

$datum = gmdate( "d M h:i", $arr["date"] + ( $CURUSER['dst'] + $CURUSER["timezone"] ) * 60 );

echo "<tr><td class='col'><font color='black'><strong><span class='date'>[{$datum}]</span></strong></font>
{$del} {$edit} {$pm} {$ignore}
</td><td>
<a href='userdetails.php?id={$arr["userid"]}' target='_blank'>{$usercolor}</a> " .
( $arr["donor"] == "yes" ? "<img src='pic/star.gif' alt='DONOR' />" : "" ) .
( $arr["warned"] == "yes" ? "<img src='/pic/warned.gif' alt='Warned' />" : "" ) .
"<font color='black'>: <strong>" . format_comment( $arr["text"] ) . "</strong></font>
</td></tr>\n";

}

echo "</table>";

}

?>
</body>
</html>


on my.php, after tr("Save PMs",... or where ever you want this option to be...
Code (php) Select
### MY IGNORE LIST
$delimiter = ',';
$ignoreIDs = !empty( $CURUSER['ignore_list'] ) ? explode( $delimiter, $CURUSER['ignore_list'] ) : false;

if( $ignoreIDs ){

$multiSelect  = "<select name='ignore_list[]' multiple='multiple' style='width:200px;height:100px;'>";

$q = mysql_query( "SELECT id, username FROM users WHERE id IN( {$CURUSER['ignore_list']} ) ORDER BY username DESC" );

while( $res = mysql_fetch_assoc( $q ) ){

$multiSelect .= "<option value='{$res['id']}'>" . htmlspecialchars( $res['username'] ) . "</option>";

}

$multiSelect .= "</select>";
$multiSelect .= "<input type='submit' name='removeIgn' value='Remove!' />";
$multiSelect .= "<input type='submit' name='removeIgnAll' value='Remove all!' />";
$multiSelect .= '<p><small>Press down CTRL to select multiple users.</small></p>';

} else {

$multiSelect = 'Your ignore list is empty.';

}

tr( "Shoutbox Ignore List", $multiSelect ,1 );


and finally takeprofedit.php, i set this piece of code before $acceptpms = $_POST["acceptpms"];
Code (php) Select
### REMOVE FROM IGNORE LIST BASED ON SELECTED IDS
function checkIgn( $a ){
  global $idsToRemove;

return !in_array( $a, $idsToRemove ) ? true : false;

}

$delimiter = ',';
$removeIgn = isset( $_POST['removeIgn'] ) ? true : false;
$removeIgnAll = isset( $_POST['removeIgnAll'] ) ? true : false;
$idsToRemove = isset( $_POST['ignore_list'] ) ? ( is_array( $_POST['ignore_list'] ) ? $_POST['ignore_list'] : false ) : false;
$ignoreList = !empty( $CURUSER['ignore_list'] ) ? explode( $delimiter, $CURUSER['ignore_list'] ) : false;

if( $removeIgn && $ignoreList && $idsToRemove ){

$newIgnList = array_filter( $ignoreList, 'checkIgn' );

$updateset[] = "ignore_list = " . sqlesc( implode( $delimiter, $newIgnList ) );

}

if( $removeIgnAll && $ignoreList ){

$updateset[] = "ignore_list = ''";

}


if there are any bugs just leave a reply and i`ll try to fix it asap... in shoutbox you`ll have an [ I ] to ignore specific user... ex. if the current user has an ignore_list he wont see anymore shouts made by user xyz from ignore_list, but user xyz can see his shouts
enjoy!
cheers...

[attachment deleted by admin]

rabtb

yes shadow that seems to work ok

thanks again ;)

ShadoW69

try this shoutbox.php i updated most of the code, i need to know that its working for you 100% correctly so i can do the ignore as well...
Code (php) Select
<?
/*****************************
Hannes' ShoutBox v1.0
*****************************/
require_once("include/bittorrent.php");

dbconn(false);
loggedinorreturn();

if( $CURUSER["shoutboxpos"] == 'no' ){

stdmsg("","<center><font color=red><font size=3.5><b>You are not allowed to use the shoutbox, because your rights have been removed</b></font>");
//stdfoot();
exit;

}

### SIMILAR TO get_user_class_color
function getUserClassColor( $c, $u ){

switch( $c ){

case 17: $usercolor= "<font color='red'>" . htmlspecialchars( $u ) . "</font>"; break;
case 16: $usercolor= "<font color='red'>" . htmlspecialchars( $u ) . "</font>"; break;
case 15: $usercolor= "<font color='red'>" . htmlspecialchars( $u ) . "</font>"; break;
case 14: $usercolor= "<font color='red'>" . htmlspecialchars( $u ) . "</font>"; break;
case 13: $usercolor= "<font color='red'>" . htmlspecialchars( $u ) . "</font>"; break;
case 12: $usercolor= "<font color='red'>" . htmlspecialchars( $u ) . "</font>"; break;
case 11: $usercolor= "<font color='#2587A7'>" . htmlspecialchars( $u ) . "</font>"; break;
case 10: $usercolor= "<font color='#B000B0'>" . htmlspecialchars( $u ) . "</font>"; break;
case 9: $usercolor= "<font color='#347235'>" . htmlspecialchars( $u ) . "</font>"; break;
case 8: $usercolor= "<font color='#0000CC'>" . htmlspecialchars( $u ) . "</font>"; break;
case 7: $usercolor= "<font color='#6464FF'>" . htmlspecialchars( $u ) . "</font>"; break;
case 6: $usercolor= "<font color='#FFFF00'>" . htmlspecialchars( $u ) . "</font>"; break;
case 5: $usercolor= "<font color='#806517'>" . htmlspecialchars( $u ) . "</font>"; break;
case 4: $usercolor= "<font color='#F87431'>" . htmlspecialchars( $u ) . "</font>"; break;
case 3: $usercolor= "<font color='#3EA99F'>" . htmlspecialchars( $u ) . "</font>"; break;
case 2: $usercolor= "<font color='#A74AC7'>" . htmlspecialchars( $u ) . "</font>"; break;
case 1: $usercolor= "<font color='#E78A61'>" . htmlspecialchars( $u ) . "</font>"; break;
default: $usercolor= "<font color='#FAAFBE'>" . htmlspecialchars( $u ) . "</font>";

}

return $usercolor;

}

### SHOULDN`T BE USING THIS, ITS OLD ALSO ITS OUTSIDE OF HTML TAG ( PATCH FOR THIS IS TO USE CSS ex. img{ max-width: 280px; } )
$imgResizeScript = '
<script type="text/javascript" src="ncode_imageresizer.js"></script>
<script type="text/javascript">
<!--
NcodeImageResizer.MODE = "newwindow";
NcodeImageResizer.MAXWIDTH = 280;
NcodeImageResizer.MAXHEIGHT = 0;

NcodeImageResizer.Msg1 = "Click this bar to view the full image.";
NcodeImageResizer.Msg2 = "This image has been resized. Click this bar to view the full image.";
NcodeImageResizer.Msg3 = "This image has been resized. Click this bar to view the full image.";
NcodeImageResizer.Msg4 = "Click this bar to view the small image.";
//-->
<!--Image Resizer v0.1 by xam//-->
</script>';

// EDIT SHOUT ?
if( isset( $_GET['edit'] ) && get_user_class() >= UC_MODERATOR && is_valid_id( $_GET['edit'] ) ){

$sql = mysql_query( "SELECT id, text FROM shoutbox WHERE id = " . sqlesc( $_GET['edit'] ) );
$res = mysql_fetch_assoc( $sql );

if( mysql_num_rows( $sql ) == 1 ){

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset;?>" />
<style type="text/css">
#specialbox{ border: 1px solid gray; width: 600px; background: #FBFCFA; font: 9px verdana, sans-serif; color: #443; padding: 3px; outline: none; }
#specialbox:focus{ border: 1px solid black; }
.btn{ cursor:pointer; border:outset 1px #ccc; background:#999; color:#666; font-weight:bold; padding: 1px 2px; background:url('<?php echo $pic_base_url;?>formbg.gif') repeat-x left top; }
</style>
<?php echo $imgResizeScript;?>
</head>
<body bgcolor="#F5F4EA">
<form method="post" action="shoutbox.php">
<input type="hidden" name="id" value="<?php echo $res['id'];?>" />
<textarea name="text" rows="3" id="specialbox"><?php echo htmlspecialchars$res['text'] );?></textarea>
<input type="submit" name="save" />
</form>
</body>
</html>
<?php

die;

}

}

// UPDATE SHOUT?
if( isset( $_POST['text'] ) && get_user_class() >= UC_MODERATOR && is_valid_id$_POST['id'] ) ){

$text trim$_POST['text'] );
$id = (int)$_POST['id'];

if( isset( $text ) && isset( $id ) && is_valid_id$id ) )

mysql_query"UPDATE shoutbox SET text = " sqlesc$text ) . " WHERE id = " sqlesc$id ) );

}

//deleting messages
if( isset( $_GET['del'] ) && get_user_class() >= UC_MODERATOR ){

$id = (int)$_GET['del'];

$query "SELECT * FROM shoutbox WHERE id = " sqlesc$id );
$result mysql_num_rowsmysql_query$query ) );

if( $result != ){

echo "<center>Invalid message ID</center>";
exit;

} else {

mysql_query"DELETE FROM shoutbox WHERE id = " sqlesc$id ) );

}

}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ShoutBox</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />
<meta http-equiv="refresh" content="2000; url=shoutbox.php" />
<style type="text/css">
a{color: #000000; font-weight: bold; }
a:hover{color: #FF0000;}
.small{font-size: 8pt; font-family: tahoma; }
.date{font-size: 8pt;}
body{/* background-color: #F0F8FF; */ background-color: #CDC9C9; SCROLLBAR-3DLIGHT-COLOR: #004E98; SCROLLBAR-ARROW-COLOR: #004E98; SCROLLBAR-DARKSHADOW-COLOR: black; SCROLLBAR-BASE-COLOR: black; }
</style>
<?php echo $imgResizeScript;?>
</head>
<body>
<?
if( @$_GET["sent"] == "yes" ){

$userid = $CURUSER["id"];
$username = $CURUSER["username"];
$text = trim( @$_GET["shbox_text"] );

if( empty( $text ) ){

echo "<center><b><font color='red'>you must write something!</font></b>";

} else {

mysql_query( "INSERT INTO shoutbox (userid, username, date, text) VALUES (" . sqlesc( $userid ) . ", " . sqlesc( $username ) . ", UNIX_TIMESTAMP(NOW()), " . sqlesc( $text ) . ")" ) or sqlerr(__FILE__, __LINE__);

}

}

//print "<script type=\"text/javascript\">parent.document.forms[0].shbox_text.value='';</script>";

$res = mysql_query( "SELECT s.*, u.username, u.class, u.donor, u.warned
FROM shoutbox AS s
LEFT JOIN users AS u ON s.userid = u.id
ORDER BY date DESC LIMIT 35" ) or sqlerr(__FILE__, __LINE__);

if( mysql_num_rows( $res ) > 0 ){

echo "<table border=0 cellspacing=0 cellpadding=2 width='100%' align='left' class='small'>\n";

while( $arr = mysql_fetch_assoc( $res ) ){

$del = $edit = $pm = $ignore = '';
$usercolor = $arr['userid'] == 0 ? "<font color=red><b>Announcement</b></font>" : getUserClassColor( $arr['class'], $arr['username'] );

if( get_user_class() >= UC_MODERATOR ){

$del="<span class='date'><a href='/shoutbox.php?del=" . $arr['id'] . "'><b><font color=black><img border=0 src=pic/button_delete.gif></font></b></a></span>";
$edit="<span class='date'><a href='/shoutbox.php?edit=" . $arr['id'] . "'><b><font color=black><img border=0 src=pic/button_edit.gif></font></b></a></span>\n";
$pm = "<span class='date'><a target=_blank href='/sendmessage.php?receiver=" . $arr['userid'] . "'><b><font color=black><img border=0 src=pic/button_pm1.gif></font></b></a></span>\n";

}

$datum = gmdate( "d M h:i", $arr["date"] + ( $CURUSER['dst'] + $CURUSER["timezone"] ) * 60 );
echo "<tr><td><font color=black><b><span class='date'>[{$datum}]</b></font>

{$del} {$edit} {$pm} {$ignore}

<a href='userdetails.php?id=" . $arr["userid"] . "' target='_blank'>{$usercolor}</a> " .

( $arr["donor"] == "yes" ? "<img src=pic/star.gif alt='DONOR'>" : "" ) .

( $arr["warned"] == "yes" ? "<img src="."/pic/warned.gif alt='Warned'>" : "" ) .

" <font color=black>: <b>" . format_comment( $arr["text"] ) . "</b></font>
</td></tr>\n";

}

echo "</table>";

}
?>
</body>
</html>


rabtb

thanks mindless any extra input appreciated

shadow wow thanks for taking the time to post il give that code a go on my test site and see how i get on

my shoutbox...
<?

/*****************************



Hannes' ShoutBox v1.0



*****************************/



require_once("include/bittorrent.php");

dbconn(false);



loggedinorreturn();



if ($CURUSER["shoutboxpos"] == 'no')

{

stdmsg("","<center><font color=red><font size=3.5><b>You are not allowed to use the shoutbox, because your rights have been removed</b></font>");

//stdfoot();

exit;

}
?>
<script type="text/javascript" src="ncode_imageresizer.js"></script>
<script type="text/javascript">
<!--
NcodeImageResizer.MODE = 'newwindow';
NcodeImageResizer.MAXWIDTH = 280;
NcodeImageResizer.MAXHEIGHT = 0;

NcodeImageResizer.Msg1 = 'Click this bar to view the full image.';
NcodeImageResizer.Msg2 = 'This image has been resized. Click this bar to view the full image.';
NcodeImageResizer.Msg3 = 'This image has been resized. Click this bar to view the full image.';
NcodeImageResizer.Msg4 = 'Click this bar to view the small image.';
//-->
<!--Image Resizer v0.1 by xam//-->
</script>
<?

// EDIT SHOUT ?

if (isset($_GET['edit']) && get_user_class() >= UC_MODERATOR && is_valid_id($_GET['edit']))

{

        $sql=mysql_query("SELECT id,text FROM shoutbox WHERE id=".sqlesc($_GET['edit']));

        $res=mysql_fetch_array($sql);

        if (!empty($res)) {

        ?>

        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

        <html xmlns="http://www.w3.org/1999/xhtml">

        <meta http-equiv="Pragma" content="no-cache">

        <meta http-equiv="expires" content="0">

        <head profile="http://gmpg.org/xfn/11">

        <meta http-equiv="Content-Type" content="text/html; charset=<?=$charset;?>" />

        <style type="text/css">

        #specialbox{

        border: 1px solid gray;

        width: 600px;

        background: #FBFCFA;

        font: 9px verdana, sans-serif;

        color: #443;

        padding: 3px;        outline: none;

        }



        #specialbox:focus{

        border: 1px solid black;

        }

        .btn {

        cursor:pointer;

        border:outset 1px #ccc;

        background:#999;

        color:#666;

        font-weight:bold;

        padding: 1px 2px;

        background:url(<?=$pic_base_url;?>formbg.gif) repeat-x left top;

        }

        </style>

        </head>

        <body bgcolor=#F5F4EA>

        <?php

        
echo '<form method=post action=shoutbox.php>';

        echo 
'<input type=hidden name=id value='.(int)$res['id'].'>';

        echo 
'<textarea name=text rows=3 id=specialbox>'.htmlspecialchars($res['text']).'</textarea>';

        echo 
'<input type=submit name=save>';

        echo 
'</form></body></html>';

        die;

        }

}

// UPDATE SHOUT?

if (isset($_POST['text']) && get_user_class() >= UC_MODERATOR && is_valid_id($_POST['id']))

{

        
$text trim($_POST['text']);

        
$id = (int)$_POST['id'];

        if (isset(
$text) && isset($id) && is_valid_id($id))

                
mysql_query("UPDATE shoutbox SET text = ".sqlesc($text)." WHERE id=".sqlesc($id));

}



//deleting messages



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

{

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

{

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

$result mysql_query($query);

}

else {

echo 
"<center>Invalid message ID</center>";

exit;}



$row mysql_fetch_row($result);



if ( (
get_user_class() >= UC_MODERATOR) )

{

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

mysql_query($query);

}

}



?>


<html><head>

<title>ShoutBox</title>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">

<META HTTP-EQUIV=REFRESH CONTENT="2000; URL=shoutbox.php">

<style type="text/css">

A {color: #000000; font-weight: bold; }

A:hover {color: #FF0000;}

.small {font-size: 8pt; font-family: tahoma; }

.date {font-size: 8pt;}

</style>

<STYLE>BODY {

//background-color: #F0F8FF;

background-color: #CDC9C9;

SCROLLBAR-3DLIGHT-COLOR: #004E98;

SCROLLBAR-ARROW-COLOR: #004E98;

SCROLLBAR-DARKSHADOW-COLOR: black;

SCROLLBAR-BASE-COLOR: black;

}

</STYLE>





</head>

<body>

<?



if($_GET["sent"]=="yes")

{

$userid=$CURUSER["id"];

$username=$CURUSER["username"];



$text=trim($_GET["shbox_text"]);



if (empty($text))

{

print("<center><b><font color='red'>you must write something!</font></b>");

}

else {



mysql_query("INSERT INTO shoutbox (id, userid, username, date, text) VALUES ('id'," . sqlesc($userid) . ", " . sqlesc($username) . ", UNIX_TIMESTAMP(NOW()), " . sqlesc($text) . ")") or sqlerr(__FILE__, __LINE__);

}

}





//print "<script type=\"text/javascript\">parent.document.forms[0].shbox_text.value='';</script>";

$res = mysql_query("SELECT * FROM shoutbox ORDER BY date DESC LIMIT 35") or sqlerr(__FILE__, __LINE__);

if (mysql_num_rows($res) == 0)

print("\n");

else

{

print("<table border=0 cellspacing=0 cellpadding=2 width='100%' align='left' class='small'>\n");



while ($arr = mysql_fetch_assoc($res))

{

$res2 = mysql_query("SELECT username,class,avatar,donor, title,enabled,warned FROM users WHERE id=$arr[userid]") or sqlerr(__FILE__, __LINE__);

$arr2 = mysql_fetch_assoc($res2);

$resowner = mysql_query("SELECT id, username, class FROM users WHERE id=$arr[userid]") or print(mysql_error());

$rowowner = mysql_fetch_array($resowner);





if ($rowowner["class"] == "17")
$usercolor= "<font color=red>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "16")
$usercolor= "<font color=red>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "15")
$usercolor= "<font color=red>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "14")
$usercolor= "<font color=red>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "13")
$usercolor= "<font color=red>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "12")
$usercolor= "<font color=red>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "11")
$usercolor= "<font color=#2587A7>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "10")
$usercolor= "<font color=#B000B0>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "9")
$usercolor= "<font color=#347235>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "8")
$usercolor= "<font color=#0000CC>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "7")
$usercolor= "<font color=#6464FF>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "6")
$usercolor= "<font color=#FFFF00>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "5")
$usercolor= "<font color=#806517>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "4")
$usercolor= "<font color=#F87431>" .htmlspecialchars($rowowner["username"]). "</font>";

elseif ($rowowner["class"] == "3")
$usercolor= "<font color=#3EA99F>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "2")
$usercolor= "<font color=#A74AC7>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "1")
$usercolor= "<font color=#E78A61>" .htmlspecialchars($rowowner["username"]). "</font>";
elseif ($rowowner["class"] == "0")
$usercolor= "<font color=#FAAFBE>" .htmlspecialchars($rowowner["username"]). "</font>";
if ($arr["userid"] == '0')
$usercolor = "<font color=red><b>Announcement</b></font>";


if (get_user_class() >= UC_MODERATOR) {


$del="<span class='date'><a href=/shoutbox.php?del=".$arr[id]."><b><font color=black><img border=0 src=pic/button_delete.gif></font></b></a></span>";

$edit="<span class='date'><a href=shoutbox.php?edit=".$arr[id]."><b><font color=black><img border=0 src=pic/button_edit.gif></font></b></a></span>\n";

$pm = "<span class='date'><a target=_blank href=sendmessage.php?receiver=$rowowner[id]><b><font color=black><img border=0 src=pic/button_pm1.gif></font></b></a></span>\n";
}



$datum = gmdate("d M h:i",$arr["date"] + ($CURUSER['dst'] + $CURUSER["timezone"]) * 60);
print("<tr><td><font color=black><b><span class='date'>[$datum]</b></font>

$del $edit $pm



<a href='userdetails.php?id=".$arr["userid"]."' target='_blank'>$usercolor</a> " .

($arr2["donor"] == "yes" ? "<img src=pic/star.gif alt='DONOR'>" : "") .

($arr2["warned"] == "yes" ? "<img src="."/pic/warned.gif alt='Warned'>" : "") .

" <font color=black>: <b>".format_comment($arr["text"])."</b></font>

</td></tr>\n");

}

print("</table>");





}





?>

</body>

</html>

ShadoW69

my first thought on the matter would be to create a new field in users type text, maybe something like this
Code (mysql) Select
ALTER TABLE users ADD ignore_list TEXT NOT NULL

second in this field you enter data as follows... the comma is the delimiter for userids ( userid delimiter userid delimiter userid delimiter userid etc. )
Quote23,7634,3,845,56,965,5347,645,123,457

so for ex. in shoutbox near username you could have a link something like this <a href='shoutbox.php?action=ignore&amp;id={$shout['userid']}'>Ignore {$shout['username']}</a>
in shoutbox.php than you check for action ignore and update the ignore_list
Code (php) Select
if( $action == 'ignore' ){
$ID = isset( $_GET['id'] ) ? (int) $_GET['id'] : 0;
$delimiter = !empty( $CURUSER['ignore_list'] ) ? ',' : '';
$newIgnID = mysql_real_escape_string( $delimiter . $ID );
$updateSQL = "UPDATE users SET ignore_list = CONCAT( ignore_list, '{$newIgnID}' ) WHERE id = '{$CURUSER['id']}' LIMIT 1";
$update = mysql_query( $updateSQL );
if( $update ){ echo 'Ignore List updated succesfully.'; }
else{ echo 'Failed to update ignore list.'; }
}


and somewhere else where you need to have the query to select all the shouts something like
Code (mysql) Select
SELECT * FROM shoutbox

you can than modify it somewhat like this
Code (mysql) Select
SELECT * FROM shoutbox WHERE userid NOT IN ( {$CURUSER['ignore_list']} )

now most of the code is theoretical because i dont have a shoutbox from tbdev 08, but the impact on the DB wouldnt be major...
if you can post your shoutbox than maybe i can cook up some working code for you...

Mindless

#2
Kinda like an ignore feature, aye thats achievable using some sql basically, no sure how heavy it would get, let me fuck about first, expand to comments, forums via a ignore button, mechanics of the system will be straight forward to an extent i would imagine as i can pretty much visualize the logic required as it is =]

rabtb

sorry if this is posted in wrong place
yes still on tbdev 08 lol plans are in place to change to u232 as well this IS where all the top dogs are ;) respect to all u guys you have been doing great work for the comunity for many years ;)

ok im not much of a coder but i do try lol , dont post much as can norm find what im after searching reading all comments ect 

so what im after is mod to hide user from another user in shoutbox
ex. bill and bob dont get along so i add bill user id to bob acc then they cant see each others shouts

that seems easiest way to do it but im no coder to write something like that myself and my m8s that could do it are busy with rl at mo.

id be gratefull for anything even advise on how to go about it

thanks

ps. /me awaits the replys "f*** of and learn some basic html php noob"
lol