PHP Sessions
From phpCMS
[edit] Using PHP-based sessions in phpCMS
Those who do not know about PHP-based sessions, their usage or what they are needed for do not need to read this chapter.
Using PHP-based sessions in phpCMS poses no problem as long as one can rely on cookies, but if you're forced to use the 'trans_sid' workaround, you end up with a problem: PHP attaches the SID to relative URLs, but phpCMS onl creates absolute links. Thus, PHP-based sessions cease to function once there are no cookies enabled for the current visitor.
The most elegant solution would likely be the tag-file:
$sid := <!-- PAXPHP SID
echo SID;
PAXPHP SID -->
$sid_hidden := <!-- PAXPHP SID_HIDDEN
echo '<input type="hidden" name="'.session_name().'" value="'.session_id().'" />';
PAXPHP SID_HIDDEN -->
This solution has the big advantage that it's compatible to the next phpCMS version, which will have session-handling, and will use the tags $sid and $sid_hidden (the latter for hidden fields in forms).
The such defined tags now only need to be added to the links they're needed in. Unfortunately, this deactivates caching - on the other hand, pages that use sessions usally aren't cachable - static pages don't need sessions.
Based on a (german) thread from the phpCMS supportforum
Main Page: Tutorials MainPage | Top Page: MiniHowTos MainPage
Diese Seite in anderen Sprachen: Deutsch

