Re: How to test
| From: | Bas Jobsen | Date: | Thu, 08 Aug 2002 10:46:42 +0000 |
| Subject: | Re: How to test | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-111627@lists.php.net to get a copy of this message | ||
> <form action="foo.php" method="post">
> <input type="text" name="foo">
> </form>
>
> <?
> //foo.php
> echo $_POST['foo'];
> ?>
Well, okay. But when foo.pho is on www.foo.com/foo.php
I can place the <form action="http://www.foo.com/foo.php"
method="post">
on every place i want. And i want to know for sure, that the form on
http://www.foo.com/form.php is used
Op donderdag 08 augustus 2002 12:25, schreef Justin French:
> If you're using PHP >= 4.1.1, pull the vars straight out of the POST super
> global array.
>
> <form action="foo.php" method="post">
> <input type="text" name="foo">
> </form>
>
> <?
> //foo.php
> echo $_POST['foo'];
> ?>
>
> There's also GET, COOKIE, SESSION, ENV, and a few more -- have a read here:
> http://www.php.net/manual/en/language.variables.predefined.php
>
> Justin French
>
> on 08/08/02 7:31 PM, Bas Jobsen (bas@startpunt.cc) wrote:
> > Hello,
> >
> > How can i test if a post request realy came from the right form?
> > Now i have:
> >
> > if(!strstr($HTTP_SERVER_VARS['HTTP_REFERER'],$HTTP_SERVER_VARS['SERVER_NA
> >ME'])
> >
> > || $HTTP_SERVER_VARS['REQUEST_METHOD']!='POST')exit;
> >
> > But this goes wrong soon as HTTP_REFERER isn't set.
> >
> > Thanks,
> >
> > Bas