I just got them to work, took a bit of experimenting and digging into the dictionary but I'll post a working example. I simplified slightly and don't use a sessionid (so that rev will just generate it all) Also, since I don't have a /test directory for now i'm just putting things into the default folder IE where the .lc file is.
Make sure you have write permission to whatever folder of course.
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
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.
?>
EDIT: If you want to see this example in action go to
http://guidezone.info/test.lc
Edit again: Fixed the link.
Also 1 last thing, the way things are setup with on-rev (if thats what you're using) .irev files default to version 3.5 of the engine. .lc files use the most current engine.