Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 02 Oct 2010, 21:46
kuzcos kuzcos is offline
 
Join Date: Sep 2010
Registering an account through database

Ok so I have an external website, I want to register accounts with my vBulletin install from my external website, I have a couple of questions though.

password - how is this created?

salt - how is this created?

Thanks.

Last edited by kuzcos; 02 Oct 2010 at 23:33.
Reply With Quote
  #2  
Old 03 Oct 2010, 09:02
ragtek's Avatar
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Use the user datamanager for this. You can find a tutorial in the article section
__________________
my addons: http://ragtek.github.com
Reply With Quote
  #3  
Old 04 Oct 2010, 16:13
lleidr lleidr is offline
 
Join Date: Aug 2006
A link would be helpful as I am attempting to do something similar. I am new to vbulletin development. Is datamanager what VB calls their API? Does VB have an API or some sort of web service?
Reply With Quote
  #4  
Old 04 Oct 2010, 18:25
kuzcos kuzcos is offline
 
Join Date: Sep 2010
i figured it out without using datamanager.

$salt = fetch_user_salt();

$password = hash_password($pw, $salt);

mysql_query("INSERT INTO user(usergroupid, username, password, email, usertitle, joindate, reputation, reputationlevelid, options, ipaddress, referrerid, salt) VALUES('2', '" . $user . "', '" . $password . "', '" . $email . "', 'Junior Member', '" . time() . "', '10', '4', '45108311', '" . $_SERVER['REMOTE_ADDR'] . "', '2', '" . $salt . "')");

}
}

function fetch_user_salt($length = 30)
{
$salt = '';

for ($i = 0; $i < $length; $i++)
{
$salt .= chr(rand(33, 126));
}

return $salt;
}

function hash_password($password, $salt)
{
// if the password is not already an md5, md5 it now
if ($password != '')
{
$password = md5($password);
}

// hash the md5'd password with the salt
return md5($password . $salt);
}
Reply With Quote
  #5  
Old 04 Oct 2010, 18:30
lleidr lleidr is offline
 
Join Date: Aug 2006
interesting, i figured it out using datamanager

I created a small little api and put in the root forum directory:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I then call this via curl post from another page with this code:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

See references:
http://www.vbulletin.org/forum/showt...manager&page=2
http://www.vbulletin.com/docs/html/d...er_programming

Last edited by lleidr; 04 Oct 2010 at 18:37. Reason: add references
Reply With Quote
  #6  
Old 04 Oct 2010, 18:32
kuzcos kuzcos is offline
 
Join Date: Sep 2010
too much work for what i was doing..
Reply With Quote
  #7  
Old 04 Oct 2010, 18:44
lleidr lleidr is offline
 
Join Date: Aug 2006
I tried your way and couldn't figure out the encryption stuff, was glad I was able to find vbulletin took the time to create an api. Your way works fine, however, it could break with newer versions. The api abstracts you from the lower level vbulletin code which should prevent problems should vbulletin change lower level code.

--------------- Added 04 Oct 2010 at 18:56 ---------------

Any idea on how to do a login now?

Last edited by lleidr; 04 Oct 2010 at 18:56. Reason: Auto-Merged DoublePost
Reply With Quote
  #8  
Old 08 Oct 2010, 06:33
Frank T Frank T is offline
 
Join Date: Jun 2010
I do the following to create hundreds of users at a time.

$userdm = new vB_DataManager_User($vbulletin, ERRTYPE_ARRAY);
$userdm->set('username', $tsData[uName]); // My new name is in this array.
$userdm->set('password', 'admin@yoursitename.com);
$userdm->set('email', 'adminXYZ@yoursitename.com);
$userdm->set('usertitle', 'Auto-Generated User');
$userdm->set('usergroupid', 9); // My own custom user group for auto-generated userID's
$tsData[UID] = $userdm->save();
$db->query_write("UPDATE user SET email = '' WHERE userid = '$tsData[UID]'"); // Erase the email address so you can use it over again.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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


New To Site? Need Help?

All times are GMT. The time now is 06:58.

Layout Options | Width: Wide Color: