View Single Post
  #4  
Old 01-27-2008, 04:09 AM
dionsis dionsis is offline
 
Join Date: Aug 2005
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

im looking to make a script to help me bridge 2 applications

basically the app im using has a bridge function that when i choose a certain bridge, code gets executed in that bridge file, so there are create, update, delete functions in that bridge.

for the purposes of this attempt its create a user im trying to do, assuming getting this working will mean that i can do the others once these issue's are ironed out.

there are 2 options i have, use curl code to pass the data to an external file. or execute the vbulletin code in the bridge file, which would be for example, an index.php file, including another file which does an include on the bridge. so its nested inclusions and seems to be causing problems.

with curl we lose the nesting and it should work. the above code however isnt, and the code posted by dismounted doesnt seem to work either

ERROR0:Please complete the required field "Username".

i get that when i try passing data via the address bar

jm_adduser.php?username=testing&email=testing@gold enplec.com&password=simple

though the data SEEMS to get passed ok using
$username = $_REQUEST["username"]
etc etc to get the data
i can print the variable contents $username and it shows the passed data

but
$userdm->set('username', $username);

returns the error given above.

so this is my attempt at using an independent file to add a user to VB and i will curl the data to the file from the bridge file for simplisity

any help much appreciated, ive been at this for weeks

--------------- Added [DATE]1201414949[/DATE] at [TIME]1201414949[/TIME] ---------------

scratch the above i solved it myself

just as i wrote the last reply i thought to myself about a problem i had in work recently where data was there one minute, gone the next, and it was due to initialising something else killing the variables because they were only temporary

so i moved the setting $username and $password down the script to beside the $userdm->set , well just before that, and wham it works, tried the curl code to call the script and wham that worked from that end too.

so now i finally have the script working. although it might be helpful for others to explore what was causing the variables to get emptied between setting them and this code

SET THE VARIABLES HERE

// switch to vbulletin directory
$cwd = getcwd();
chdir('/home3/goldccom/public_html/forum');

// include dependencies
require_once('./global.php');
// initialise datamanager
$userdm =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY);

// set options
GONE BY THE TIME THEY GET HERE
$userdm->set('username', $username);
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01054 seconds
  • Memory Usage 1,767KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)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 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete