Are you using LiveCode to create server scripts or CGIs?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
ale870
- Posts: 250
- Joined: Tue Apr 22, 2008 9:17 am
-
Contact:
Post
by ale870 » Tue Feb 21, 2012 11:28 am
Hello,
I made some tests but seems that my server does not maintain info for the sessions.
I used the code taken elsewhere in this forum:
Code: Select all
<?lc
put the globalnames into tOldGlobal
-- don't want to write anything till AFTER session starts or it can cause issues
set the sessionSavePath to the defaultfolder -- saving session stuff to the same dir as the .lc
put "<br>THE DEFAULT FOLDER:" && the sessionSavePath & "<br>"
start session
-- start the session. If you don't do this BEFORE your if check, $_SESSION["counter"] will always be empty
if $_SESSION["counter"] is empty then
put "Fred" into $_SESSION["username"]
-- just added a key to see it work
put 1 into $_SESSION["counter"]
-- using a counter as you were implementing
put merge("Before start: [[tOldGlobal]] After start: [[the globalnames]]")& "<br>"
-- shows the global vars before and after
else
-- if there is a session do the else
put $_SESSION["username"] & "<br>"
-- should put the username defined on the first iteration
put "Session detected: Session counter=" & $_SESSION["counter"] & "<br>"
-- same here, puts the current counter
add 1 to $_SESSION["counter"]
put "Incrementing Session counter:" & $_SESSION["counter"]
-- increments and displays the future counter
end if
stop session
-- this is critical. The changes aren't written out to file if you don't explicitly "stop session"
-- so you end up with session files of 4k with no data.
-- after stop session, file is written, and you're good to go for the next round.
?>
Can you help me?
I use Apache 2.2 on Windows.
Livecode cgi works correctly, in fact I can run it. The only problem is SESSION management.
Thank you!
Runtime Revolution Widgets, tutorials, tips & tricks and more!
http://runrevwidgets.com/wiki
-
sturgis
- Livecode Opensource Backer

- Posts: 1685
- Joined: Sat Feb 28, 2009 11:49 pm
Post
by sturgis » Tue Feb 21, 2012 3:26 pm
What version of the server are you running? If you don't have the more recent version, previous versions didn't have session control yet. Might be something to check.
If thats not it, repost and maybe the problem can be found.
ale870 wrote:Hello,
I made some tests but seems that my server does not maintain info for the sessions.
I used the code taken elsewhere in this forum:
Code: Select all
<?lc
put the globalnames into tOldGlobal
-- don't want to write anything till AFTER session starts or it can cause issues
set the sessionSavePath to the defaultfolder -- saving session stuff to the same dir as the .lc
put "<br>THE DEFAULT FOLDER:" && the sessionSavePath & "<br>"
start session
-- start the session. If you don't do this BEFORE your if check, $_SESSION["counter"] will always be empty
if $_SESSION["counter"] is empty then
put "Fred" into $_SESSION["username"]
-- just added a key to see it work
put 1 into $_SESSION["counter"]
-- using a counter as you were implementing
put merge("Before start: [[tOldGlobal]] After start: [[the globalnames]]")& "<br>"
-- shows the global vars before and after
else
-- if there is a session do the else
put $_SESSION["username"] & "<br>"
-- should put the username defined on the first iteration
put "Session detected: Session counter=" & $_SESSION["counter"] & "<br>"
-- same here, puts the current counter
add 1 to $_SESSION["counter"]
put "Incrementing Session counter:" & $_SESSION["counter"]
-- increments and displays the future counter
end if
stop session
-- this is critical. The changes aren't written out to file if you don't explicitly "stop session"
-- so you end up with session files of 4k with no data.
-- after stop session, file is written, and you're good to go for the next round.
?>
Can you help me?
I use Apache 2.2 on Windows.
Livecode cgi works correctly, in fact I can run it. The only problem is SESSION management.
Thank you!
-
ale870
- Posts: 250
- Joined: Tue Apr 22, 2008 9:17 am
-
Contact:
Post
by ale870 » Tue Feb 21, 2012 8:28 pm
I red some info about apache and sessions.l
You are right: my version (2.0) does not support them.
I need version 2.2 in order to apply module sessions.
Thank you for your help!
Runtime Revolution Widgets, tutorials, tips & tricks and more!
http://runrevwidgets.com/wiki
-
sturgis
- Livecode Opensource Backer

- Posts: 1685
- Joined: Sat Feb 28, 2009 11:49 pm
Post
by sturgis » Wed Feb 22, 2012 12:50 am
Actually I had meant the version of livecode server you were running, but if its an apache problem then glad you found it!