Using the $_POST global in LiveCode server

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Using the $_POST global in LiveCode server

Clarence Martin via use-livecode
Hi,

Is it possible to change, or even delete, the $_POST[] array in LiveCode
server? I want to clear it after my script has pulled out the info it needs.

Or, maybe there's another way to skin the cat. I have a search page that
returns a list of our online TV programs. But even if the page is
reloaded, the previous search term is still "live" in the $_P, so the
page returns the previously searched list of programs. If a user reloads
the page, I want the page to come up with no program list until they
enter a new search term.

Any pointers?

Thanks!

Tim Selander
Tokyo Japan

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using the $_POST global in LiveCode server

Clarence Martin via use-livecode
I don't really understand what I've read yet, but I think what you're
looking for is Post/Redirect/Get (prg)  Basically.. Accept the post,
process it, redirect to another page without the post. (One example I read
basically placed the generated html into a session variable and displayed
it after the get, then cleared it from the session so that a reload
wouldn't show anything)

Lots of examples in php, not sure how to implement with lc.

Another though has just occurred to me also..  If you use session
variables, you can store the search term in the session, and since the
browser will re-post on reload, if $_POST and your session variable contain
the same search term, its possible (likely?) that it was a reload rather
than a new search, then don't do the search. Not sure if this is helpful,
and not sure how to handle the back button either.



On Thu, Aug 2, 2018 at 4:37 PM Tim Selander via use-livecode <
[hidden email]> wrote:

> Hi,
>
> Is it possible to change, or even delete, the $_POST[] array in LiveCode
> server? I want to clear it after my script has pulled out the info it
> needs.
>
> Or, maybe there's another way to skin the cat. I have a search page that
> returns a list of our online TV programs. But even if the page is
> reloaded, the previous search term is still "live" in the $_P, so the
> page returns the previously searched list of programs. If a user reloads
> the page, I want the page to come up with no program list until they
> enter a new search term.
>
> Any pointers?
>
> Thanks!
>
> Tim Selander
> Tokyo Japan
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using the $_POST global in LiveCode server

Clarence Martin via use-livecode
Thanks, Mike.

This seemed like a good hint/possible solution.
> Another though has just occurred to me also..  If you use session
> variables, you can store the search term in the session, and since the
> browser will re-post on reload, if $_POST and your session variable contain
> the same search term, its possible (likely?) that it was a reload rather
> than a new search, then don't do the search. Not sure if this is helpful,
However, when I tried
<?lc
start session
put "test" into $_SESSION["keyword"]
put $_SESSION[keyword]
stop session
?>
and the server returned the error

file "/home/pba/public_html/lifelinesearch.lc"
   row 2, col 1:

This snippet is at the very top of the page, so row 2 is "start session."

Am I misundertanding the syntax of 'session'?

Thanks,

Tim



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using the $_POST global in LiveCode server

Clarence Martin via use-livecode
Its been a while since I messed with sessions, but that looks right.  I
seem to vaguely remember that there is some version of LC server where
sessions is broken, but I can't recall for sure.  What version of server
are you running?   (IIRC sessions was implemented some time around 4.6.3?
And a later version was broken and later fixed)  I'll see if I can relocate
the info.

On Thu, Aug 2, 2018 at 5:53 PM Tim Selander via use-livecode <
[hidden email]> wrote:

> Thanks, Mike.
>
> This seemed like a good hint/possible solution.
> > Another though has just occurred to me also..  If you use session
> > variables, you can store the search term in the session, and since the
> > browser will re-post on reload, if $_POST and your session variable
> contain
> > the same search term, its possible (likely?) that it was a reload rather
> > than a new search, then don't do the search. Not sure if this is helpful,
> However, when I tried
> <?lc
> start session
> put "test" into $_SESSION["keyword"]
> put $_SESSION[keyword]
> stop session
> ?>
> and the server returned the error
>
> file "/home/pba/public_html/lifelinesearch.lc"
>    row 2, col 1:
>
> This snippet is at the very top of the page, so row 2 is "start session."
>
> Am I misundertanding the syntax of 'session'?
>
> Thanks,
>
> Tim
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using the $_POST global in LiveCode server

Clarence Martin via use-livecode
Version 7.1.0 doesn't seem to work.  (the version used by on-rev.)  Pretty
sure its been in this non-working condition for a while.  (again, my faulty
memory might be wrong)   I'll try and set up a test for later versions, but
pretty sure things were still working in the 6.x range of server engines.

On Thu, Aug 2, 2018 at 6:03 PM Mike Bonner <[hidden email]> wrote:

> Its been a while since I messed with sessions, but that looks right.  I
> seem to vaguely remember that there is some version of LC server where
> sessions is broken, but I can't recall for sure.  What version of server
> are you running?   (IIRC sessions was implemented some time around 4.6.3?
> And a later version was broken and later fixed)  I'll see if I can relocate
> the info.
>
> On Thu, Aug 2, 2018 at 5:53 PM Tim Selander via use-livecode <
> [hidden email]> wrote:
>
>> Thanks, Mike.
>>
>> This seemed like a good hint/possible solution.
>> > Another though has just occurred to me also..  If you use session
>> > variables, you can store the search term in the session, and since the
>> > browser will re-post on reload, if $_POST and your session variable
>> contain
>> > the same search term, its possible (likely?) that it was a reload rather
>> > than a new search, then don't do the search. Not sure if this is
>> helpful,
>> However, when I tried
>> <?lc
>> start session
>> put "test" into $_SESSION["keyword"]
>> put $_SESSION[keyword]
>> stop session
>> ?>
>> and the server returned the error
>>
>> file "/home/pba/public_html/lifelinesearch.lc"
>>    row 2, col 1:
>>
>> This snippet is at the very top of the page, so row 2 is "start session."
>>
>> Am I misundertanding the syntax of 'session'?
>>
>> Thanks,
>>
>> Tim
>>
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Using the $_POST global in LiveCode server

Clarence Martin via use-livecode
Still haven't got a test set up.  So trying the quicker easier way.. Hey
everyone, in which versions of server are sessions not broken?

On Thu, Aug 2, 2018 at 6:17 PM Mike Bonner <[hidden email]> wrote:

> Version 7.1.0 doesn't seem to work.  (the version used by on-rev.)  Pretty
> sure its been in this non-working condition for a while.  (again, my faulty
> memory might be wrong)   I'll try and set up a test for later versions, but
> pretty sure things were still working in the 6.x range of server engines.
>
> On Thu, Aug 2, 2018 at 6:03 PM Mike Bonner <[hidden email]> wrote:
>
>> Its been a while since I messed with sessions, but that looks right.  I
>> seem to vaguely remember that there is some version of LC server where
>> sessions is broken, but I can't recall for sure.  What version of server
>> are you running?   (IIRC sessions was implemented some time around 4.6.3?
>> And a later version was broken and later fixed)  I'll see if I can relocate
>> the info.
>>
>> On Thu, Aug 2, 2018 at 5:53 PM Tim Selander via use-livecode <
>> [hidden email]> wrote:
>>
>>> Thanks, Mike.
>>>
>>> This seemed like a good hint/possible solution.
>>> > Another though has just occurred to me also..  If you use session
>>> > variables, you can store the search term in the session, and since the
>>> > browser will re-post on reload, if $_POST and your session variable
>>> contain
>>> > the same search term, its possible (likely?) that it was a reload
>>> rather
>>> > than a new search, then don't do the search. Not sure if this is
>>> helpful,
>>> However, when I tried
>>> <?lc
>>> start session
>>> put "test" into $_SESSION["keyword"]
>>> put $_SESSION[keyword]
>>> stop session
>>> ?>
>>> and the server returned the error
>>>
>>> file "/home/pba/public_html/lifelinesearch.lc"
>>>    row 2, col 1:
>>>
>>> This snippet is at the very top of the page, so row 2 is "start session."
>>>
>>> Am I misundertanding the syntax of 'session'?
>>>
>>> Thanks,
>>>
>>> Tim
>>>
>>>
>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode