View Full Version : Possible to authenticate elsewhere on webpage?
mattfl
10-24-2005, 02:28 AM
Is it possible to use the vbulletin login elsewhere on a webpage for authentication? Say for instance I have a photo gallery that I want to have people login to see, is there a way I can stick the vbulletin username/password prompt on a login page for the gallery and have it check against the vbulletin database but not log into the forums?
mattfl
10-26-2005, 06:50 PM
bump for some help
Wired1
10-26-2005, 07:01 PM
Yes, you can use the vB login stuff on another area of the site, however since it's the same login, it will log them into the forums.
mattfl
10-27-2005, 06:25 PM
Ok, since that won't work. Is it possible to have vbulletin during the registration proccess insert the username/password into another table but without the encryption? Basically just dump the plain username/password. Or, is it possible to make a simple login/password box in php and have it reference the username/password table in the vbulletin database and authenticate against that?
mattfl
11-03-2005, 01:10 PM
one last bump..please anyone!
Marco van Herwaarden
11-03-2005, 03:53 PM
The plain password never gets sent from the client to the server. It is already hashed on the clientside.
To make what you want would seriously reduce vB's security level.
mattfl
11-03-2005, 04:46 PM
The plain password never gets sent from the client to the server. It is already hashed on the clientside.
To make what you want would seriously reduce vB's security level.
ok well what about my other option, make my own username/password cgi form, but is there a way to have it authenicate against the vb database? or is that what you were talking about?
mattfl
11-07-2005, 08:40 PM
one last bump for the newer question
Marco van Herwaarden
11-08-2005, 03:45 PM
Yes, everythig is possible, but it would reduce the level of security.
mattfl
11-10-2005, 03:50 PM
Yes, everythig is possible, but it would reduce the level of security.
Well let's just pretend I'm not worried about security...
How would I go about doing this?
I want to make my own user/password login php page, and have it authenticate against the vb database. I really don't know howto do that, can someone give me some help.
Marco van Herwaarden
11-10-2005, 06:39 PM
Do a search on 'salt' here. There might also be a topic on this in the How-To forum.
roosevelt
11-10-2005, 07:11 PM
Yes you can authenticate users with the datas stored in the vbulletin database. There are two concepts you have to understand.
Make the user log-in both your site area and the forum or just one module
To do this you will need to study vBulletin sessions system, what algorithm is used to encrypt the password so that it matches the users password in the database. Say your users's id is bob and password is 2005.
For example if vbulletin used md5() hash to encrypt the password the password 2005 would be stored as 2983jdkfsdm23847 in the database.
So, when the user enteres his username, and password on the log-in form you made for your website area... make it check the database and if the values matches you sent the user to his destination else return a error. The actual code will look like:
<?php
$username = $_POST['username'];
$password = md5($_POST['password']);
// Use this area to connect to vbulletin database, and select the users table.
$query = mysql_query("SELECT username, password FROM users WHERE username = $username, passwod = $password");
if ($query){
echo "Welcome";
register_session(.username.);
//Enter the vbulletin register session if you want him to login the forums aswell
} else {
echo "Invalid log-in";
}
?>
The code I provided is really crappy but it will help you understand the concept. The thing you should notice is on the variables I surrounded the $_POST['password'] variable with md5() function. So, whatever user's password is, it is encrypted before it is checked on the database. Because the password 2005 doesn't even exist in the database, but if we encrypt is before checking it... then it will see the match and will let the user login right away.
If you are not into PHP, then I recommend study it first... because for someone new session could be a pain. And also understanding the classes and objects in vbulletin system if wish to work with the vbulletin session class.
:)
Here is a mod which will do that: https://vborg.vbsupport.ru/showthread.php?t=91129
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.