Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

<wiggy> in a stunning new move I actually tested this upload


devel / comp.lang.php / 2D array by POST

SubjectAuthor
* 2D array by POSTLiz Tuddenham
`* Re: 2D array by POSTJ.O. Aho
 +- Re: 2D array by POSTLiz Tuddenham
 `* Re: 2D array by POSTJ.O. Aho
  +* Re: 2D array by POSTLiz Tuddenham
  |`* Re: 2D array by POSTJerry Stuckle
  | `* Re: 2D array by POSTJ.O. Aho
  |  +* Re: 2D array by POSTJ.O. Aho
  |  |`- Re: 2D array by POSTJerry Stuckle
  |  +* Re: 2D array by POSTLiz Tuddenham
  |  |`* Re: 2D array by POSTJ.O. Aho
  |  | `* Re: 2D array by POSTArne Vajhøj
  |  |  `* Re: 2D array by POSTLiz Tuddenham
  |  |   `- Re: 2D array by POSTStefan Froehlich
  |  `- Re: 2D array by POSTJerry Stuckle
  `* Re: 2D array by POSTArne Vajhøj
   `- Re: 2D array by POSTJerry Stuckle

1
2D array by POST

<1qaxqzf.194a8511hkkk6aN%liz@poppyrecords.invalid.invalid>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=858&group=comp.lang.php#858

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: liz@poppyrecords.invalid.invalid (Liz Tuddenham)
Newsgroups: comp.lang.php
Subject: 2D array by POST
Date: Thu, 18 May 2023 17:04:01 +0100
Organization: Poppy Records
Lines: 15
Message-ID: <1qaxqzf.194a8511hkkk6aN%liz@poppyrecords.invalid.invalid>
X-Trace: individual.net eCsD5SCVcsxxb8N5xqrMZgvofHIMnnaYi9C7F3NHYaW7czaxyf
X-Orig-Path: liz
Cancel-Lock: sha1:r3ewyJ8nJkTPj4W86AD53UKmFRU=
User-Agent: MacSOUP/2.4.6
 by: Liz Tuddenham - Thu, 18 May 2023 16:04 UTC

I need to send a 2-dimensional array from one file to another by POST.
The array is $item[][] with contents that are entirelyintegers.

I have tried :
Print "<INPUT TYPE=hidden NAME=item[] VALUE=$item>";
with
$item = stripslashes($_POST['item']);
but it does not work.

Any suggestions?

--
~ Liz Tuddenham ~
(Remove the ".invalid"s and add ".co.uk" to reply)
www.poppyrecords.co.uk

Re: 2D array by POST

<kcn3tdFehn1U1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=859&group=comp.lang.php#859

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: user@example.net (J.O. Aho)
Newsgroups: comp.lang.php
Subject: Re: 2D array by POST
Date: Thu, 18 May 2023 19:00:29 +0200
Lines: 22
Message-ID: <kcn3tdFehn1U1@mid.individual.net>
References: <1qaxqzf.194a8511hkkk6aN%liz@poppyrecords.invalid.invalid>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net 5PoZjbD7sx6aJpwcfVhzNAn3b6/PwZTstMUnHNUvG8ukOSVzdX
Cancel-Lock: sha1:JEcb9seV6mJeGFiU2tUKeJC7vbo=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Content-Language: en-US-large
In-Reply-To: <1qaxqzf.194a8511hkkk6aN%liz@poppyrecords.invalid.invalid>
 by: J.O. Aho - Thu, 18 May 2023 17:00 UTC

On 5/18/23 18:04, Liz Tuddenham wrote:
> I need to send a 2-dimensional array from one file to another by POST.
> The array is $item[][] with contents that are entirelyintegers.
>
> I have tried :
> Print "<INPUT TYPE=hidden NAME=item[] VALUE=$item>";
> with
> $item = stripslashes($_POST['item']);
> but it does not work.
>
> Any suggestions?

1. use session, store the value in the session and then use it in the
next page directly from the session.

2. serialize the variable and base64 encode the serialized data, post
this in the form and then base64 decode and unserialize.

--
//Aho

Re: 2D array by POST

<1qay330.vzvx3yi42zy0N%liz@poppyrecords.invalid.invalid>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=860&group=comp.lang.php#860

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news.szaf.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: liz@poppyrecords.invalid.invalid (Liz Tuddenham)
Newsgroups: comp.lang.php
Subject: Re: 2D array by POST
Date: Thu, 18 May 2023 21:17:09 +0100
Organization: Poppy Records
Lines: 26
Message-ID: <1qay330.vzvx3yi42zy0N%liz@poppyrecords.invalid.invalid>
References: <1qaxqzf.194a8511hkkk6aN%liz@poppyrecords.invalid.invalid> <kcn3tdFehn1U1@mid.individual.net>
X-Trace: individual.net 7F1WTmFlPC4qq/0JEtdjnwlseK6tia94co6in5aQy3HFqwdBCw
X-Orig-Path: liz
Cancel-Lock: sha1:yxdN2dMYfCfKsJ1p/MwrAgh59VA=
User-Agent: MacSOUP/2.4.6
 by: Liz Tuddenham - Thu, 18 May 2023 20:17 UTC

J.O. Aho <user@example.net> wrote:

> On 5/18/23 18:04, Liz Tuddenham wrote:
> > I need to send a 2-dimensional array from one file to another by POST.
> > The array is $item[][] with contents that are entirelyintegers.
> >
> > I have tried :
> > Print "<INPUT TYPE=hidden NAME=item[] VALUE=$item>";
> > with
> > $item = stripslashes($_POST['item']);
> > but it does not work.
> >
> > Any suggestions?
>
> 1. use session, store the value in the session and then use it in the
> next page directly from the session.
>
> 2. serialize the variable and base64 encode the serialized data, post
> this in the form and then base64 decode and unserialize.

Thanks, I'll try those suggestios.

--
~ Liz Tuddenham ~
(Remove the ".invalid"s and add ".co.uk" to reply)
www.poppyrecords.co.uk

Re: 2D array by POST

<kcnkirFh5ehU1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=861&group=comp.lang.php#861

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: user@example.net (J.O. Aho)
Newsgroups: comp.lang.php
Subject: Re: 2D array by POST
Date: Thu, 18 May 2023 23:44:59 +0200
Lines: 34
Message-ID: <kcnkirFh5ehU1@mid.individual.net>
References: <1qaxqzf.194a8511hkkk6aN%liz@poppyrecords.invalid.invalid>
<kcn3tdFehn1U1@mid.individual.net> <u465s8$8kf$13@gallifrey.nk.ca>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net OyxHdhfJ5tMXQ8Tva/o/VgQOpOn3/Y/GZXhOwaYHlkWVHbaG2+
Cancel-Lock: sha1:5I3JKNoKMF+EGHDc6xBWEqcy2ko=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Content-Language: en-US-large
In-Reply-To: <u465s8$8kf$13@gallifrey.nk.ca>
 by: J.O. Aho - Thu, 18 May 2023 21:44 UTC

On 5/18/23 23:38, The Doctor wrote:
> In article <kcn3tdFehn1U1@mid.individual.net>,
> J.O. Aho <user@example.net> wrote:
>> On 5/18/23 18:04, Liz Tuddenham wrote:
>>> I need to send a 2-dimensional array from one file to another by POST.
>>> The array is $item[][] with contents that are entirelyintegers.
>>>
>>> I have tried :
>>> Print "<INPUT TYPE=hidden NAME=item[] VALUE=$item>";
>>> with
>>> $item = stripslashes($_POST['item']);
>>> but it does not work.
>>>
>>> Any suggestions?
>>
>> 1. use session, store the value in the session and then use it in the
>> next page directly from the session.
>>
>> 2. serialize the variable and base64 encode the serialized data, post
>> this in the form and then base64 decode and unserialize.
>>
>
> Is base64 strong enugh?

It's not about the encryption, it's about not making the html to break
as you don't know what the serialized data may contain.

if the data is sensitive or you want to avoid user manipulation of the
data, then store the data in session and that is way it was number 1 of
the suggestions.

--
//Aho

Re: 2D array by POST

<1qayusl.14by37z1ufi932N%liz@poppyrecords.invalid.invalid>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=862&group=comp.lang.php#862

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: liz@poppyrecords.invalid.invalid (Liz Tuddenham)
Newsgroups: comp.lang.php
Subject: Re: 2D array by POST
Date: Fri, 19 May 2023 07:19:47 +0100
Organization: Poppy Records
Lines: 43
Message-ID: <1qayusl.14by37z1ufi932N%liz@poppyrecords.invalid.invalid>
References: <1qaxqzf.194a8511hkkk6aN%liz@poppyrecords.invalid.invalid> <kcn3tdFehn1U1@mid.individual.net> <u465s8$8kf$13@gallifrey.nk.ca> <kcnkirFh5ehU1@mid.individual.net>
X-Trace: individual.net /8rgMt+m2eDlLjyvDZdnDgA+HnVo2FzrdQo55c/NAXqU5co4bY
X-Orig-Path: liz
Cancel-Lock: sha1:NdAfwD8wH8pGJLgcWK23AT6qFXA=
User-Agent: MacSOUP/2.4.6
 by: Liz Tuddenham - Fri, 19 May 2023 06:19 UTC

J.O. Aho <user@example.net> wrote:

> On 5/18/23 23:38, The Doctor wrote:
> > In article <kcn3tdFehn1U1@mid.individual.net>,
> > J.O. Aho <user@example.net> wrote:
> >> On 5/18/23 18:04, Liz Tuddenham wrote:
> >>> I need to send a 2-dimensional array from one file to another by POST.
> >>> The array is $item[][] with contents that are entirelyintegers.
> >>>
> >>> I have tried :
> >>> Print "<INPUT TYPE=hidden NAME=item[] VALUE=$item>";
> >>> with
> >>> $item = stripslashes($_POST['item']);
> >>> but it does not work.
> >>>
> >>> Any suggestions?
> >>
> >> 1. use session, store the value in the session and then use it in the
> >> next page directly from the session.
> >>
> >> 2. serialize the variable and base64 encode the serialized data, post
> >> this in the form and then base64 decode and unserialize.
> >>
> >
> > Is base64 strong enugh?
>
> It's not about the encryption, it's about not making the html to break
> as you don't know what the serialized data may contain.
>
> if the data is sensitive or you want to avoid user manipulation of the
> data, then store the data in session and that is way it was number 1 of
> the suggestions.

The data isn't particularly sensitive, it is just a 'shopping list'
passed from one part of a shopping program to another. It could have
been sent as dozens of individual variables, but that seemed clumsy as
they were already nicely wrapped up in an array.

--
~ Liz Tuddenham ~
(Remove the ".invalid"s and add ".co.uk" to reply)
www.poppyrecords.co.uk

Re: 2D array by POST

<u4867n$nduf$1@jstuckle.eternal-september.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=863&group=comp.lang.php#863

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!jstuckle.eternal-september.org!.POSTED!not-for-mail
From: stuckle.jerry@gmail.com (Jerry Stuckle)
Newsgroups: comp.lang.php
Subject: Re: 2D array by POST
Date: Fri, 19 May 2023 11:56:21 -0400
Organization: A noiseless patient Spider
Lines: 54
Message-ID: <u4867n$nduf$1@jstuckle.eternal-september.org>
References: <1qaxqzf.194a8511hkkk6aN%liz@poppyrecords.invalid.invalid>
<kcn3tdFehn1U1@mid.individual.net> <u465s8$8kf$13@gallifrey.nk.ca>
<kcnkirFh5ehU1@mid.individual.net>
<1qayusl.14by37z1ufi932N%liz@poppyrecords.invalid.invalid>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 19 May 2023 15:56:39 -0000 (UTC)
Injection-Info: jstuckle.eternal-september.org; posting-host="50ebf524495ffa933f889af61c88374b";
logging-data="767951"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+L7ndIwjbhRqPjwh+g5UdMaqIjD3A2zfg="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.10.1
Cancel-Lock: sha1:lkcyfGMCzWC02mrnK1Oi0s4LQF0=
Content-Language: en-US
In-Reply-To: <1qayusl.14by37z1ufi932N%liz@poppyrecords.invalid.invalid>
 by: Jerry Stuckle - Fri, 19 May 2023 15:56 UTC

On 5/19/2023 2:19 AM, Liz Tuddenham wrote:
> J.O. Aho <user@example.net> wrote:
>
>> On 5/18/23 23:38, The Doctor wrote:
>>> In article <kcn3tdFehn1U1@mid.individual.net>,
>>> J.O. Aho <user@example.net> wrote:
>>>> On 5/18/23 18:04, Liz Tuddenham wrote:
>>>>> I need to send a 2-dimensional array from one file to another by POST.
>>>>> The array is $item[][] with contents that are entirelyintegers.
>>>>>
>>>>> I have tried :
>>>>> Print "<INPUT TYPE=hidden NAME=item[] VALUE=$item>";
>>>>> with
>>>>> $item = stripslashes($_POST['item']);
>>>>> but it does not work.
>>>>>
>>>>> Any suggestions?
>>>>
>>>> 1. use session, store the value in the session and then use it in the
>>>> next page directly from the session.
>>>>
>>>> 2. serialize the variable and base64 encode the serialized data, post
>>>> this in the form and then base64 decode and unserialize.
>>>>
>>>
>>> Is base64 strong enugh?
>>
>> It's not about the encryption, it's about not making the html to break
>> as you don't know what the serialized data may contain.
>>
>> if the data is sensitive or you want to avoid user manipulation of the
>> data, then store the data in session and that is way it was number 1 of
>> the suggestions.
>
> The data isn't particularly sensitive, it is just a 'shopping list'
> passed from one part of a shopping program to another. It could have
> been sent as dozens of individual variables, but that seemed clumsy as
> they were already nicely wrapped up in an array.
>
>

