Ingenious
03-12-2009, 11:23 AM
Hi everyone,
I would like users of my site to be able to add comments or rate products in a part of my site that is external to VBulletin. To make this simple and prevent abuse/spam etc I would like to allow this only for forum members who are also logged in.
I am using 3.7.1 but shortly updating to 3.8.1
I've had a look over the mods and bits and bobs and there's a fair few scripts that should allow login/logout in external pages. But I want to keep it simpler than that, sending the user off to the actual forum to log in first (logic behind this, let VBulletin worry about login/paswords, cookies etc, seems more secure than me trying to do it).
All I need to do then is check in my script, which for simplicity will be in the same folder as the forum, whether someone is logged in to VBulletin.
I have seen this sort of code:
// We check if user is logged in
if ($vbulletin->userinfo['userid']!=0) {
// If Logged in display welcome back message
Am I right in thinking before that will work I need to include global.php?
If so is this the right code:
require_once('global.php');
Do I need to worry about checking cookies, or anything else, is this all taken care of by global.php?
Finally, what would be the code to check if the user (assuming already checked they are logged in) is of a particular usergroup. Is it this:
if ($vbulletin->userinfo['usergroupid'] == '6' )
{ etc
The above bits were from a script that had this at the top, so the right person is credited:
Simple vB User login and access control on non vB pages
By Bill@Billspaintball.com
Version 2.00 - March 21st, 2008
For vB 3.7.x
Apologies for asking what appears to be something really simple, I did spend a fair time in search however a lot of the stuff relates to more complicated processes and I'm not too sure what bits I need to get started.
Finally, is there a list somewhere of other user info I can get similar to $vbulletin->userinfo['usergroupid'] ie. what other info userinfo['parameter'] can be used to retrieve?
Regards,
Ingenious
I would like users of my site to be able to add comments or rate products in a part of my site that is external to VBulletin. To make this simple and prevent abuse/spam etc I would like to allow this only for forum members who are also logged in.
I am using 3.7.1 but shortly updating to 3.8.1
I've had a look over the mods and bits and bobs and there's a fair few scripts that should allow login/logout in external pages. But I want to keep it simpler than that, sending the user off to the actual forum to log in first (logic behind this, let VBulletin worry about login/paswords, cookies etc, seems more secure than me trying to do it).
All I need to do then is check in my script, which for simplicity will be in the same folder as the forum, whether someone is logged in to VBulletin.
I have seen this sort of code:
// We check if user is logged in
if ($vbulletin->userinfo['userid']!=0) {
// If Logged in display welcome back message
Am I right in thinking before that will work I need to include global.php?
If so is this the right code:
require_once('global.php');
Do I need to worry about checking cookies, or anything else, is this all taken care of by global.php?
Finally, what would be the code to check if the user (assuming already checked they are logged in) is of a particular usergroup. Is it this:
if ($vbulletin->userinfo['usergroupid'] == '6' )
{ etc
The above bits were from a script that had this at the top, so the right person is credited:
Simple vB User login and access control on non vB pages
By Bill@Billspaintball.com
Version 2.00 - March 21st, 2008
For vB 3.7.x
Apologies for asking what appears to be something really simple, I did spend a fair time in search however a lot of the stuff relates to more complicated processes and I'm not too sure what bits I need to get started.
Finally, is there a list somewhere of other user info I can get similar to $vbulletin->userinfo['usergroupid'] ie. what other info userinfo['parameter'] can be used to retrieve?
Regards,
Ingenious