PDA

View Full Version : [fixed] Doubles in buddylist


Robert9
Mon 11th Aug '03, 3:48pm
When adding a buddy or ignore with the form a user could add a thousand times the same user, because

$listids.=" $userid[userid]";

There is no test if the userid is still in the list.
Cant imagine why such a fault is still here inside?!

Maybe most people dont use this function, while i program a reverse buddy list at the moment itīs important to have the right values inside my buddylist and ignorelist fields.

Have someone coded this piece ?

Steve Machol
Mon 11th Aug '03, 3:59pm
I could not duplicate this problem on my unhacked 2.3.2 test forum. Adding someone a second time to either list did not result in duplicate listings.

What version are you running and have you installed any hacks?

Robert9
Mon 11th Aug '03, 4:20pm
Try to see the data with mysqladmin, you will see that the userid is twice times inside the field.

I have looked for the orginalcode in 2.3.2 and find no change in my version. When looked at the code i found this structure:

while list ...
get userid from sql
(if ignore test on usergroups)
if ignore_user ...
elseif cantitself ...
else $listids .= $userid

So there is no test, if the userid is still inside the list.
I havenīt watch "show buddies"-part at all, because i use
some quite different scripts.

I will code it and post it here in some minutes.

Robert9
Mon 11th Aug '03, 4:33pm
Have tested it yet

Before the while we need
$cnt ='0';

then instead of $listids.=" $userid[userid]";
i use something like this:

$twice = '0';
for ($j=0;$j<=$cnt;$j++) {
if ($container[$j] == $userid[userid]) {
$twice = '1';
}
}
if ($twice != '1') {
$container[$cnt] = $userid[userid];
$listids.=" $userid[userid]";
}
$cnt++;

Steve Machol
Mon 11th Aug '03, 7:00pm
Yes I see the double entry in the database, but only one instance shows up in the Admin CP. Moving to Bugs anyway.

Robert9
Mon 11th Aug '03, 9:44pm
I think most of people will not see this. If you are interested in, i could send some things more like this. While i have hacked the board for the last three weeks i found some things more, that nobody will see in a normal way, but while i use a lot of queries i need clean filled fields.

Robert

Paul
Tue 19th Aug '03, 6:46pm
I think most of people will not see this. If you are interested in, i could send some things more like this. While i have hacked the board for the last three weeks i found some things more, that nobody will see in a normal way, but while i use a lot of queries i need clean filled fields.

Robert

I'm sure the developers would appreciate you helping them sort out any bugs you may have found while using the product. Please be forthcoming with any such information you may have.

Mike Sullivan
Thu 6th Nov '03, 1:33pm
In member2.php, find:
$listids="";

Above it add:
$splitlist = explode(' ', $bbuserinfo[$var]);

Now find:
$listids.=" $userid[userid]";

Replace it with:
$found = 0;
while (list($key, $val) = each($splitlist)) {
if ($val == $userid['userid']) {
$found = 1;
}
}
if (!$found) {
$listids .= " $userid[userid]";
$splitlist[] = $userid['userid'];
}