PDA

View Full Version : PHP vBulletin ACL Integration


Bob Meta
12-08-2011, 01:20 AM
Hi All, I am trying to print a user's login name from a PHP script or redirect them to the vBulletin login page so that vBulletin is the central authorization database. Nothing fancy:


<?php
$vb = new vbulletin(); //* this isn't real, i know, but it's what i'm looking for or something similar

if ( $loggedIn ) {
print $userName;
} else {
header( "Location: ...login url..." );
}
?>


Any pointers or suggestions are welcomed and greatly appreciated! Thank you!

LifesGreatestGift
12-08-2011, 01:37 AM
<?php
$curdir = getcwd();
chdir('../path/to/forums');
require_once('./global.php');
chdir($curdir);
#sanatize all variables for easier use
$username = $vbulletin->userinfo['username'];
$userid = $vbulletin->userinfo['userid'];
if (!$userid)
{
echo "<script type='text/javascript'>alert('You must be logged in to the forum to view this page!');</script>";
header("Location: http://www.urltoforum.com");
} else {
echo "Welcome, $username";

REST OF PHP SCRIPT HERE IF LOGGED IN

}
?>


This is a guide. Most of the code is there. may be missing something simple but
its a place to start.

Bob Meta
12-09-2011, 09:23 PM
Much appreciated, thank you.