Passing Variables in a non-CGI LC Server?

Mike Bonner bonnmike at gmail.com
Mon Apr 10 13:22:16 EDT 2017


If you're interested in trying session variables again, I got word back
that the issue I was having is fixed in 8.1.4 rc1 and it does indeed solve
it. (hoping on-rev updates soon)  The newer version also solves the error
you were having (which required using sessionsavepath as a workaround)
I have a very simple page set up on digitalocea (short term) at
http://104.236.179.13/test.lc if you want to see it working.

The script i'm using is:

<?lc

start session

if $_SESSION["counter"] is empty then
   put 1 into $_SESSION["counter"]
end if


put "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
put "<br> The session id is " & the sessionid
stop session

put "<br>" & the version
put "<br>" & shell("uname -a")

?>


On Fri, Apr 7, 2017 at 1:10 PM, Mike Bonner <bonnmike at gmail.com> wrote:

> Yep. We're suffering from different soup flavors (The permission problem
> you're running into.. the need to set the sessionsavepath) vs my soup (it
> won't actually load the session variables) but inedible is inedible, no
> matter the cause. *sigh*
>
> On Fri, Apr 7, 2017 at 12:54 PM, Rick Harrison via use-livecode <
> use-livecode at lists.runrev.com> wrote:
>
>> Hi Mike,
>>
>> Well I’m glad to see I’m not alone here in not
>> being able to get “start session” to work.
>> Now we can enjoy being in the soup together!  LOL
>>
>> Rick
>>
>> > On Apr 7, 2017, at 1:50 PM, Mike Bonner via use-livecode <
>> use-livecode at lists.runrev.com> wrote:
>> >
>> > 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
>> >>
>> > _______________________________________________
>> > 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
>>
>>
>> _______________________________________________
>> 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