Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Security - Other
Author Message
Dauthus
Worker
Worker



Joined: Oct 07, 2003
Posts: 211

PostPosted: Mon Sep 20, 2004 5:25 pm Reply with quote

I have run into an error when installing a phpbb forum and am stumped. I haven't seen anything like this before, and after several hours of google searching, I haven't been able to find a solution.

I was just wondering if any of the PHP/SQL gurus here have run into it before.

The error is as follows:

SQL Error : 1062 Duplicate entry '32767' for key 1

This happens when installing a second forum. The first forum always has the forum_id of 32767, and no matter how I change it, it still always wants to create new forums with that forum_id.

Changing the SMALLINT to BIGINT, fixes the problem, but adds negative forum_id numbers to any added forum. I think this could cause a problem with forum permissions.

Any ideas?

Edit: I forgot to say, some of the forum_id are negative from the install. It seems they have to be due to one of the permission hacks. The negative ID keeps the forums hidden from normal add/delete forums. One is the Knowledge Base permissions.
 
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Mon Sep 20, 2004 7:47 pm Reply with quote

What is the physical structure of the two forums? What I mean is, are they on the same server but in 2 different databases? Are you trying to access them both with the same MySQL connection?
 
View user's profile Send private message
chatserv
Member Emeritus



Joined: May 02, 2003
Posts: 1389
Location: Puerto Rico

PostPosted: Mon Sep 20, 2004 7:59 pm Reply with quote

SQL Error : 1062 Duplicate entry '32767' for key 1

errors like that often occur when a db table you are trying to create already exists
 
View user's profile Send private message Visit poster's website
Dauthus







PostPosted: Tue Sep 21, 2004 1:21 am Reply with quote

I guess the easiest way to explain it is by comparing it to a forum in nuke. Lets say I just installed PHPNuke and now am going to create the forum categories and the individual forums.

I create the first category and call it Test Category. Inside this category I create a forum called Test Forum 1. For some reason Test Forum 1 has a forum_id in the table of 32767.

Now I create another forum in the Test Category. Lets call this Test Forum 2. When I create this forum, I get the above error. If I change the forum_id properties to BIGINT instead of SMALLINT, the table will accept the forum_id, but the numbers will be a negative value. Like -2, -3, etc...

Kind of strange, huh?
 
Raven







PostPosted: Tue Sep 21, 2004 7:53 am Reply with quote

What is the value of Next Autoindex for forum_id? Is that what you have been changing?
 
Dauthus







PostPosted: Tue Sep 21, 2004 1:11 pm Reply with quote

Yea. The default install gives the value at 32767. I have tried changing this to 2 since one forum has already been created (a Test Forum) in the default install. When I change it to 2, and click on go, it defaults back to 32767. As long as there are negative forum ID numbers, the default setup won't work.

I just can't figure this one out. I looked to make sure I have all the fixes for my version of PHP and MYSQL, and they are all up to date. I don't have the newest version, but I do have the last stable version with all the updated patches.

For some reason a negative forum_id value doesn't work with the SMALLINT and auto_increment. I thought maybe changing the Attributes to UNASSIGNED would help, but that won't allow a negative forum_id.

One thing to note, this doesn't effect every server. It causes a problem on some, but it works on others. I am running:

Os: Linux d
PHP: 4.3.8
MySQL: 3.23.58

Edit: Also, I can manually add the forums in by hand using the PHPMyAdmin. And it accepts the forum_id of 2 and 3 and etc. Could it be the auto_increment for the forum_id isn't working, or the call for this function when creating a forum in the forum_admin.php isn't correct?
 
Dauthus







PostPosted: Wed Sep 22, 2004 3:39 pm Reply with quote

Just an FYI. I found the solution. It seems some of the code in the admin_forum.php was left out since the auto index was turned on. Replacing the code fixed the problem and the forums now update as they are supposed to.

Thanks for getting me thinking.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Security - Other

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©