J.O. has the right idea. The way to do this is to store the data in the
$_SESSION variable to pass it on to the next page.

This is especially true if it has things like prices - which the user
can change if you give them access to it via a web page.

--
==================
Remove the "x"'s from my email address
Jerry Stuckle
stucklex.jerryx@gmail.com
==================

Re: 2D array by POST

<kcptd9Fs4adU1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=864&group=comp.lang.php#864

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!hirsch.in-berlin.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: user@example.net (J.O. Aho)
Newsgroups: comp.lang.php
Subject: Re: 2D array by POST
Date: Fri, 19 May 2023 20:27:53 +0200
Lines: 63
Message-ID: <kcptd9Fs4adU1@mid.individual.net>
References: <1qaxqzf.194a8511hkkk6aN%liz@poppyrecords.invalid.invalid>
<kcn3tdFehn1U1@mid.individual.net> <u465s8$8kf$13@gallifrey.nk.ca>
<kcnkirFh5ehU1@mid.individual.net>
<1qayusl.14by37z1ufi932N%liz@poppyrecords.invalid.invalid>
<u4867n$nduf$1@jstuckle.eternal-september.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net L9jfcvGMsrik6RZOvCS2pAsT/U2qTIX1Yb1y7CuvRrdKSLZ5d8
Cancel-Lock: sha1:/qeirDX6thKp2DWLLI9VK4WXztw=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Content-Language: en-US-large
In-Reply-To: <u4867n$nduf$1@jstuckle.eternal-september.org>
 by: J.O. Aho - Fri, 19 May 2023 18:27 UTC

On 5/19/23 17:56, Jerry Stuckle wrote:
> On 5/19/2023 2:19 AM, Liz Tuddenham wrote:
>> J.O. Aho <user@example.net> wrote:
>>
>>> On 5/18/23 23:38, The Doctor wrote:
>>>> In article <kcn3tdFehn1U1@mid.individual.net>,
>>>> J.O. Aho <user@example.net> wrote:
>>>>> On 5/18/23 18:04, Liz Tuddenham wrote:
>>>>>> I need to send a 2-dimensional array from one file to another by
>>>>>> POST.
>>>>>> The array is $item[][] with contents that are entirelyintegers.
>>>>>>
>>>>>> I have tried :
>>>>>>     Print "<INPUT TYPE=hidden NAME=item[] VALUE=$item>";
>>>>>> with
>>>>>> $item = stripslashes($_POST['item']);
>>>>>> but it does not work.
>>>>>>
>>>>>>     Any suggestions?
>>>>>
>>>>> 1. use session, store the value in the session and then use it in the
>>>>> next page directly from the session.
>>>>>
>>>>> 2. serialize the variable and base64 encode the serialized data, post
>>>>> this in the form and then base64 decode and unserialize.
>>>>>
>>>>
>>>> Is base64 strong enugh?
>>>
>>> It's not about the encryption, it's about not making the html to break
>>> as you don't know what the serialized data may contain.
>>>
>>> if the data is sensitive or you want to avoid user manipulation of the
>>> data, then store the data in session and that is way it was number 1 of
>>> the suggestions.
>>
>> The data isn't particularly sensitive, it is just a 'shopping list'
>> passed from one part of a shopping program to another.  It could have
>> been sent as dozens of individual variables, but that seemed clumsy as
>> they were already nicely wrapped up in an array.
>>
>>
>
> J.O. has the right idea.  The way to do this is to store the data in the
> $_SESSION variable to pass it on to the next page.

You have the thread "Replace punctuation in an associative array" where
you can see an example on how it could be possible to work with the
session, I do not claim it's the best solution, but based on the
"requirements", it's a good solution for a half hour work.

> This is especially true if it has things like prices - which the user
> can change if you give them access to it via a web page.

Yeah, I tend to favor to take prices from the database each time, this
more to keep the prices up to date, as then if someone changes a price
on a product that price change will get trough at once on all orders
that are not finalized.

--
//Aho

Re: 2D array by POST

<kcptglFs4adU2@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=865&group=comp.lang.php#865

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: user@example.net (J.O. Aho)
Newsgroups: comp.lang.php
Subject: Re: 2D array by POST
Date: Fri, 19 May 2023 20:29:41 +0200
Lines: 66
Message-ID: <kcptglFs4adU2@mid.individual.net>
References: <1qaxqzf.194a8511hkkk6aN%liz@poppyrecords.invalid.invalid>
<kcn3tdFehn1U1@mid.individual.net> <u465s8$8kf$13@gallifrey.nk.ca>
<kcnkirFh5ehU1@mid.individual.net>
<1qayusl.14by37z1ufi932N%liz@poppyrecords.invalid.invalid>
<u4867n$nduf$1@jstuckle.eternal-september.org>
<kcptd9Fs4adU1@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net C9KSOntIcolDZxHTblKbNAJ+xl1w75Mvc5VR89p7KIANUFLPHW
Cancel-Lock: sha1:eCe4Df4j7dxDm6DgHD3VPHK4yx8=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Content-Language: en-US-large
In-Reply-To: <kcptd9Fs4adU1@mid.individual.net>
 by: J.O. Aho - Fri, 19 May 2023 18:29 UTC

