Malte, Here's the working code for php, if that helps. Notice that session_start() comes before anything else, including <html>
WORKING CODE: <?php session_start(); if(isset($_SESSION['views'])) $_SESSION['views']=$_SESSION['views']+1; else $_SESSION['views']=1; echo "Views=". $_SESSION['views']; ?> <html> <body> <?php //retrieve session data echo "Pageviews=". $_SESSION['views']; ?> </body> </html> ------------------------------------ --- On Thu, 1/19/12, Malte Brill <[email protected]> wrote: From: Malte Brill <[email protected]> Subject: Re: Session strategies for liveCode server To: [email protected] Date: Thursday, January 19, 2012, 9:02 AM Anyone, pretty please? Andre, Stephen? I just do not get it. I have a login form now and that one calls a liveCode script to validate the user and start a session: <?lc local thePostData,tBenuzer,tPasswort,tDisplayForm put $_POST_RAW into thePostData replace "&" with cr in thePostData put URLDecode(thePostData) into thePostData set the itemDel to "=" put item 2 of line 1 of thepostData into tbenutzer put item 2 of line 2 of thepostData into tPasswort if tBenutzer is empty then put true into tDisplayForm end if if tPasswort is empty then put true into tDisplayForm end if if tDisplayForm then include "login.html" else include "settings.dat" include "myhandlers.lc" if validateUser(tBenutzer,tPasswort) is true then set the sessionID to "mysession" set the sessionlifetime to 1000 start session put item 2 of line 1 of thepostData into $_SESSION["myuser"] -- works up to here... Validation of the user is correct... put "<a href='start.lc'>start</a>" else include "login.html" end if end if ?> As soon as I click the start link the session appears to have died. $_SESSION is empty. It does not have keys either... <?lc if $_SESSION["myuser"] is empty then -- always end up here include "login.html" else put new header "Content-type: text/html; charset=utf-8" include "doctype.lc" ... continued ... I ALWAYS land on the login page though :-( and $_SESSION is ALWAYS empty and does not have any keys at all. What on earth am I doing wrong? Heeeeeeeeeelp... _______________________________________________ use-livecode mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
