Welcome to Geeklog, Anonymous Saturday, May 04 2024 @ 01:54 am EDT

Geeklog Forums

My own session variables


Status: offline

amckay

Forum User
Full Member
Registered: 03/23/02
Posts: 180
Hey folks, Is there some way to have my own session variables? I searched through the code and could not find a "session_register" anywhere, and then I saw lib-session.php which seems to indicate that the DB is used for this. I'd like to be able to do something like this in my plugins :
Text Formatted Code

if ( ( $_USER['uid'] > 1 ) && ( ! isset( $mySessionVar ) ) )
{
          $mySessionVar   = some value
}
 
In my non-GL PHP work I use session_register to do this. I want to store my own user settings for plugins, and some of them require being initialised only once per session. How is this done in GL? thanks, -Alan
 Quote

Status: offline

Tony

Site Admin
Admin
Registered: 12/17/01
Posts: 405
Location:Urbandale, Iowa
Good question. Unfortunately, PHP4 sessions where relatively new and untest back we Geeklog 1 debuted years ago. I reworked this session code a couple of years ago by stealing stuff from another package (phpBCool. Now I am wishing we had PHP4 sessions in 1.3.x. Anyway to answer your question, unfortunately, no but we already have the GL2 session handler written and it stores session data to a database with a custom PHP4 session handler.---The reason people blame things on previous generations is that there's only one other choice.
The reason people blame things on previous generations is that there's only one other choice.
 Quote

Anonymous

Anonymous
Would I break anything do you think if I called session_register() in my code?
 Quote

Status: offline

Tony

Site Admin
Admin
Registered: 12/17/01
Posts: 405
Location:Urbandale, Iowa
No, I can't see why. It would take some careful planning and might make upgrades a bit of a hassle but it could be done.---The reason people blame things on previous generations is that there's only one other choice.
The reason people blame things on previous generations is that there's only one other choice.
 Quote

All times are EDT. The time is now 01:54 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content