[dokuwiki] Re: Session variables being reset?
- From: Raam Dev <raamdev@xxxxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Tue, 05 Dec 2006 15:51:52 -0500
I figured out the problem. Hopefully this info will help someone else
who runs across this issue.
DokuWiki creates a new session name called DokuWiki, so any session
variables created and set using the default session name of PHPSESSID
will not be accessible unless you first change the session name. Here is
how I resolved my problem in /lib/tpl/default/main.php:
<?php
...
echo session_name(); // displays "DokuWiki"
session_name("PHPSESSID"); // change session name back to the default
echo session_name(); // displays "PHPSESSID"
echo $_SESSION['myvar']; // displays "abc123"
session_name("DokuWiki"); // set session name back to DokuWiki in case
DokuWiki needs it
...
?>
Raam
Raam Dev wrote:
On test.php I have the following:
<?php
session_start();
$_SESSION['myvar'] = "abc123";
?>
Then, from anywhere within DokuWiki, for example at the top of
/lib/tpl/default/main.php, I add the following:
session_start(); // tried with and without this line
echo $_SESSION['myvar'];
The session variable appears to be empty and does not echo "abc123".
However, if I add the following to main.php:
session_start();
$_SESSION['myvar'] = "abc123";
echo $_SESSION['myvar'];
everything works as expected. Why wouldn't the session variables carry
over when they're set on a page outside DokuWiki? Am I missing something?
Thanks!
Raam
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist
- Follow-Ups:
- [dokuwiki] Re: Session variables being reset?
- From: Raam Dev
- References:
- [dokuwiki] Session variables being reset?
- From: Raam Dev
Other related posts:
- » [dokuwiki] Session variables being reset?
- » [dokuwiki] Re: Session variables being reset?
- » [dokuwiki] Re: Session variables being reset?
- » [dokuwiki] Re: Session variables being reset?
On test.php I have the following: <?php session_start(); $_SESSION['myvar'] = "abc123"; ?>Then, from anywhere within DokuWiki, for example at the top of /lib/tpl/default/main.php, I add the following:
session_start(); // tried with and without this line echo $_SESSION['myvar'];The session variable appears to be empty and does not echo "abc123". However, if I add the following to main.php:
session_start(); $_SESSION['myvar'] = "abc123"; echo $_SESSION['myvar'];everything works as expected. Why wouldn't the session variables carry over when they're set on a page outside DokuWiki? Am I missing something?
Thanks! Raam
- [dokuwiki] Re: Session variables being reset?
- From: Raam Dev
- [dokuwiki] Session variables being reset?
- From: Raam Dev