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

Reply
 
Thread Tools Display Modes
  #1  
Old 02-05-2009, 02:34 PM
looknow12 looknow12 is offline
 
Join Date: Nov 2003
Location: Connecticut
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Register/Add New User

Register new user
Hi,

I have my web application (ASP.Net & MS SQL Server) where in any user can register himself and create his account.

I want to create same user in my vBulletin forum as soon as he registers in my web application.

Does any one know how to achieve this task?

Regards,
Krunal
Reply With Quote
  #2  
Old 02-05-2009, 03:53 PM
ForumsMods ForumsMods is offline
 
Join Date: Aug 2007
Location: Argentina
Posts: 667
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

See:
https://vborg.vbsupport.ru/showthread.php?t=82836
Reply With Quote
  #3  
Old 02-05-2009, 04:02 PM
looknow12 looknow12 is offline
 
Join Date: Nov 2003
Location: Connecticut
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

how do I call this from c#.net?
Reply With Quote
  #4  
Old 02-05-2009, 05:33 PM
jdelator jdelator is offline
 
Join Date: Oct 2007
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I was able to do this actually. I'll try to get a blog post to show this. It was actually quite involved. I had to have c# call a web page, then read the response. The web page of course was the php script. The php script take in the variables like the username, password, email, etc.. then used the tutorial in the link. The php script would return a xml file containing whether the user creation was successful or not. It would also contain stuff like the new userid, hashed password, salt, etc.. basically anything you would need on the .NET side.

I still haven't solved scenarios where the user changes his info in vb (password, username,email, etc..). Since the changes will be present in MySQL and not MSSQL. I was thinking of using hooks and then having php push the changes onto .NET.

Are you by any chance doing this in the MVC framework?
Reply With Quote
  #5  
Old 02-05-2009, 05:47 PM
looknow12 looknow12 is offline
 
Join Date: Nov 2003
Location: Connecticut
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What about an easier approach like calling some sort of stored procedure to do this. Or better yet, are there any business objects out there that can be called to handle this?
Reply With Quote
  #6  
Old 02-05-2009, 06:01 PM
jdelator jdelator is offline
 
Join Date: Oct 2007
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Do you see the issue in this though? Your biggest issue is keeping the MSSQL server in sync with the MySQL server. vBulletin does not work on MSSQL. As far as stored procedures, I would recommend against this. You have the potential to really mess up the database. It's better to pass the data to vb and then have vb validate the data and do the necessary sql queries. I think it's a bit more involved than a simple INSERT query.

I don't know what you mean by business objects.
Reply With Quote
  #7  
Old 02-05-2009, 06:16 PM
looknow12 looknow12 is offline
 
Join Date: Nov 2003
Location: Connecticut
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I was thinking more of a stored procedure that was written by VB. If none exists, then I would drop that as an option.

When I say business objects I'm referring to DLL's specifically written to carry out many of these functions. Call the method on the DLL for adding a new user, pass the parameters and then get a result code/message.

Our application uses these DLL's to carry out many of the common functions. Typically when people refer to a three tier architecture they mean database layer, application or business object layer(dll's) and client (UI). The nice thing about this middle application tier is that you can later create a different client (web, rich windows, mobile) and still use the same objects so as you said the database is always treated the same for common functions.
Reply With Quote
  #8  
Old 02-05-2009, 07:09 PM
jdelator jdelator is offline
 
Join Date: Oct 2007
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

vB doesn't use as stored procedures mostly because it has to support different versions of Mysql. Not all versions of mysql support stored procedures. (mysql is very primitive in comparison to mssql in relation to some features). vb is written in php, you can't have DLL's, the best business object you use is the vb database model objects.

Look at the link

Code:
$newuser =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY); 
$newuser->set('username', 'phpNukeUser'); 
$newuser->set('email', 'foo@bar.com'); 
$newuser->set('password', 'verysecret'); 
$newuser->set('usergroupid', 2);
This is how you are supposed to interact in php (it's a scripting language).

I don't think you are using the MVC framework, you should check it out.
http://www.asp.net/mvc/
Reply With Quote
  #9  
Old 02-06-2009, 08:21 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by jdelator View Post
The php script take in the variables like the username, password, email, etc.. then used the tutorial in the link.
If you are doing this sort of thing, make sure you include a secret that both scripts can verify (to prevent malicious use), maybe something like sha1($password . $secret) (of course don't use this one I just posted ).
Reply With Quote
  #10  
Old 02-06-2009, 06:48 PM
jdelator jdelator is offline
 
Join Date: Oct 2007
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dismounted View Post
If you are doing this sort of thing, make sure you include a secret that both scripts can verify (to prevent malicious use), maybe something like sha1($password . $secret) (of course don't use this one I just posted ).
Yeah I thought about this. I dont think its necessary. From a user point of view, they will never know the url to the php script (it's in the c# code). Also if they create an account this way, it wouldnt be any different from then using the website normally. The only difference is that a "sync" would not happen between the mssql and mysql server. I also have code that takes of the issue when a sync fails. I tried to come up with a case where someone malicious would try to create accounts where they somehow figured out the url and couldn't come up with a security issue.

The xml file doesnt contain the password, since on C# side it knows how to hash it.
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 03:05 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.04341 seconds
  • Memory Usage 2,257KB
  • 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
  • (1)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete