vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Register/Add New User (https://vborg.vbsupport.ru/showthread.php?t=204336)

looknow12 02-05-2009 02:34 PM

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

ForumsMods 02-05-2009 03:53 PM

See:
https://vborg.vbsupport.ru/showthread.php?t=82836

looknow12 02-05-2009 04:02 PM

how do I call this from c#.net?

jdelator 02-05-2009 05:33 PM

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?

looknow12 02-05-2009 05:47 PM

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?

jdelator 02-05-2009 06:01 PM

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.

looknow12 02-05-2009 06:16 PM

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.

jdelator 02-05-2009 07:09 PM

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/

Dismounted 02-06-2009 08:21 AM

Quote:

Originally Posted by jdelator (Post 1735384)
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 :p).

jdelator 02-06-2009 06:48 PM

Quote:

Originally Posted by Dismounted (Post 1735891)
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 :p).

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.


All times are GMT. The time now is 07:10 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.01098 seconds
  • Memory Usage 1,739KB
  • 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
  • (1)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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