You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_dtcl@tcl.apache.org by Ilic Aleksandar <fl...@gavrilo.elfak.ni.ac.yu> on 2001/10/03 19:34:33 UTC

Sessions

Can I make sessions in mod_dtcl
						Ilic Aleksandar


Re: Sessions

Posted by Wojciech Kocjan <wo...@kocjan.org>.
http://dl.zoro2.org/session.tgz - this is a small mySQL tcl-sql wrapper
and sessions stuff

Here's the code but I'm not sure if you'll understand it if you're not a
good programmer.

The easiest way to do sessions is as follows: (no
<?
array set session $COOKIES(session)
# do some stuff like:
if {![info exists session(cnt)]} {
    set cnt 0
}
incr cnt
headers setcookie -name session -value [array get session]
?>

This one is a simple way to store an array on client's machine. The
problems are:
1/ you cannot rely on data sent to you from the client (server-side
 sessions are a bit safer on that)
2/ cookies have a size limit of something under 4096 bytes - so you
 cannot store too much data :(

But this is how I started and still do it for smaller projects - like
simple forms with last-entered values stored in a cookie.

--
WK



Re: Sessions

Posted by Ilic Aleksandar <fl...@gavrilo.elfak.ni.ac.yu>.
Hi,
My problem is that I am still not enough good programer, and I curently
don;t know how to implement sessions:(  especialy I don't nothing about
$COOKIES() , and what ver ov mod_dtcl I have to use cause new ones doesn't
work for me. I would be thankfull if you send me some part of codes just
to see how to do sessions.
					Thnx, Ilic Aleksandar


> mod_dtcl by itself does not provide sessions :(
>
> However I've written some pieces of code which allow to use mySQL for
> sessions. I may send it to you, but it's a bit messy :( [it may require
> code changes to work apart from my small user/password system]
>
> But you may write one yourself, it isn't that complicated. It uses
> headers setcookie and $COOKIES() to store sessions IDs and SQL to store
> data.
>




Re: Sessions

Posted by Wojciech Kocjan <wo...@kocjan.org>.
mod_dtcl by itself does not provide sessions :(

However I've written some pieces of code which allow to use mySQL for
sessions. I may send it to you, but it's a bit messy :( [it may require
code changes to work apart from my small user/password system]

But you may write one yourself, it isn't that complicated. It uses
headers setcookie and $COOKIES() to store sessions IDs and SQL to store
data.

--
WK