vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Is this SQL query correct? (https://vborg.vbsupport.ru/showthread.php?t=215348)

Lynne 06-08-2009 08:20 PM

Of course it's an unknown column 'user.userid' in the field list - you aren't joining to the user table, so how would it get that field? But in the query you wrote, you use "$vbulletin->GPC['i']" which is a variable that is passed. That doesn't mean that line is still in the database. Have you looked at that table which testing this process and seen whether the row you want is still there?

What I was saying about global.php is that it's called in the register.php page, so I'm not sure it needs to be called again.

Dismounted 06-09-2009 07:05 AM

PHP Code:

$userdata $db->query_first("
    SELECT u.username
    FROM " 
TABLE_PREFIX "useractivation AS ua
    LEFT JOIN " 
TABLE_PREFIX "user AS u USING (userid) 
    WHERE ua.activationid = '" 
$vbulletin->db->escape_string($vbulletin->GPC['i']) . "'
    AND ua.emailchange = 0
    LIMIT 1
"
);

$username $userdata['username']; 


powerful_rogue 06-09-2009 01:37 PM

Quote:

Originally Posted by Lynne (Post 1825948)
Of course it's an unknown column 'user.userid' in the field list - you aren't joining to the user table, so how would it get that field? But in the query you wrote, you use "$vbulletin->GPC['i']" which is a variable that is passed. That doesn't mean that line is still in the database. Have you looked at that table which testing this process and seen whether the row you want is still there?

What I was saying about global.php is that it's called in the register.php page, so I'm not sure it needs to be called again.

Hi Lynne,
I knew that about the unknown column, I was just showing how I got a database error that confirmed the correct activationID was being associated with the user.

Quote:

Originally Posted by Dismounted (Post 1826196)
PHP Code:

$userdata $db->query_first("
    SELECT u.username
    FROM " 
TABLE_PREFIX "useractivation AS ua
    LEFT JOIN " 
TABLE_PREFIX "user AS u USING (userid) 
    WHERE ua.activationid = '" 
$vbulletin->db->escape_string($vbulletin->GPC['i']) . "'
    AND ua.emailchange = 0
    LIMIT 1
"
);

$username $userdata['username']; 


Hi Discountinued.

I replaced

PHP Code:

$username htmlspecialchars_uni($vbulletin->userinfo['username']); 

with the above query, however it then throws up this error after confirming the email address

Quote:

Fatal error: Call to a member function save() on a non-object in /home/dc/public_html/testsite/register.php on line 1079

Lynne 06-09-2009 03:00 PM

Try removing the global.php line and see what happens.

powerful_rogue 06-09-2009 03:23 PM

Hi Lynne,

Still comes back with the same error.

Lynne 06-09-2009 03:53 PM

Again I'll suggest that you take a look at the useractivation table during this process. I'm still not convinced that that row isn't deleted and thus you wouldn't get any result from that query.

powerful_rogue 06-10-2009 06:24 AM

Hi Lynne,

Looking through register.php it looks like your right.

Line 1023
PHP Code:

// delete activationid
        
$db->query_write("DELETE FROM " TABLE_PREFIX "useractivation WHERE userid=$userinfo[userid] AND type=0"); 

Line 1068
PHP Code:

($hook vBulletinHook::fetch_hook('register_activate_process')) ? eval($hook) : false

It deletes the activationid before it gets to the hook I need to use.

Looks like I might be a bit stuffed! I dont suppose you know of any other ways I may be able to resolve this.

Dismounted 06-10-2009 07:11 AM

Catch and hold the username at an earlier hook?

powerful_rogue 06-10-2009 08:32 AM

Thanks dismounted.
Is this an easy thing to do?

Lynne 06-10-2009 02:17 PM

Quote:

Originally Posted by powerful_rogue (Post 1826849)
Thanks dismounted.
Is this an easy thing to do?

Again, look at register.php. That is the best thing to do. Find this right around line 1000:
PHP Code:

    $userinfo verify_id('user'$vbulletin->GPC['u'], 11);

    (
$hook vBulletinHook::fetch_hook('register_activate_start')) ? eval($hook) : false

You really need to look at the page you are using plugins for to see what is already going on.


All times are GMT. The time now is 08:21 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01239 seconds
  • Memory Usage 1,757KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete