It's not quite smart to turn both registration system follow vbulletin. Edit your CMS and make it switch between third party. I will use just functions to explain my concept, and the codes you have to write your own.
PHP Code:
function Login()
{
$this->CheckOptions();
if ($this->vbenable)
{
$this->vblogin($username, $password);
}
else
{
$this->defaultlogin($username, $password);
}
}
Basically when the user submits the form with his username and password. The script first checks if vbulletin integration is enable or not. If it is then it uses the vblogin() function to login a vbulletin user.
Under vblogin() function all you have to do is:
- Connect to vbulletin database
- Encrypt the password using this algorithm: md5(md5($password). $salt)
- In the algorithm, $password is the password the user entered on the form. And salt is the data from vbulletin user's table.
- If the password and user matches register the session and the user is logged in.
You can also check vbulletin's session data to see if an user is already logged in or not :banana: