vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   sessions explained? (https://vborg.vbsupport.ru/showthread.php?t=98886)

jpodtbc 10-20-2005 06:40 PM

sessions explained?
 
hello.

i've searched this forum extensively for hints to figure out how to use 3.5 sessions. i've read through the vb_Session class code as well but i am still unable to simply set a session variable that is saved on the next page reload.

i accessed the set function in the class using $vbulletin->session->set(...) and the variable was inserted into the vars array but was not saved.

it appears that the only variables that are ever saved are in the db_fields array but i can't modify this for a general code plugin.

can someone please explain how to save a session variable without reverting to the session_start() mechanism?

thanks,
jason.

Andreas 10-20-2005 07:34 PM

Assuming you've altered the session table:

PHP Code:

$vbulletin->session->db_fields['myfield'] = TYPE_INT;
$vbulletin->session->set('myfield'1234); 


jpodtbc 10-20-2005 07:41 PM

that seems rather excessive just to save a few session variables. is it just me or is this method of session handling rather rigid?

if there's no other way i'll just have to pollute the execution time with another database query.

Andreas 10-20-2005 07:57 PM

Hmm, which problem do you see exactly with sessions?

jpodtbc 10-20-2005 09:08 PM

here's my problem: i have a settings table for my modification. i thought i might try to query the table once per session to avoid unnecessary db querying but it seems like i would just be putting the settings in the session table as session variables anyway.

i see no benefit to writing db script code on top of my mod code just to support using the session that is dependent upon the database. maybe the guys who wrote this up are trying to make it more difficult to just throw variables into the session.

Andreas 10-20-2005 11:29 PM

The session table is (well, almost) queried always; vBulletin settings are also always loaded.
So why not just use them?

jpodtbc 10-21-2005 04:13 PM

it makes more sense to me just to query my own settings table instead of using both my settings table and the session table.


All times are GMT. The time now is 11:47 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00976 seconds
  • Memory Usage 1,721KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete