Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

I THINK MAN INVENTED THE CAR by instinct. -- Jack Handey, The New Mexican, 1988.


devel / comp.lang.php / Re: How to validate $_POST array

SubjectAuthor
* How to validate $_POST arrayJakub
+* Re: How to validate $_POST arrayLew Pitcher
|`- Re: How to validate $_POST arrayLew Pitcher
+- Re: How to validate $_POST arrayArno Welzel
`- Re: How to validate $_POST arrayHe, who travels time to time

1
How to validate $_POST array

<62f4cfff$0$568$65785112@news.neostrada.pl>

  copy mid

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

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!news-out.netnews.com!news.alt.net!fdc2.netnews.com!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!newsfeed.neostrada.pl!unt-exc-01.news.neostrada.pl!unt-spo-a-02.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail
Date: Thu, 11 Aug 2022 11:47:02 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.12.0
Newsgroups: comp.lang.php
Content-Language: pl
From: jak74@interia.pl (Jakub)
Subject: How to validate $_POST array
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 7
Message-ID: <62f4cfff$0$568$65785112@news.neostrada.pl>
Organization: Telekomunikacja Polska
NNTP-Posting-Host: 37.47.236.234
X-Trace: 1660211199 unt-rea-b-01.news.neostrada.pl 568 37.47.236.234:12505
X-Complaints-To: abuse@news.neostrada.pl
X-Received-Bytes: 973
 by: Jakub - Thu, 11 Aug 2022 09:47 UTC

I have this code

if ( isset($_POST) ) {

}

how to do filter_has_var function to check if $_POST exist and have value?

Re: How to validate $_POST array

<td34it$26lbt$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: lew.pitcher@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.lang.php
Subject: Re: How to validate $_POST array
Date: Thu, 11 Aug 2022 14:43:41 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 43
Message-ID: <td34it$26lbt$1@dont-email.me>
References: <62f4cfff$0$568$65785112@news.neostrada.pl>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 11 Aug 2022 14:43:41 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="0596a6f529f64df0eeb5004b35e36373";
logging-data="2315645"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+R0BArKnjQX6LGSMH8G4ZltN30waqptc4="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:f7nPWJKJT3dpZsibdQAGN2lI7pg=
 by: Lew Pitcher - Thu, 11 Aug 2022 14:43 UTC

On Thu, 11 Aug 2022 11:47:02 +0200, Jakub wrote:

> I have this code
>
> if ( isset($_POST) ) {
>
> }
>
> how to do filter_has_var function to check if $_POST exist and have value?

If the originating web page has issues a POST, then
$_SERVER['REQUEST_METHOD'] will equal 'POST'

Your php code can only extract from the POST values that were set by
the web page when it issued the POST. It can't demand a specific value,
but it can establish whether or not the page supplied a specific value.

Say, for instance, you expect that the page will supply a text string
in a variable called 'TextString', you can check to see if
$_POST['TextString'] is set, and validate it's contents.

So, your php logic might look like

if ($_SERVER['REQUEST_METHOD'] == "POST")
{
if (isset($_POST['TextString']))
{
/* validate the contents of $_POST['TextString'] */
}
else
{
/* page didn't supply 'TextString'. Handle this situation */
}
}
else
{
/* page didn't POST. Handle the situation. */
}

HTH
--
Lew Pitcher
"In Skills, We Trust"

Re: How to validate $_POST array

<td34ss$26lbt$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: lew.pitcher@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.lang.php
Subject: Re: How to validate $_POST array
Date: Thu, 11 Aug 2022 14:49:00 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 66
Message-ID: <td34ss$26lbt$2@dont-email.me>
References: <62f4cfff$0$568$65785112@news.neostrada.pl>
<td34it$26lbt$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 11 Aug 2022 14:49:00 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="0596a6f529f64df0eeb5004b35e36373";
logging-data="2315645"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/pWR/qUGEbEHmzGJmIogjvdYx05s3HERE="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:KvsaRZ/O9vJ+7KB2k4lR/rqd6I0=
 by: Lew Pitcher - Thu, 11 Aug 2022 14:49 UTC

On Thu, 11 Aug 2022 14:43:41 +0000, Lew Pitcher wrote:

> On Thu, 11 Aug 2022 11:47:02 +0200, Jakub wrote:
>
>> I have this code
>>
>> if ( isset($_POST) ) {
>>
>> }
>>
>> how to do filter_has_var function to check if $_POST exist and have value?
>
> If the originating web page has issues a POST, then
> $_SERVER['REQUEST_METHOD'] will equal 'POST'
>
> Your php code can only extract from the POST values that were set by
> the web page when it issued the POST. It can't demand a specific value,
> but it can establish whether or not the page supplied a specific value.
>
> Say, for instance, you expect that the page will supply a text string
> in a variable called 'TextString', you can check to see if
> $_POST['TextString'] is set, and validate it's contents.
>
> So, your php logic might look like
>
> if ($_SERVER['REQUEST_METHOD'] == "POST")
> {
> if (isset($_POST['TextString']))
> {
> /* validate the contents of $_POST['TextString'] */
> }
> else
> {
> /* page didn't supply 'TextString'. Handle this situation */
> }
> }
> else
> {
> /* page didn't POST. Handle the situation. */
> }

Note that $_POST is an array, so you /can/ iterate across the values in it

if ($_SERVER['REQUEST_METHOD'] == "POST")
{
foreach ($_POST as $pKEY => $pVALU)
{
/*
** $pKEY is the subscript to $_POST,
** $pVALU is the value carried by $_POST[$pKEY]
** use $pKEY to choose your $pVALU validation criteria
*/
}
}
else
{
/* page didn't POST. Handle the situation. */
}

--
Lew Pitcher
"In Skills, We Trust"

Re: How to validate $_POST array

<jlkmchFd0r6U1@mid.individual.net>

  copy mid

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

  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: usenet@arnowelzel.de (Arno Welzel)
Newsgroups: comp.lang.php
Subject: Re: How to validate $_POST array
Date: Thu, 11 Aug 2022 17:43:14 +0200
Lines: 17
Message-ID: <jlkmchFd0r6U1@mid.individual.net>
References: <62f4cfff$0$568$65785112@news.neostrada.pl>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Trace: individual.net /JV0bXiPcT8wXtRJKWgolATHrBC19vkcYnUB6W8RywbFr5Vtu5
Cancel-Lock: sha1:VfQzuzmzr6dIq05mU14+EyRTAUU=
Content-Language: de-DE
In-Reply-To: <62f4cfff$0$568$65785112@news.neostrada.pl>
 by: Arno Welzel - Thu, 11 Aug 2022 15:43 UTC

Jakub, 2022-08-11 11:47:

> I have this code
>
> if ( isset($_POST) ) {
>
> }
>
> how to do filter_has_var function to check if $_POST exist and have value?

See <https://www.php.net/manual/en/function.filter-has-var.php>.

--
Arno Welzel
https://arnowelzel.de

Re: How to validate $_POST array

<2b1cf8f4-6714-4914-8830-773047de4dc3n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.php
X-Received: by 2002:a05:620a:1a18:b0:6ce:6fa8:fba0 with SMTP id bk24-20020a05620a1a1800b006ce6fa8fba0mr2261825qkb.292.1663855980399;
Thu, 22 Sep 2022 07:13:00 -0700 (PDT)
X-Received: by 2002:a25:ef4f:0:b0:6ae:f5ce:91e8 with SMTP id
w15-20020a25ef4f000000b006aef5ce91e8mr4048770ybm.280.1663855979779; Thu, 22
Sep 2022 07:12:59 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.php
Date: Thu, 22 Sep 2022 07:12:59 -0700 (PDT)
In-Reply-To: <62f4cfff$0$568$65785112@news.neostrada.pl>
Injection-Info: google-groups.googlegroups.com; posting-host=82.131.36.130; posting-account=gin_zAoAAAAxFoHHJeGbYqdKpQ_tFzq7
NNTP-Posting-Host: 82.131.36.130
References: <62f4cfff$0$568$65785112@news.neostrada.pl>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2b1cf8f4-6714-4914-8830-773047de4dc3n@googlegroups.com>
Subject: Re: How to validate $_POST array
From: he1983912@aol.com (He, who travels time to time)
Injection-Date: Thu, 22 Sep 2022 14:13:00 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1465
 by: He, who travels time - Thu, 22 Sep 2022 14:12 UTC

Hey... Want to talk? Call me.... My telephone number >>>>

(+372) 56330687

Jakub kirjutas Neljapäev, 11. august 2022 kl 12:46:47 UTC+3:
> I have this code
>
> if ( isset($_POST) ) {
>
> }
>
> how to do filter_has_var function to check if $_POST exist and have value?

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor