News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

SQL problem when new user registers

Started by b4pjoe, January 05, 2009, 10:51:38 PM

Previous topic - Next topic

b4pjoe

I've made a fresh install of SMF 2.0 Beta 4 and Mambo 4.6.5 and bridged them with smf_2-0_mambo_4-6_bridge_2-0b1. It's on a godaddy server and both are using the same database. Creating a new user on the stand alone of both Mambo and SMF both works with no errors. After bridging them and using SMF registration when a new user registers I get two SQL errors in my SMF log.

http://www.b4print.com/mambo/forums/index.php?option=com_smf&Itemid=39&action=register2

2: mysql_fetch_row(): supplied argument is not a valid MySQL result resource

File: /home/content/b/4/p/b4printadmin/html/mambo/components/com_smf/smf.php
Line: 1067

and

http://www.b4print.com/mambo/forums/index.php?option=com_smf&Itemid=39&action=register2

2: mysql_fetch_row(): supplied argument is not a valid MySQL result resource

File: /home/content/b/4/p/b4printadmin/html/mambo/components/com_smf/smf.php
Line: 1079


It does go ahead and creates the user in both SMF and Mambo. Deleting users from SMF deletes the user in both Mambo and SMF without any errors. Deleting the user from Mambo does NOT delete the user from SMF.

Does anyone know what is causing this, obviously it is in the bridge as the file in the error message (smf.php) is part of the bridge? I got this exact same error on an Ubuntu server with fresh install and now I'm getting them on fresh installs on the godaddy server. Any help or info would be greatly appreciated.

b4pjoe

So, no one else is seeing this problem or it's just so minor I should ignore it since the users are getting created?

Orstio

Are you using the same real name or email address as a previous registration?

Are all of these fields in the mos_core_acl_aro table:

aro_id, section_value, value, order_value, name, hidden

QuoteDeleting the user from Mambo does NOT delete the user from SMF.

Do you have the SMF_user_delete mambot published?

b4pjoe

Quote from: Orstio on January 19, 2009, 07:05:09 PM
Are you using the same real name or email address as a previous registration?

Are all of these fields in the mos_core_acl_aro table:

aro_id, section_value, value, order_value, name, hidden

QuoteDeleting the user from Mambo does NOT delete the user from SMF.

Do you have the SMF_user_delete mambot published?

Thank you for the reply.

No, I've tried using all new information for the real name and email address. I see that you registered today and it generated the same SQL errors listed above.

All of the fields in the mos_core_acl_aro table are exactly as you listed them.

And yes, the SMF_user_delete mambot is published.

If it would help to give you admin access to this test site just let me know.

Orstio

Try this.

In smf.php, you should find this around the line of the error:

$mos_find_userid = mysql_query("
SELECT `id`
FROM " . $configuration->get('mosConfig_dbprefix') . "users
WHERE username = " . $Options['register_vars']['member_name'] . "
LIMIT 1");


Change it to this:

$mos_find_userid = mysql_query("
SELECT `id`
FROM " . $configuration->get('mosConfig_dbprefix') . "users
WHERE username = '" . $Options['register_vars']['member_name'] . "'
LIMIT 1");

b4pjoe

Thank you Orstio. Changing those lines got rid of the first error but I still had the second error. Using the changes you gave me I then applied the same kind of change to these lines closer to the second error from this:

$mos_map_sql = mysql_query("
SELECT aro_id
FROM " . $configuration->get('mosConfig_dbprefix') . "core_acl_aro
WHERE name = " . $Options['register_vars']['real_name'] . "
LIMIT 1");


To this:

$mos_map_sql = mysql_query("
SELECT aro_id
FROM " . $configuration->get('mosConfig_dbprefix') . "core_acl_aro
WHERE name = '" . $Options['register_vars']['real_name'] . "'
LIMIT 1");


That got rid of the second error and everything appears to be working properly now and there are no errors in the SMF log.

Again, Thank You very much. I appreciate the help.

Orstio

In the SMF_user_delete mambot, there is a query that is not updated for SMF 2.0.

$result = mysql_query ("
SELECT ID_MEMBER
FROM {$db_prefix}members
WHERE memberName = '$username'
LIMIT 1");


Should be:

$result = mysql_query ("
SELECT id_member
FROM {$db_prefix}members
WHERE member_name = '$username'
LIMIT 1");

b4pjoe

Quote from: Orstio on January 20, 2009, 08:18:53 AM
In the SMF_user_delete mambot, there is a query that is not updated for SMF 2.0.

$result = mysql_query ("
SELECT ID_MEMBER
FROM {$db_prefix}members
WHERE memberName = '$username'
LIMIT 1");


Should be:

$result = mysql_query ("
SELECT id_member
FROM {$db_prefix}members
WHERE member_name = '$username'
LIMIT 1");


Thanks, I have now applied that fix.

A couple of other things I've noticed too. Deleting a user in Mambo still does not delete them from SMF and that user can still login to the forum which then creates that user in Mambo again. If I delete the user from SMF it does delete them in both though.

Banning a user in SMF still allows them to log into Mambo, at least it shows them logged in on the Mambo side. I applied a test ban on user name only and then when I tried to log in as that user it logged me into Mambo but trying to access the forums told me I was banned. It then would not let me login as any other user. I expected it to let me log back in as an admin but it had me locked out from logging in as any other user. Like it was an IP ban even though I only applied the ban on the user name. The only way I could get back in as an admin was to access the site from a proxy server. This may be more of an SMF issue then a bridge issue but I thought I would mention it here since the banned user still had access to the Mambo side.

Orstio

QuoteA couple of other things I've noticed too. Deleting a user in Mambo still does not delete them from SMF and that user can still login to the forum which then creates that user in Mambo again. If I delete the user from SMF it does delete them in both though.

Hmmm...  I wonder if it's thinking you're not an admin?

Find this in SMF_user_delete:

//We're going to need SSI for this
require_once ($smf_path."/SSI.php");


And add this immediately after:

$online = ssi_logOnline('array');


QuoteBanning a user in SMF still allows them to log into Mambo, at least it shows them logged in on the Mambo side. I applied a test ban on user name only and then when I tried to log in as that user it logged me into Mambo but trying to access the forums told me I was banned. It then would not let me login as any other user. I expected it to let me log back in as an admin but it had me locked out from logging in as any other user. Like it was an IP ban even though I only applied the ban on the user name. The only way I could get back in as an admin was to access the site from a proxy server. This may be more of an SMF issue then a bridge issue but I thought I would mention it here since the banned user still had access to the Mambo side.

Yeah, SMF doesn't have a way of outputting the ban info properly for any other system to pick it up.  If you want to ban in both Mambo and SMF, you are better off publishing the SMF_user_ban mambot and banning from the Mambo admin panel.

b4pjoe

Quote from: Orstio on January 20, 2009, 09:54:30 PM
QuoteA couple of other things I've noticed too. Deleting a user in Mambo still does not delete them from SMF and that user can still login to the forum which then creates that user in Mambo again. If I delete the user from SMF it does delete them in both though.

Hmmm...  I wonder if it's thinking you're not an admin?

Find this in SMF_user_delete:

//We're going to need SSI for this
require_once ($smf_path."/SSI.php");


And add this immediately after:

$online = ssi_logOnline('array');


I tried adding the code as suggested. It didn't make a difference though so I took that line back out of SMF_user_delete.

I will keep that in mind on your suggestion for banning from Mambo.

Orstio

Add this:

$user_info['is_admin'] = true;

Right before this?

deleteMembers($memberid);

b4pjoe

Quote from: Orstio on January 21, 2009, 08:44:01 AM
Add this:

$user_info['is_admin'] = true;

Right before this?

deleteMembers($memberid);

Tried it before that line and it still doesn't work. Tried putting it after that line and it still doesn't work.

Orstio

Is there anything showing up in your site error log?

b4pjoe

There is nothing showing up in my SMF error logs.

Orstio

Is there anything showing up in your site error log?

b4pjoe

No, nothing in my godaddy site logs. Is there a Mambo error log?

Orstio

No.  But there should be an error recorded each time the query fails on deletion.

b4pjoe

The delete user doesn't fail on Mambo. It deletes the user. It's just then not deleted in SMF. And since SMF doesn't have an error would that mean there is no error, it's just not doing anything?

Advertisement: