Sessions

LiveCode session variables are simliar to session variables in other languages.
You need to include stop session or session variables will not be saved/created.

script 1: The following snippet creates a session variable

<?lc 
start session
put "test" into $_SESSION["myVar"]
put quote & $_SESSION["myVar"] & quote && "saved to session"
stop session
?>

script 2: The following snippet can now access the session variable

<?lc 
start session
put quote & $_SESSION["myVar"] & quote && "read from session"
stop session
?>

Other session commands

  • delete session
  • sessionCookieName – specifies the cookie name used to store the session id
  • sessionID - Specifies the id of the session to be started
  • sessionLivetime - Sets the duration in seconds for which session data is retained between uses
  • sessionName – specifies the cookie name used to store the session id
  • sessionSavePath
  • start session
  • stop session

Leave a Reply