UBB.Dev
Ubb threads 6.0.2

I removed this from the addpost.php file:

// ----------------------------------------------------------------
// Now we need to see if this post has already been made, basically
// protects from spamming

$query = "
SELECT B_Number
FROM w3t_Posts
WHERE B_Username = '$Username_q'
AND B_Subject = '$Subject_q'
AND B_Body = '$BodySig'
AND B_Board = '$Board_q'
";
$sth = $dbh -> do_query($query);
list($B_Number) = $dbh -> fetch_array($sth);
if ($B_Number) {
$html -> not_right($ubbt_lang['NO_DUPS'],$Cat);
}


Now this let me post two replies with the same subject and no body...which is what the users want to be able to do. But when I posted 2 new threads it resulted in errors viewing those 2 threads/topics:
"There was a problem looking up the post in our database"

Does anyone have suggestions as to how I can allow users to reply to different topics with the same response they had in another topic in the same forum?

Thanks.
Posted By: RandyJG Re: Attempt 2 - 12/16/2002 1:20 AM
I also tried adding a restriction of having the Parent id match. This was to allow no duplicates within a sub-thread and no duplicate topics. This appeared to work, but this also has the same error when viewing a new topic that matches a reply to a topic.
Posted By: Dave_L_dup1 Re: Attempt 2 - 12/16/2002 2:26 AM
Have you considered upgrading to 6.1.1 (or 6.2br2)?

It might not automatically resolve the problem, but it could make it easier for other people to assist you with this, since most people here are probably using 6.1.1.
Posted By: bud Re: Attempt 2 - 12/16/2002 6:38 PM
You've got a little flawed logic here. After adding a post the routine tries to determine the post number by looking up the post using subject, body, board, and user name. In your case, this isn't a unique post.

A simple fix would be to change select following the insert of the post to include the date posted in the where clause:

// ------------------------------------------------------------------
// Now we need to find out what the number of the post we entered was
$query = "
SELECT B_Number
FROM w3t_Posts
WHERE B_Username= '$Username_q'
AND B_Subject = '$Subject_q'
AND B_Body = '$BodySig'
AND B_Board = '$Board_q'
AND B_Posted = '$date'
";
$sth = $dbh ->do_query($query);
list($Mnumber) = $dbh -> fetch_array($sth);
Posted By: RandyJG Re: Attempt 2 - 12/17/2002 2:25 AM
That appears to be the problem, fetching the new entry with a non-secondary key with the assumption there's no duplicates. It's working now.

Thanks
© UBB.Developers