I am using vBulletin, and would like to know how to read the cookie that is set when my users login, I want to display their name on pages outside of the forums, and will soon be implementing more that will be dependent on this.
The value you're looking for lies in the $bbuserid variable. You should be able to access it at any point within any PHP script running on the same domain as your copy of vBulletin.
This variable, however, only contains the user's ID number, and not their username. You'll need to query the database to extract the name. You would do so like this (if I remember vB's table structure correctly):
SELECT username FROM user WHERE userid='$bbuserid'
So there is no way to avoid querying the database?
I must query the database then....that is gonna slow my server down significantly, would it be wise to have vB store the user's name in the cookie? Would this be a potential security issue? I can't see how it would be, but I am very protective of my users, since most of them are minors. What would you reccommend, I don't think I would have problems altering the script, the question is wether it would be wise or not.
I cannot see how it would slow down your server significantly. There are hundreds and hundreds of mySQL queries [i am exxagerating] happening in vBulletin, and if there was one query per page on the rest of your site it definately would not hurt.
I don't think it's worthwhile to edit the script. As mmj said, if your site is receiving so much traffic that one query per page load will make a large difference, then you've got bigger problems.
Bookmarks