vBulletin as login for entire website (edit: a certain amount of progress has been made)

纵饮孤独 提交于 2019-12-24 03:12:55

问题


I've come up against a bit of a brick wall in the vBul forums on how to do this, so I thought I'd ask the forum that's never let me down.

Does anyone know of a simple way, on an EXTERNAL page to the forum, to take in whether the user is logged in, and possibly extract their user ID while it's at it? I've seen a few plug ins with that intension but all seem to have fallen out of support, and vBul 4.1 seems to have "broken" them as a result.

Any and all help appreciated. Once I have those too things I can write scripts myself that work with the database. I just need those two variables :)

I've made SOME progress anyway. On the alternate pages the following code seems to link into vBuls user manager:

<? ini_set('display_errors', 1);
error_reporting(E_ALL); ?>
<? chdir("/home/sites/<sitename>/public_html/forum/");
require("./global.php"); ?>
<? echo "Your vBul user id is: ".$vbulletin->userinfo['userid']." and your username is ".$vbulletin->userinfo['username'].""; ?>
<? chdir("/home/sites/<sitename>/public_html/dev"); ?>

I say its connecting in ok because it returns "Your vBul user id is: 0 and your username is Unregistered" where as if it wasn't it would return to blank spaces. The problem is its returning 0 and unregistered despite my definitely being logged in on the forums.

Any suggestions?


回答1:


Just realised no one ever answer this, so here is my own solution:

#grab global.php to access vbuls user systems
chdir("../forum/");
require("./global.php");
require_once('includes/functions_login.php');

#sanatize all variables for easier use
$username = $vbulletin->userinfo['username'];
$userid = $vbulletin->userinfo['userid'];
$loggouthash = $vbulletin->userinfo['logouthash'];
chdir("../dev/");

This sorts it nicely, I know I dont NEED to sanatize the variables like that, but its a personal preference.



来源:https://stackoverflow.com/questions/5888090/vbulletin-as-login-for-entire-website-edit-a-certain-amount-of-progress-has-be

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!