1
asridhar
session variables in xoops
  • 2004/12/24 4:27

  • asridhar

  • Just popping in

  • Posts: 3

  • Since: 2004/12/24


Hi,
I am trying to develop a new customized module for my XOOPS powered website. The scripts are PHP. I wanted to use session variables in my web pages, but somehow the session variables are not being stored.

For storing the session variables I
do:
session_start();
and than $_SESSION['variable_name'];

But by using session_is_registered I can figure out that session variables are not being stored across pages. Does XOOPS have its own session handler, if so how do I use it ?

Any help would be greatly appreciated.

Thanks

2
Mithrandir
Re: session variables in xoops

Sessions are maintained by XOOPS.

All you have to do is
$_SESSION['variable_name'] = "value";

to assign a value to a session variable.

3
asridhar
Re: session variables in xoops
  • 2004/12/24 16:50

  • asridhar

  • Just popping in

  • Posts: 3

  • Since: 2004/12/24


Hi,
Thanks for the reply. That is what I was doing, but the session variables are not being registered. The XOOPS files that I have included are
include XOOPS_PATH/include/cp_functions.php (I have modified this file, by removing the admin menu's).

Has anybody else faced a similar problem? Do I need to include some specific files for my modules

4
asridhar
Re: session variables in xoops
  • 2004/12/24 20:53

  • asridhar

  • Just popping in

  • Posts: 3

  • Since: 2004/12/24


I was finally able to figure out the problem. The deal is that XOOPS implements a custom session handler that is initialized and set in ./include/common.php. This custom session handler writes all the sessions into the tabel xoops_session. I had created two seperate datases one for XOOPS, and one for my custom module.

Being new to PHP, I was setting the database to my the custom module database using "mysql_select_db", hence after my PHP script used to run, the active database used to point towards my custo module database.

At this point when the XOOPS custom session handler trys writting the session variables into the database, it fails since it is not able to find the xoops_session table.

The solution to this is that all SQL queries should contain the database name as well. This might be a trivial info, but for some of the newbies it might save some time.

Thanks!!

Login

Who's Online

506 user(s) are online (104 user(s) are browsing Support Forums)


Members: 0


Guests: 506


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits