Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
Savent
Regular
Regular


Joined: Jun 30, 2003
Posts: 81

PostPosted: Fri Dec 31, 2004 1:38 am Reply with quote

Hi all,
Not sure if Im posting this in the right board, move it by all means if its in the wrong board. I searched about 20 nuke help sites, browed countless forums threads on this problem. With phpbb forums 2.0.11 when a guest post a message in the forums, (works fine for registerd members) they get that lovely debug message:

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax near ' 1102722604, 3, 0, 0, 0)' at line 1

INSERT INTO nuke_bbtopics (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote) VALUES ('Day of Reckoning', , 1102722604, 3, 0, 0, 0)

Line : 258
File : /home2/www/xxxxxxxx/includes/functions_post.php

Telli and his crew over at codezwiz are looking for a fix to this, as you can see here: Only registered users can see links on this board! Get registered or login! they said something about phpbb 2.0.11 is making the annoymous id -1 instead of it being 1. So bascially everybody has to set posting on the forums to registerd members only, untill there is a fix- correct? I never knew I had this problem on my nuke site untill one of my members pm'd me, and told me they tried to post as a guest, so I tried it, and I got that debug message posting as a guest...... I decided to see what the experts here might think Smile

_________________
Only registered users can see links on this board! Get registered or login! [Online Arcade 340+ Games]
Image 
View user's profile Send private message Send e-mail Visit poster's website
hitwalker
Sells PC To Pay For Divorce


Joined:
Posts: 5661

PostPosted: Fri Dec 31, 2004 8:27 pm Reply with quote

The experts?....he.....he...

They are somewhere...

between... Cheers

and

Wave

Happy new year
 
View user's profile Send private message
PHrEEkie
Subject Matter Expert


Joined: Feb 23, 2004
Posts: 358

PostPosted: Fri Dec 31, 2004 11:15 pm Reply with quote

Go into your /includes/constants.php and look for:
Code:
// User Levels <- Do not change the values of USER or ADMIN

define('DELETED', -1);
define('ANONYMOUS', 1);


Does your Anon say -1? If so, change it to 1, save the file and test it...

Chat changed the constants.php to 1 from the new phpBB default of -1, so if you used his patches, I don't know whether or not this will help you... I posted over at Nukefixes on how to convert the DB from Anonymous user_id of 1 to -1. If the above doesn't get you up and running, do a DB backup (you only need to backup the affected bb tables and the users table), then try the conversion at Nukefixes. If you need the post #, give a holler and I'll find it for you.

PHrEEk

_________________
PHP - Breaking your legacy scripts one build at a time. 
View user's profile Send private message
chatserv
Member Emeritus


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

PostPosted: Sat Jan 01, 2005 9:08 pm Reply with quote

It should be 1 and not -1, while -1 does indeed give anonymous users a unique id it causes problems in that it can make the nextid value a very large number which results in the users db table getting locked. In theory it looked nice but in practice it failed so it was removed from 2.0.11
 
View user's profile Send private message Visit poster's website
PHrEEkie
PostPosted: Sat Jan 01, 2005 9:57 pm Reply with quote

chatserv wrote:
It should be 1 and not -1, while -1 does indeed give anonymous users a unique id it causes problems in that it can make the nextid value a very large number which results in the users db table getting locked. In theory it looked nice but in practice it failed so it was removed from 2.0.11


Ok, let's patch that... I did that almost 2 years ago, but it wasn't anything I ever posted. The problem is that phpBB pulls the highest user_id then adds 1 to it. It then 'defines' the user_id in the INSERT instead of letting MySQL do it. I don't know if this is for portability between DB types, but I've never seen it done this way. Since it did cause problems, I reverted it back to letting MySQL pick the next user_id. Here's the fix:

Open /includes/usercp_register

Find:
Code:
$sql = "SELECT MAX(user_id) AS total

        FROM " . USERS_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
    message_die(GENERAL_ERROR, 'Could not obtain next user_id information', '', __LINE__, __FILE__, $sql);
}

if ( !($row = $db->sql_fetchrow($result)) )
{
    message_die(GENERAL_ERROR, 'Could not obtain next user_id information', '', __LINE__, __FILE__, $sql);
}
$user_id = $row['total'] + 1;


Comment out that entire section:
Code:
// $sql = "SELECT MAX(user_id) AS total

//         FROM " . USERS_TABLE;
// if ( !($result = $db->sql_query($sql)) )
// {
//     message_die(GENERAL_ERROR, 'Could not obtain next user_id information', '', __LINE__, __FILE__, $sql);
// }

// if ( !($row = $db->sql_fetchrow($result)) )
// {
//     message_die(GENERAL_ERROR, 'Could not obtain next user_id information', '', __LINE__, __FILE__, $sql);
// }
// $user_id = $row['total'] + 1;


Right below that, find:
Code:
$sql = "INSERT INTO " . USERS_TABLE . "        (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey)

VALUES ('$user_id', '" . str_replace("\'", "''", $username) . "', '" . $reg_date . "', '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', '$attachsig', '$allowsmilies', '$allowhtml', '$allowbbcode', '$allowviewonline', '$notifyreply', '$notifypm', '$popup_pm', '$user_timezone', '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', '$user_style', '1', '1', ";


All we need to do here is remove $user_id from the VALUES, leaving two back-ticks in its place. '$user_id' becomes ''

INSERTing a non-value into user_id, which is an auto-increment field, tells MySQL to select the next available integer, and I've yet to see this fail. Ok, phpBB registration relies on knowing what that user_id was to finish up its process, so let's pull it from the DB. Right below the INSERT statement we altered above, find:
Code:
if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )

{
    message_die(GENERAL_ERROR, 'Could not insert data into users table', '', __LINE__, __FILE__, $sql);
}


Right below that, add:
Code:
$user_id = $db->sql_nextid();


That, of course, polls MySQL for the last user_id it created, and we assign it to $user_id so that phpBB can continue the process of creating a usergroup, etc... Very old and obnoxious port bug squashed... I use it on over 30 production sites, and it works great.

PS - This is ONLY for people who use Forums registration for new users. If you use Nuke's Your Account for new user registration, this hack will do absolutely nothing for you...

PHrEEk
 
chatserv
PostPosted: Sun Jan 02, 2005 12:17 pm Reply with quote

Please send me this modified file PHrEEkie

chatserv at nukeresources dot com
 
PHrEEkie
PostPosted: Sun Jan 02, 2005 4:18 pm Reply with quote

Emailed you a modified Nuke 7.5 Chatserv 2.8 patched usercp_register.php

Should be 2.0.11 compliant, with the fix above added.

PHrEEk
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

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 ©