Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-25-2006, 02:59 PM
monotreme monotreme is offline
 
Join Date: Nov 2005
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default hooks and curl

The site owners want to collect some additional information from the users when they register and put it in their own (non vb) tables. So here is how I did it:

1. I hacked the registration template and added the desired fields
2. I made a hook on register_addmember_complete

There's more than a few lines of processing and I want to be as independent as possible, so I tunneled the data to the custom application via curl. This thinking is just give the custom application the data but don't risk namespace conflict by sharing environment with vb.

PHP Code:
$glomp=serialize($_POST);
$ch=curl_init("http://www.example.com/cu.php"); 
$pf "id=" $vbulletin->userinfo['userid'] .
 
"&loginName=" urlencode($vbulletin->userinfo['username']) .
 
"&glomp=" urlencode($glomp) ; 
curl_setopt($ch,CURLOPT_USERPWD"xxxxxxxxxxxxx");
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$pf);
$f curl_exec($ch);
curl_close($ch);
unset(
$ch); 
It specifically posts the new vb userid and username, and all the rest of the _POST data it just munges into a big glomp. Then it causes a new page request to happen in the background by using curl. The custom user program (cu.php) via curl filters out all the vb data and only cares about the custom data it is looking for.

What is supposed to happen:
a) cu.php goes off and does its thing asynchronously,
b) the hook returns and vb continues on it's merry way.

What actually happens
a) cu.php does it's processing just fine.
b) vb returns from the hook (verified by temporarily sticking
PHP Code:
echo "back from hook"; exit; 
right after the line in register.php where it evals the hook)
c) it fails to render a HTML page telling the user what to do next, i.e. we have
the dreeaded white screen of death.

Am I correct in assuming that the program cu.php is independent, i.e. that no variables set by it will come back into vbulletin. Even if it mistakenly set a session var (which it doesn't) it is originate from a different IP address (it originate from the server) than the user so it would be a different session. So I am a bit at a loss to figure out what is happening and why.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:57 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04200 seconds
  • Memory Usage 2,167KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete