Passing Variables in a non-CGI LC Server?

Mike Bonner bonnmike at gmail.com
Fri Apr 7 13:50:58 EDT 2017


Ok. The problem with "start session" is most likely trying to write the
session file to a place without write permissions.  Make sure you set the
sessionsavepath to a place you can write to.

Having said that.. I can't make it work.  I can get past start session, all
the way to stop session, no trouble, but the session variables aren't
populated on start session.  (this is with on-rev most recent installed
version of lc server I assume)
No errors, just.. doesn't work.  The session file is created, I can grab
the sessionid etc, but the session array isn't actually loaded.

I simplified as much as possible to try and figure out WHY it won't work
now. If anyone have ideas, i'd appreciate a pointer.

Heres the code...

<?lc
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 1 into $_SESSION["counter"] -- give initial value if necessary
end if

put "Session counter=" & $_SESSION["counter"] & "<br>"

  add 1 to $_SESSION["counter"]
  put "Incrementing Session counter:" & $_SESSION["counter"]
-- increments and displays the future counter

stop session

?>


On each load, it should increment the current session. So the first hit it
should say 1, and 2 for the future. Then 2 and 3, 3 and 4 4 and 5...
As I said the sessionid file is created as expected (with 4 bytes in it)
but the counter value doesn't appear in the session variables upon start
using like it should.

On Fri, Apr 7, 2017 at 10:58 AM, Matthias Rebbe via use-livecode <
use-livecode at lists.runrev.com> wrote:

>
>
> > Am 07.04.2017 um 18:21 schrieb Rick Harrison via use-livecode <
> use-livecode at lists.runrev.com <mailto:use-livecode at lists.runrev.com>>:
> >
> > Hi Matthias,
> >
> > Yes, I want to output some information to the user, and other
> > information remains hidden - where some data is adjusted,
> > modified, on the third webpage.
> >
> > No, I’m not looking to redirect to another webpage, although
> > I have used that technique in the past on other types of
> > webservers.
> >
>
> So then you could post the parameters from 2nd script/webpage  to the 3rd
> webpage/script (post myData to URL destinationURL) and  then output the
> result or what ever the 3rd script/webpage returns.
>
> This way you do not need to pass the parameters to the url.
>
> > I’d rather not have the parameters put into the URL where
> > the user can see it if possible for security reasons, but
> > if that’s the only way I suppose I could encrypt it before
> > passing it through that way.
>
> >
> > Thank you for your input!
> >
> > Rick
> >
> >
> >> On Apr 7, 2017, at 2:03 AM, Matthias Rebbe via use-livecode <
> use-livecode at lists.runrev.com <mailto:use-livecode at lists.runrev.com>>
> wrote:
> >>
> >> is the third website just for further processing w/o an output to the
> user or do you also want to output some information to the user?
> >>
> >> case 1
> >> You could use the http post or get method to pass the parametesr to the
> 3rd script/website from the 2nd script and return the result then to  the
> 2nd script.
> >> Be aware that your 2nd scrip or better said every lc script, needs to
> do an output, even if it´s just a blank. Otherwise the server returns an
> error 500
> >>
> >> case 2
> >> If i remember right, put header allows you to redirect. So in your 2nd
> script/website after you´ve done whatever you could use put header to
> redirect using put header:
> >>
> >> something like this
> >> put "http://yoursite.com?param1&param2&parame <
> http://yoursite.com/?param1&param2&parame> <http://yoursite.com/?param1&
> param2&parame <http://yoursite.com/?param1&param2&parame>>" into tURL
> >> put  header "Status: 301”
> >> put header "Location:" && tURL
> >> put “redirecting…”   — i am not sure if this last line is still needed,
> but in older versions of lcServer it was.
> >>
> >>
> >> Matthias
> >>
> >
> >
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com <mailto:use-livecode at lists.runrev.com>
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list