Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    Regular Coder Andy92's Avatar
    Join Date
    Nov 2005
    Location
    Horsham, West Sussex, UK
    Posts
    363
    Thanks
    7
    Thanked 1 Time in 1 Post

    vBulletin Sessions

    Hi guys,

    I would like to know how and where i can change/edit the vbulletin sessions.

    What script sets them?

    Also i would like to know what the session's name is.

    Thanks in advance.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Depends on your version of vB.
    Assuming your running on 3.x, I recall its under includes/sessions.php
    If the version is 2.x, I believe its under .global.php.
    Hope that helps.
    Oh, and for the name, its either sessionid or s, depending on the version/configuration. I recall that 3.x maps s to sessionid. Hope that helps.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #3
    Regular Coder Andy92's Avatar
    Join Date
    Nov 2005
    Location
    Horsham, West Sussex, UK
    Posts
    363
    Thanks
    7
    Thanked 1 Time in 1 Post
    Yes, i am using the lates version 3.7

    Basically, is there any way so that i an display the username etc when people are logged into my forum accross other parts of my website?

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Been awhile since I've manipulated the vB files, but if you are using a session that is defined by the vb sessions, the database should have a record of the location. I'm not 100% certain where to find it (probably the online script), but there should be information relating to the location of the user and mapping it to a specific phrase for their location (eg, location: index.php ==> map it to 'Home Page' for example). Take a look, I'll check when I get home on my files (they are older than yours though)
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #5
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    You'll have to do some digging but I did this a bit ago and believe when they log into the forum you can check a cookie called $_COOKIE['bbsessionhash']. From there it joins to a session table and then back to the user table.

    Do some testing by loging in and doing some print_r's and checking the output.

    Good luck;

  • #6
    Regular Coder Andy92's Avatar
    Join Date
    Nov 2005
    Location
    Horsham, West Sussex, UK
    Posts
    363
    Thanks
    7
    Thanked 1 Time in 1 Post
    Ok got it.

    But, i have a few more questions about vbulletin.

    1) I have been searching around for ages. Is there a way to display the number of users / guests online on a page that is another part of my site?

    Thanks!

  • #7
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Quote Originally Posted by Brandoe85 View Post
    You'll have to do some digging but I did this a bit ago and believe when they log into the forum you can check a cookie called $_COOKIE['bbsessionhash']. From there it joins to a session table and then back to the user table.

    Do some testing by loging in and doing some print_r's and checking the output.

    Good luck;
    That does sound right Brandoe, but I don't recommend following this option - not everone may use cookies (even session only cookies). I would opt for the method of including the initialization script from the VB into all the site scripts, that will allow auto generation of sessions for you - super handy as well (though kinda cheap method )
    As for getting the number, you can run a query to select from the session table, something like:
    SELECT count(*) AS Guests,
    (SELECT count(*) AS Member FROM Session WHERE userID > 0) AS Members
    FROM Session WHERE userID = 0;
    That will resultset with a Guest count and a Member count.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #8
    Regular Coder Andy92's Avatar
    Join Date
    Nov 2005
    Location
    Horsham, West Sussex, UK
    Posts
    363
    Thanks
    7
    Thanked 1 Time in 1 Post
    I have done that, but it displays wrong. I mean it displays right at first, then vbulletin starts to not display inactive guests, so say if there were 15 guests online, and after 15 mins there were only 10 guests left, vbulletin would display this, but the other 6 guests that are not online anymore, their mysql records are still in the table for another 10 minutes or so, so i cant get it to display right at all.

  • #9
    Regular Coder Andy92's Avatar
    Join Date
    Nov 2005
    Location
    Horsham, West Sussex, UK
    Posts
    363
    Thanks
    7
    Thanked 1 Time in 1 Post
    Anyone know?

  • #10
    New to the CF scene
    Join Date
    Oct 2010
    Location
    Pune, India 411046
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There is 1 very easy way to do this,
    Just use following syntax to fetch any information about currently logged in user :
    To fetch username of currently logged in user : vbulletin->userinfo['username'];
    Currently logged in user's email address : vbulletin->userinfo['email']
    Userid of currently logged in user : vbulletin->userinfo['userid']

    To give more detailed info on this,
    1. just login to your PhpMyAdmin
    2. Expand your vBulletin database and see the structure of "user" table.
    NOTE : if you are having database prefix then look for your_prefix.user table.
    3. In structure whatever field names you see there, if you put that field name in vbulletin->userinfo['fieldname'] it will give you desired data of currently logged in user.

    I hope this info helps you.

    Regards
    Aditya Hajare


  •  

    Posting Permissions

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