On 5/19/23 20:27, J.O. Aho wrote:
> On 5/19/23 17:56, Jerry Stuckle wrote:
>> On 5/19/2023 2:19 AM, Liz Tuddenham wrote:
>>> J.O. Aho <user@example.net> wrote:
>>>
>>>> On 5/18/23 23:38, The Doctor wrote:
>>>>> In article <kcn3tdFehn1U1@mid.individual.net>,
>>>>> J.O. Aho <user@example.net> wrote:
>>>>>> On 5/18/23 18:04, Liz Tuddenham wrote:
>>>>>>> I need to send a 2-dimensional array from one file to another by
>>>>>>> POST.
>>>>>>> The array is $item[][] with contents that are entirelyintegers.
>>>>>>>
>>>>>>> I have tried :
>>>>>>>     Print "<INPUT TYPE=hidden NAME=item[] VALUE=$item>";
>>>>>>> with
>>>>>>> $item = stripslashes($_POST['item']);
>>>>>>> but it does not work.
>>>>>>>
>>>>>>>     Any suggestions?
>>>>>>
>>>>>> 1. use session, store the value in the session and then use it in the
>>>>>> next page directly from the session.
>>>>>>
>>>>>> 2. serialize the variable and base64 encode the serialized data, post
>>>>>> this in the form and then base64 decode and unserialize.
>>>>>>
>>>>>
>>>>> Is base64 strong enugh?
>>>>
>>>> It's not about the encryption, it's about not making the html to break
>>>> as you don't know what the serialized data may contain.
>>>>
>>>> if the data is sensitive or you want to avoid user manipulation of the
>>>> data, then store the data in session and that is way it was number 1 of
>>>> the suggestions.
>>>
>>> The data isn't particularly sensitive, it is just a 'shopping list'
>>> passed from one part of a shopping program to another.  It could have
>>> been sent as dozens of individual variables, but that seemed clumsy as
>>> they were already nicely wrapped up in an array.
>>>
>>>
>>
>> J.O. has the right idea.  The way to do this is to store the data in
>> the $_SESSION variable to pass it on to the next page.
>
> You have the thread "Replace punctuation in an associative array" where
> you can see an example on how it could be possible to work with the
> session, I do not claim it's the best solution, but based on the
> "requirements", it's a good solution for a half hour work.
>
>
>> This is especially true if it has things like prices - which the user
>> can change if you give them access to it via a web page.
>
> Yeah, I tend to favor to take prices from the database each time, this
> more to keep the prices up to date, as then if someone changes a price
> on a product that price change will get trough at once on all orders
> that are not finalized.

Sorry, thought I replied to Liz, the two section I write was more
intended for her than replaying to you.

--
//Aho

Re: 2D array by POST

<1qazulp.cmhlm71x8dryN%liz@poppyrecords.invalid.invalid>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=866&group=comp.lang.php#866

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: liz@poppyrecords.invalid.invalid (Liz Tuddenham)
Newsgroups: comp.lang.php
Subject: Re: 2D array by POST
Date: Fri, 19 May 2023 20:38:03 +0100
Organization: Poppy Records
Lines: 26
Message-ID: <1qazulp.cmhlm71x8dryN%liz@poppyrecords.invalid.invalid>
References: <1qaxqzf.194a8511hkkk6aN%liz@poppyrecords.invalid.invalid> <kcn3tdFehn1U1@mid.individual.net> <u465s8$8kf$13@gallifrey.nk.ca> <kcnkirFh5ehU1@mid.individual.net> <1qayusl.14by37z1ufi932N%liz@poppyrecords.invalid.invalid> <u4867n$nduf$1@jstuckle.eternal-september.org> <kcptd9Fs4adU1@mid.individual.net>
X-Trace: individual.net othUap2rcAd5RjUZwueZIAvIrbn4nWYZqpYaFJgqnm3K1T4BZg
X-Orig-Path: liz
Cancel-Lock: sha1:y4uPXORYH1fBg8tJubnxBWsKPAM=
User-Agent: MacSOUP/2.4.6
 by: Liz Tuddenham - Fri, 19 May 2023 19:38 UTC

J.O. Aho <user@example.net> wrote:

[...]
> Yeah, I tend to favor to take prices from the database each time, this
> more to keep the prices up to date, as then if someone changes a price
> on a product that price change will get trough at once on all orders
> that are not finalized.

Unfortunately that could lead to an illegal situation in the UK. The
price has to be the one the user agreed to at the instant of clicking
the button. If the database has been updated between there and the
checkout, the original price must still be charged. (An unlikely
scenario, but one with potentially very damaging consequences.)

The agreed-to price is carried through the transaction by a cookie, the
small risk of tampering (and the low value of the goods) make this an
acceptable risk. The final account is e-mailed to the dispatcher, so
any price anomalies ought to be caught at that stage. (This is a small
voluntary organisation with a very limited range of stock, so errors
should be easy to spot.)

--
~ Liz Tuddenham ~
(Remove the ".invalid"s and add ".co.uk" to reply)
www.poppyrecords.co.uk

Re: 2D array by POST

<kcq9nvFtsk3U1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=867&group=comp.lang.php#867

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: user@example.net (J.O. Aho)
Newsgroups: comp.lang.php
Subject: Re: 2D array by POST
Date: Fri, 19 May 2023 23:58:23 +0200
Lines: 47
Message-ID: <kcq9nvFtsk3U1@mid.individual.net>
References: <1qaxqzf.194a8511hkkk6aN%liz@poppyrecords.invalid.invalid>
<kcn3tdFehn1U1@mid.individual.net> <u465s8$8kf$13@gallifrey.nk.ca>
<kcnkirFh5ehU1@mid.individual.net>
<1qayusl.14by37z1ufi932N%liz@poppyrecords.invalid.invalid>
<u4867n$nduf$1@jstuckle.eternal-september.org>
<kcptd9Fs4adU1@mid.individual.net>
<1qazulp.cmhlm71x8dryN%liz@poppyrecords.invalid.invalid>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net OWuOFYaGeRvvGS2bc/0KPQ5dQMP2uz7/UaJ1zPkSBvxwNdRVSL
Cancel-Lock: sha1:zxfHcW3FcBlaRfFCGd2iZamQsCM=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Content-Language: en-US-large
In-Reply-To: <1qazulp.cmhlm71x8dryN%liz@poppyrecords.invalid.invalid>
 by: J.O. Aho - Fri, 19 May 2023 21:58 UTC

On 5/19/23 21:38, Liz Tuddenham wrote:
> J.O. Aho <user@example.net> wrote:
>
> [...]
>> Yeah, I tend to favor to take prices from the database each time, this
>> more to keep the prices up to date, as then if someone changes a price
>> on a product that price change will get trough at once on all orders
>> that are not finalized.
>
> Unfortunately that could lead to an illegal situation in the UK. The
> price has to be the one the user agreed to at the instant of clicking
> the button. If the database has been updated between there and the
> checkout, the original price must still be charged. (An unlikely
> scenario, but one with potentially very damaging consequences.)

Sure you shouldn't change price when the end customer agrees on the cost
and is sent to the payment page, at this point you can't change the
price, but until the customer can at any point decide that the updated
price isn't what they are prepared to pay for the product and remove it
from the cart. Of course it's a good thing to notify if the price would
change, one site that does this is amazon.co.uk.

> The agreed-to price is carried through the transaction by a cookie, the
> small risk of tampering (and the low value of the goods) make this an
> acceptable risk.

I would fire anyone in my team if they would say it's an acceptable
risk, values of a product, no matter if it's small and insignificant,
shouldn't ever be end user adjustable and when it comes out that you can
adjust the price, then people will start doing that and it's kind of a
simple thing to do nowadays with all the browser extensions.

> The final account is e-mailed to the dispatcher, so
> any price anomalies ought to be caught at that stage. (This is a small
> voluntary organisation with a very limited range of stock, so errors
> should be easy to spot.)

There are times when you have someone new, so mistakes can easily be done.
Do not downplay the risk just for it's a small organization and limited
stock, tend to be those who has most to loose if someone manage to cheat.

--
//Aho

Re: 2D array by POST

<u497rp$r6t8$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=868&group=comp.lang.php#868

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: arne@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.lang.php
Subject: Re: 2D array by POST
Date: Fri, 19 May 2023 21:30:30 -0400
Organization: A noiseless patient Spider
Lines: 59
Message-ID: <u497rp$r6t8$1@dont-email.me>
References: <1qaxqzf.194a8511hkkk6aN%liz@poppyrecords.invalid.invalid>
<kcn3tdFehn1U1@mid.individual.net> <u465s8$8kf$13@gallifrey.nk.ca>
<kcnkirFh5ehU1@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 20 May 2023 01:30:34 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="89e6063ec70cb83fa138411a114675ec";
logging-data="891816"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18jo+U0/kYMaDLMj1UAmroVOWnBTRqSrKs="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:rkbPt+86ZqyEnKbgAAgGZqE3uB0=
In-Reply-To: <kcnkirFh5ehU1@mid.individual.net>
Content-Language: en-US
 by: Arne Vajhøj - Sat, 20 May 2023 01:30 UTC

On 5/18/2023 5:44 PM, J.O. Aho wrote:
> On 5/18/23 23:38, The Doctor wrote:
>> In article <kcn3tdFehn1U1@mid.individual.net>,
>> J.O. Aho <user@example.net> wrote:
>>> On 5/18/23 18:04, Liz Tuddenham wrote:
>>>> I need to send a 2-dimensional array from one file to another by POST.
>>>> The array is $item[][] with contents that are entirelyintegers.
>>>>
>>>> I have tried :
>>>>    Print "<INPUT TYPE=hidden NAME=item[] VALUE=$item>";
>>>> with
>>>> $item = stripslashes($_POST['item']);
>>>> but it does not work.
>>>>
>>>>    Any suggestions?
>>>
>>> 1. use session, store the value in the session and then use it in the
>>> next page directly from the session.
>>>
>>> 2. serialize the variable and base64 encode the serialized data, post
>>> this in the form and then base64 decode and unserialize.
>>>
>>
>> Is base64 strong enugh?
>
> It's not about the encryption, it's about not making the html to break
> as you don't know what the serialized data may contain.
>
> if the data is sensitive or you want to avoid user manipulation of the
> data, then store the data in session and that is way it was number 1 of
> the suggestions.

The concept of "page scope" or "view state" is well
known in some other technologies (like ASP.NET and JSF).
That may end up as a HTML hidden field like this.

In such cases it should always be secured cryptographic
(MAC etc.). Frameworks that supports page scope / view state
via hidden field usually have this enabled by default.

Given that this is not supported out of the box in PHP
(I have no idea whether any of the well known PHP MVC
frameworks offer such support), then it is not an
easy solution to implement.

So using session absolutely looks like the path of least
resistance.

But people should be aware that switching from page
scope to session scope is only transparent in 99.9% or
so of cases. There are (rare) cases where it will impact
functionality.

Arne

Re: 2D array by POST

<u498hr$r8u1$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=869&group=comp.lang.php#869

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: arne@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.lang.php
Subject: Re: 2D array by POST
Date: Fri, 19 May 2023 21:42:16 -0400
Organization: A noiseless patient Spider
Lines: 50
Message-ID: <u498hr$r8u1$1@dont-email.me>
References: <1qaxqzf.194a8511hkkk6aN%liz@poppyrecords.invalid.invalid>
<kcn3tdFehn1U1@mid.individual.net> <u465s8$8kf$13@gallifrey.nk.ca>
<kcnkirFh5ehU1@mid.individual.net>
<1qayusl.14by37z1ufi932N%liz@poppyrecords.invalid.invalid>
<u4867n$nduf$1@jstuckle.eternal-september.org>
<kcptd9Fs4adU1@mid.individual.net>
<1qazulp.cmhlm71x8dryN%liz@poppyrecords.invalid.invalid>
<kcq9nvFtsk3U1@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 20 May 2023 01:42:20 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="89e6063ec70cb83fa138411a114675ec";
logging-data="893889"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19hguRmX00mRoJZYbqie2jg4lc3AmvUcB0="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:PzO6sc3uF5qw4UQ//JqX9pMOmkY=
In-Reply-To: <kcq9nvFtsk3U1@mid.individual.net>
Content-Language: en-US
 by: Arne Vajhøj - Sat, 20 May 2023 01:42 UTC

On 5/19/2023 5:58 PM, J.O. Aho wrote:
> On 5/19/23 21:38, Liz Tuddenham wrote:
>> J.O. Aho <user@example.net> wrote:
>> [...]
>>> Yeah, I tend to favor to take prices from the database each time, this
>>> more to keep the prices up to date, as then if someone changes a price
>>> on a product that price change will get trough at once on all orders
>>> that are not finalized.
>>
>> Unfortunately that could lead to an illegal situation in the UK.  The
>> price has to be the one the user agreed to at the instant of clicking
>> the button.  If the database has been updated between there and the
>> checkout, the original price must still be charged.  (An unlikely
>> scenario, but one with potentially very damaging consequences.)
>
> Sure you shouldn't change price when the end customer agrees on the cost
> and is sent to the payment page, at this point you can't change the
> price, but until the customer can at any point decide that the updated
> price isn't what they are prepared to pay for the product and remove it
> from the cart. Of course it's a good thing to notify if the price would
> change, one site that does this is amazon.co.uk.

Different business rules require different supporting functionality:

use current price => nothing special needed

use price customer saw => get that and verify that it is correct (not
tampered with)

remove item and inform user => need to detect situation

>> The agreed-to price is carried through the transaction by a cookie, the
>> small risk of tampering (and the low value of the goods) make this an
>> acceptable risk.
>
> I would fire anyone in my team if they would say it's an acceptable
> risk, values of a product, no matter if it's small and insignificant,
> shouldn't ever be end user adjustable and when it comes out that you can
> adjust the price, then people will start doing that and it's kind of a
> simple thing to do nowadays with all the browser extensions.

Yes.

If the rumor spread on the internet that there is a web site selling
anything where customers can hack the price and get it for that price,
then I suspect they will get tens of thousands of new "customers"
very quickly.

Arne

Re: 2D array by POST

<u49gac$vinj$1@jstuckle.eternal-september.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=870&group=comp.lang.php#870

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!jstuckle.eternal-september.org!.POSTED!not-for-mail
From: stuckle.jerry@gmail.com (Jerry Stuckle)
Newsgroups: comp.lang.php
Subject: Re: 2D array by POST
Date: Fri, 19 May 2023 23:54:30 -0400
Organization: A noiseless patient Spider
Lines: 77
Message-ID: <u49gac$vinj$1@jstuckle.eternal-september.org>
References: <1qaxqzf.194a8511hkkk6aN%liz@poppyrecords.invalid.invalid>
<kcn3tdFehn1U1@mid.individual.net> <u465s8$8kf$13@gallifrey.nk.ca>
<kcnkirFh5ehU1@mid.individual.net>
<1qayusl.14by37z1ufi932N%liz@poppyrecords.invalid.invalid>
<u4867n$nduf$1@jstuckle.eternal-september.org>
<kcptd9Fs4adU1@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 20 May 2023 03:54:52 -0000 (UTC)
Injection-Info: jstuckle.eternal-september.org; posting-host="2cbe99c419ac577b396c257d2bc85c3d";
logging-data="1034995"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+5FH3rciMtgw5DIkwhqzijvqC7s019SEo="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.10.1
Cancel-Lock: sha1:9xeNZ/qTI+k/o0S/Mv6lUxsEE5c=
Content-Language: en-US
In-Reply-To: <kcptd9Fs4adU1@mid.individual.net>
 by: Jerry Stuckle - Sat, 20 May 2023 03:54 UTC

On 5/19/2023 2:27 PM, J.O. Aho wrote:
> On 5/19/23 17:56, Jerry Stuckle wrote:
>> On 5/19/2023 2:19 AM, Liz Tuddenham wrote:
>>> J.O. Aho <user@example.net> wrote:
>>>
>>>> On 5/18/23 23:38, The Doctor wrote:
>>>>> In article <kcn3tdFehn1U1@mid.individual.net>,
>>>>> J.O. Aho <user@example.net> wrote:
>>>>>> On 5/18/23 18:04, Liz Tuddenham wrote:
>>>>>>> I need to send a 2-dimensional array from one file to another by
>>>>>>> POST.
>>>>>>> The array is $item[][] with contents that are entirelyintegers.
>>>>>>>
>>>>>>> I have tried :
>>>>>>>     Print "<INPUT TYPE=hidden NAME=item[] VALUE=$item>";
>>>>>>> with
>>>>>>> $item = stripslashes($_POST['item']);
>>>>>>> but it does not work.
>>>>>>>
>>>>>>>     Any suggestions?
>>>>>>
>>>>>> 1. use session, store the value in the session and then use it in the
>>>>>> next page directly from the session.
>>>>>>
>>>>>> 2. serialize the variable and base64 encode the serialized data, post
>>>>>> this in the form and then base64 decode and unserialize.
>>>>>>
>>>>>
>>>>> Is base64 strong enugh?
>>>>
>>>> It's not about the encryption, it's about not making the html to break
>>>> as you don't know what the serialized data may contain.
>>>>
>>>> if the data is sensitive or you want to avoid user manipulation of the
>>>> data, then store the data in session and that is way it was number 1 of
>>>> the suggestions.
>>>
>>> The data isn't particularly sensitive, it is just a 'shopping list'
>>> passed from one part of a shopping program to another.  It could have
>>> been sent as dozens of individual variables, but that seemed clumsy as
>>> they were already nicely wrapped up in an array.
>>>
>>>
>>
>> J.O. has the right idea.  The way to do this is to store the data in
>> the $_SESSION variable to pass it on to the next page.
>
> You have the thread "Replace punctuation in an associative array" where
> you can see an example on how it could be possible to work with the
> session, I do not claim it's the best solution, but based on the
> "requirements", it's a good solution for a half hour work.
>
>
>> This is especially true if it has things like prices - which the user
>> can change if you give them access to it via a web page.
>
> Yeah, I tend to favor to take prices from the database each time, this
> more to keep the prices up to date, as then if someone changes a price
> on a product that price change will get trough at once on all orders
> that are not finalized.
>

I don't like taking prices from the database each time. If the price
goes up, people will complain about "bait and switch". I get them from
the database once and store them in the session. That way if the price
changes they still have the old price.

Of course I also keep a fairly short session timeout (a few hours at
most) so if they come back six months later they don't get an old price.

--
==================
Remove the "x"'s from my email address
Jerry Stuckle
stucklex.jerryx@gmail.com
==================

Re: 2D array by POST

<u49gbi$vinj$2@jstuckle.eternal-september.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=871&group=comp.lang.php#871

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!jstuckle.eternal-september.org!.POSTED!not-for-mail
From: stuckle.jerry@gmail.com (Jerry Stuckle)
Newsgroups: comp.lang.php
Subject: Re: 2D array by POST
Date: Fri, 19 May 2023 23:55:09 -0400
Organization: A noiseless patient Spider
Lines: 78
Message-ID: <u49gbi$vinj$2@jstuckle.eternal-september.org>
References: <1qaxqzf.194a8511hkkk6aN%liz@poppyrecords.invalid.invalid>
<kcn3tdFehn1U1@mid.individual.net> <u465s8$8kf$13@gallifrey.nk.ca>
<kcnkirFh5ehU1@mid.individual.net>
<1qayusl.14by37z1ufi932N%liz@poppyrecords.invalid.invalid>
<u4867n$nduf$1@jstuckle.eternal-september.org>
<kcptd9Fs4adU1@mid.individual.net> <kcptglFs4adU2@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 20 May 2023 03:55:30 -0000 (UTC)
Injection-Info: jstuckle.eternal-september.org; posting-host="2cbe99c419ac577b396c257d2bc85c3d";
logging-data="1034995"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+SPBS0w8eHsgI4nNNzGXuN0Tqk2hlFdBc="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.10.1
Cancel-Lock: sha1:Rn5o31BEMxRlOvE56vuG3YodnGo=
In-Reply-To: <kcptglFs4adU2@mid.individual.net>
Content-Language: en-US
 by: Jerry Stuckle - Sat, 20 May 2023 03:55 UTC

On 5/19/2023 2:29 PM, J.O. Aho wrote:
> On 5/19/23 20:27, J.O. Aho wrote:
>> On 5/19/23 17:56, Jerry Stuckle wrote:
>>> On 5/19/2023 2:19 AM, Liz Tuddenham wrote:
>>>> J.O. Aho <user@example.net> wrote:
>>>>
>>>>> On 5/18/23 23:38, The Doctor wrote:
>>>>>> In article <kcn3tdFehn1U1@mid.individual.net>,
>>>>>> J.O. Aho <user@example.net> wrote:
>>>>>>> On 5/18/23 18:04, Liz Tuddenham wrote:
>>>>>>>> I need to send a 2-dimensional array from one file to another by
>>>>>>>> POST.
>>>>>>>> The array is $item[][] with contents that are entirelyintegers.
>>>>>>>>
>>>>>>>> I have tried :
>>>>>>>>     Print "<INPUT TYPE=hidden NAME=item[] VALUE=$item>";
>>>>>>>> with
>>>>>>>> $item = stripslashes($_POST['item']);
>>>>>>>> but it does not work.
>>>>>>>>
>>>>>>>>     Any suggestions?
>>>>>>>
>>>>>>> 1. use session, store the value in the session and then use it in
>>>>>>> the
>>>>>>> next page directly from the session.
>>>>>>>
>>>>>>> 2. serialize the variable and base64 encode the serialized data,
>>>>>>> post
>>>>>>> this in the form and then base64 decode and unserialize.
>>>>>>>
>>>>>>
>>>>>> Is base64 strong enugh?
>>>>>
>>>>> It's not about the encryption, it's about not making the html to break
>>>>> as you don't know what the serialized data may contain.
>>>>>
>>>>> if the data is sensitive or you want to avoid user manipulation of the
>>>>> data, then store the data in session and that is way it was number
>>>>> 1 of
>>>>> the suggestions.
>>>>
>>>> The data isn't particularly sensitive, it is just a 'shopping list'
>>>> passed from one part of a shopping program to another.  It could have
>>>> been sent as dozens of individual variables, but that seemed clumsy as
>>>> they were already nicely wrapped up in an array.
>>>>
>>>>
>>>
>>> J.O. has the right idea.  The way to do this is to store the data in
>>> the $_SESSION variable to pass it on to the next page.
>>
>> You have the thread "Replace punctuation in an associative array"
>> where you can see an example on how it could be possible to work with
>> the session, I do not claim it's the best solution, but based on the
>> "requirements", it's a good solution for a half hour work.
>>
>>
>>> This is especially true if it has things like prices - which the user
>>> can change if you give them access to it via a web page.
>>
>> Yeah, I tend to favor to take prices from the database each time, this
>> more to keep the prices up to date, as then if someone changes a price
>> on a product that price change will get trough at once on all orders
>> that are not finalized.
>
> Sorry, thought I replied to Liz, the two section I write was more
> intended for her than replaying to you.
>

No problem. I knew what you meant :)

--
==================
Remove the "x"'s from my email address
Jerry Stuckle
stucklex.jerryx@gmail.com
==================

Re: 2D array by POST

<u49h0b$vinj$3@jstuckle.eternal-september.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=872&group=comp.lang.php#872

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!jstuckle.eternal-september.org!.POSTED!not-for-mail
From: stuckle.jerry@gmail.com (Jerry Stuckle)
Newsgroups: comp.lang.php
Subject: Re: 2D array by POST
Date: Sat, 20 May 2023 00:06:13 -0400
Organization: A noiseless patient Spider
Lines: 71
Message-ID: <u49h0b$vinj$3@jstuckle.eternal-september.org>
References: <1qaxqzf.194a8511hkkk6aN%liz@poppyrecords.invalid.invalid>
<kcn3tdFehn1U1@mid.individual.net> <u465s8$8kf$13@gallifrey.nk.ca>
<kcnkirFh5ehU1@mid.individual.net> <u497rp$r6t8$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 20 May 2023 04:06:35 -0000 (UTC)
Injection-Info: jstuckle.eternal-september.org; posting-host="2cbe99c419ac577b396c257d2bc85c3d";
logging-data="1034995"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19lK5cznW1sqHHF+HwA1Pydu0zu6pd7lzc="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.10.1
Cancel-Lock: sha1:IxjHr+WDb9CKWf1RrzKZcPtRE4I=
In-Reply-To: <u497rp$r6t8$1@dont-email.me>
Content-Language: en-US
 by: Jerry Stuckle - Sat, 20 May 2023 04:06 UTC

On 5/19/2023 9:30 PM, Arne Vajhøj wrote:
> On 5/18/2023 5:44 PM, J.O. Aho wrote:
>> On 5/18/23 23:38, The Doctor wrote:
>>> In article <kcn3tdFehn1U1@mid.individual.net>,
>>> J.O. Aho <user@example.net> wrote:
>>>> On 5/18/23 18:04, Liz Tuddenham wrote:
>>>>> I need to send a 2-dimensional array from one file to another by POST.
>>>>> The array is $item[][] with contents that are entirelyintegers.
>>>>>
>>>>> I have tried :
>>>>>    Print "<INPUT TYPE=hidden NAME=item[] VALUE=$item>";
>>>>> with
>>>>> $item = stripslashes($_POST['item']);
>>>>> but it does not work.
>>>>>
>>>>>    Any suggestions?
>>>>
>>>> 1. use session, store the value in the session and then use it in the
>>>> next page directly from the session.
>>>>
>>>> 2. serialize the variable and base64 encode the serialized data, post
>>>> this in the form and then base64 decode and unserialize.
>>>>
>>>
>>> Is base64 strong enugh?
>>
>> It's not about the encryption, it's about not making the html to break
>> as you don't know what the serialized data may contain.
>>
>> if the data is sensitive or you want to avoid user manipulation of the
>> data, then store the data in session and that is way it was number 1
>> of the suggestions.
>
> The concept of "page scope" or "view state" is well
> known in some other technologies (like ASP.NET and JSF).
> That may end up as a HTML hidden field like this.
>
> In such cases it should always be secured cryptographic
> (MAC etc.). Frameworks that supports page scope / view state
> via hidden field usually have this enabled by default.
>
> Given that this is not supported out of the box in PHP
> (I have no idea whether any of the well known PHP MVC
> frameworks offer such support), then it is not an
> easy solution to implement.
>
> So using session absolutely looks like the path of least
> resistance.
>
> But people should be aware that switching from page
> scope to session scope is only transparent in 99.9% or
> so of cases. There are (rare) cases where it will impact
> functionality.
>
> Arne
>
>
>
>
>

If the data is sensitive, such as prices, it shouldn't even be sent to
the user, encrypted or not. That's what the $_SESSION variable is for.

--
==================
Remove the "x"'s from my email address
Jerry Stuckle
stucklex.jerryx@gmail.com
==================

Re: 2D array by POST

<1qb0u3y.npw7981ldp2i4N%liz@poppyrecords.invalid.invalid>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=873&group=comp.lang.php#873

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: liz@poppyrecords.invalid.invalid (Liz Tuddenham)
Newsgroups: comp.lang.php
Subject: Re: 2D array by POST
Date: Sat, 20 May 2023 08:56:34 +0100
Organization: Poppy Records
Lines: 57
Message-ID: <1qb0u3y.npw7981ldp2i4N%liz@poppyrecords.invalid.invalid>
References: <1qaxqzf.194a8511hkkk6aN%liz@poppyrecords.invalid.invalid> <kcn3tdFehn1U1@mid.individual.net> <u465s8$8kf$13@gallifrey.nk.ca> <kcnkirFh5ehU1@mid.individual.net> <1qayusl.14by37z1ufi932N%liz@poppyrecords.invalid.invalid> <u4867n$nduf$1@jstuckle.eternal-september.org> <kcptd9Fs4adU1@mid.individual.net> <1qazulp.cmhlm71x8dryN%liz@poppyrecords.invalid.invalid> <kcq9nvFtsk3U1@mid.individual.net> <u498hr$r8u1$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: individual.net xKvVbIFz2/1Wz5nJ+hCntgfnQXywjedokPUR6DEf0y3WadctUY
X-Orig-Path: liz
Cancel-Lock: sha1:MMedoF075W/A8pHMEMRbAFopdt0=
User-Agent: MacSOUP/2.4.6
 by: Liz Tuddenham - Sat, 20 May 2023 07:56 UTC

=?UTF-8?Q?Arne_Vajh=c3=b8j?= <arne@vajhoej.dk> wrote:

> On 5/19/2023 5:58 PM, J.O. Aho wrote:
> > On 5/19/23 21:38, Liz Tuddenham wrote:
> >> J.O. Aho <user@example.net> wrote:
> >> [...]
> >>> Yeah, I tend to favor to take prices from the database each time, this
> >>> more to keep the prices up to date, as then if someone changes a price
> >>> on a product that price change will get trough at once on all orders
> >>> that are not finalized.
> >>
> >> Unfortunately that could lead to an illegal situation in the UK.  The
> >> price has to be the one the user agreed to at the instant of clicking
> >> the button.  If the database has been updated between there and the
> >> checkout, the original price must still be charged.  (An unlikely
> >> scenario, but one with potentially very damaging consequences.)
> >
> > Sure you shouldn't change price when the end customer agrees on the cost
> > and is sent to the payment page, at this point you can't change the
> > price, but until the customer can at any point decide that the updated
> > price isn't what they are prepared to pay for the product and remove it
> > from the cart. Of course it's a good thing to notify if the price would
> > change, one site that does this is amazon.co.uk.
>
> Different business rules require different supporting functionality:
>
> use current price => nothing special needed
>
> use price customer saw => get that and verify that it is correct (not
> tampered with)
>
> remove item and inform user => need to detect situation
>
> >> The agreed-to price is carried through the transaction by a cookie, the
> >> small risk of tampering (and the low value of the goods) make this an
> >> acceptable risk.
> >
> > I would fire anyone in my team if they would say it's an acceptable
> > risk, values of a product, no matter if it's small and insignificant,
> > shouldn't ever be end user adjustable and when it comes out that you can
> > adjust the price, then people will start doing that and it's kind of a
> > simple thing to do nowadays with all the browser extensions.
>
> Yes.
>
> If the rumor spread on the internet that there is a web site selling
> anything where customers can hack the price and get it for that price,
> then I suspect they will get tens of thousands of new "customers"
> very quickly.

We might notice, our sales are less than £150 per year.

--
~ Liz Tuddenham ~
(Remove the ".invalid"s and add ".co.uk" to reply)
www.poppyrecords.co.uk

Re: 2D array by POST

<1t64688896i259d0en3e8%sfroehli@Froehlich.Priv.at>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=874&group=comp.lang.php#874

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: Stefan+Usenet@Froehlich.Priv.at (Stefan Froehlich)
Newsgroups: comp.lang.php
Subject: Re: 2D array by POST
Date: 20 May 2023 08:53:34 GMT
Lines: 39
Message-ID: <1t64688896i259d0en3e8%sfroehli@Froehlich.Priv.at>
References: <1qaxqzf.194a8511hkkk6aN%liz@poppyrecords.invalid.invalid> <kcn3tdFehn1U1@mid.individual.net> <u465s8$8kf$13@gallifrey.nk.ca> <kcnkirFh5ehU1@mid.individual.net> <1qayusl.14by37z1ufi932N%liz@poppyrecords.invalid.invalid> <u4867n$nduf$1@jstuckle.eternal-september.org> <kcptd9Fs4adU1@mid.individual.net> <1qazulp.cmhlm71x8dryN%liz@poppyrecords.invalid.invalid> <kcq9nvFtsk3U1@mid.individual.net> <u498hr$r8u1$1@dont-email.me> <1qb0u3y.npw7981ldp2i4N%liz@poppyrecords.invalid.invalid>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net U5jRn/vgYsEXHVNM83suiQFPz6oY394R4TZA6W3oCe/hrmdKA=
X-Orig-Path: not-for-mail
Cancel-Lock: sha1:8SH/S+5zvYUltZiyG3rqNg9mgeE=
X-Blattlinie: dieser Artikel repraesentiert meine persoenliche Meinung
X-Medieninhaber: Stefan Froehlich
X-Verleger: Stefan Froehlich
X-Verlagsort: Wien
User-Agent: tin/2.4.5-20201224 ("Glen Albyn") (Linux/5.10.0-13-amd64 (x86_64))
 by: Stefan Froehlich - Sat, 20 May 2023 08:53 UTC

On Sat, 20 May 2023 09:56:34 Liz Tuddenham wrote:
> =?UTF-8?Q?Arne_Vajh=c3=b8j?= <arne@vajhoej.dk> wrote:
>> On 5/19/2023 5:58 PM, J.O. Aho wrote:
>> > On 5/19/23 21:38, Liz Tuddenham wrote:
>> >> The agreed-to price is carried through the transaction by a
>> >> cookie, the small risk of tampering (and the low value of the
>> >> goods) make this an acceptable risk.

>> > I would fire anyone in my team if they would say it's an
>> > acceptable risk, values of a product, no matter if it's small
>> > and insignificant, shouldn't ever be end user adjustable and
>> > when it comes out that you can adjust the price, then people
>> > will start doing that and it's kind of a simple thing to do
>> > nowadays with all the browser extensions.

>> Yes.
>
>> If the rumor spread on the internet that there is a web site
>> selling anything where customers can hack the price and get it
>> for that price, then I suspect they will get tens of thousands of
>> new "customers" very quickly.

> We might notice, our sales are less than £150 per year.

While I agree that - given these circumstances - there is most
likely no commercial risk at all, it is still bad practice to do so
and (most important in your case) is not even easier in your case,
so I can see no advantages but potential problems, even if they are
highly unlikely.

Bye,
Stefan

--
http://kontaktinser.at/ - die kostenlose Kontaktboerse fuer Oesterreich
Offizieller Erstbesucher(TM) von mmeike

Stefan. Pummelig und ölig!
(Sloganizer)

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor