[TYPO3-english] Session handling

Tomaz Zaman tomaz at optiss.si
Thu Aug 18 00:26:07 CEST 2011


Hey,

I  have a small problem regarding sessions:
I want to append the url with a GET variable pro=1 but prior to that, I 
want to check whether a visitor was on a particular page.

I set the variable by doing this:

/fileadmin/scripts/handleCookie.php:
<?php
class user_handleCookie
{
	var $cObj;
	function main($content,$conf)
	{
		$GLOBALS["TSFE"]->fe_user->setKey('ses','level', $conf['level']);
		return $content;
	}
}
?>

Then in TS:
[globalVar = TSFE:id = 9]
lib.level = USER_INT
lib.level.userFunc = user_handleCookie->main
lib.level.level = pro
[global]

Based on my debugging, this gets written to the session properly, but 
the problem is in setting a condition to append the GET var in TMENU:

[userFunc = user_match(pro)]
…
[global]

and the function is located in localconf.php (for now):

function user_match($level)
{
	if($GLOBALS['TSFE']->fe_user->getKey('ses', 'level') == $level) return true;
	else return false;
}

But this never returns true, and I'm unsure why.

Thanx!

-- 
--------------------------------------------------------
Tomaz Zaman, certified TYPO3 integrator



More information about the TYPO3-english mailing list