SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    What is the cookie's name?

  3. #3
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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'

    Good luck.

  4. #4
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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.

  5. #5
    One website at a time mmj's Avatar
    Join Date
    Feb 2001
    Location
    Melbourne Australia
    Posts
    6,282
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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.
    Last edited by mmj; Apr 17, 2001 at 11:08.
    [mmj] My magic jigsaw
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The Bit Depth Blog Twitter Contact me
    Neon Javascript Framework Jokes Android stuff

  6. #6
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  7. #7
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok thanks for the input


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •