Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-06-23 18:25:39

alexvorn2
New Member
Registered: 2008-06-23
Posts: 1

how could i set & read a session ID

how could i set & read a session ID?
any help?

Offline

#2 2008-06-23 20:59:02

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: how could i set & read a session ID

From the help pane of smd_vars:

• Store site visitor preferences. Using mem_self_register, users can create accounts for themselves so that on “admin-like” pages you can store and retrieve per-visitor prefs.

These two should be a good starting point. You can look for some more info in an almost synchronously started thread and maybe share info.

BTW, you don’t spread your own blog in your sig ;)

Last edited by uli (2008-06-23 21:01:23)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#3 2008-06-23 21:08:53

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,451
Website GitHub

Re: how could i set & read a session ID

Hehe, don’t listen to me on my other threads, I talk rubbish :-)

I’ve done it before using the usual PHP session handling code, namely just make a form that’s called fairly early on in your page template. That form can contain:

<txp:php>
  session_start();
</txp:php>

and you’re away. There should be nothing stopping you using the $_SESSION variable from then on inside <txp:php> tags. Failing that, this works for sure if you don’t mind an external file hanging around:

<txp:php>
  global $pretext;
  include_once $pretext['path_to_site'] . "/some_dir/session.php";
</txp:php>

And then collect together your session handling routines in session.php, which you can refer to in your forms/pages. Does that get you started?

Last edited by Bloke (2008-06-23 21:11:32)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB