The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
How can I use sessions for this?
Okay...I've got a game on my site that you would usually have to log in to...but what I want to do is make it so that once you've logged in to the forum you don't have to log into the game. I'm assuming you would use sessions but not sure how vBulletin's sessions work. Any input would rock face.
Forum: http://www.banterboards.com Game: http://monsterslayer.banterboards.com |
#2
|
|||
|
|||
Well, this *should* be pretty easy. Just do a session_start() at the beginning of your game's php script and match the session_id() with the session data in your forum's database.
I can only tell you how that should work on vB 3.0 as I don't have 2.3.3 set up. Code:
<? php session_start(); require('path_to_forum/includes/config.php'); mysql_connect($servername, $dbusername, $dbpassword); mysql_select_db($dbname); $userdata=mysql_query("SELECT * FROM session LEFT JOIN user ON(session.userid=user.userid) WHERE sessionhash='".session_id."'"); if ($userdata=mysql_fetch_array($userdata)) { your game's php code where $userdata got all the info stored in an array } else { display login box } ?> BTW, I *think* that simply including the global.php file of the forum does all of this and more automatically. If I'm able to remember correctly the data would be accessed through the array $bbuserinfo |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|