Issue with $HTTP_POST_VARS Not getting Variables
Issue with $HTTP_POST_VARS Not getting Variables
am 11.12.2009 21:37:49 von Eric Lommatsch
------_=_NextPart_001_01CA7AA1.CEC83EBB
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hello,
=20
I am working with a login page to use with an application that we are
planning to make available as a web service. The login.php page itself =
works
correctly, however when I try and pass parameters to the login page the =
are
not being recognized by the login.php page.=20
=20
Here is the basic code that I am dealing with to attempt to the the
variables:
=20
$username =3D $HTTP_POST_VARS['username'];
$password =3D $HTTP_POST_VARS['password'];
$username =3D $_POST['username'];
$password =3D $_POST['password'];
echo $username;
?>
When I enter the url
http://localost/index.php?username=3Djasperadmin&password=3D ******
Where localhost is the ip address of my server and ****** is the =
password of
the user that is logging in, I am not having the username questioned and =
the
login.php isacting as if I have not entered any parameters.=20
Why are the parameters not being accepted?
I am using php version 5.2.6 on a ubuntu linux box
=20
Thank you
=20
Eric H. Lommatsch
Programmer
360 Business=20
=20
------_=_NextPart_001_01CA7AA1.CEC83EBB--
Re: Issue with $HTTP_POST_VARS Not getting Variables
am 11.12.2009 21:39:08 von Ashley Sheridan
--=-VkhbOuYYSnYB8+Ehdj+/
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Fri, 2009-12-11 at 13:37 -0700, Eric Lommatsch wrote:
> Hello,
>
> I am working with a login page to use with an application that we are
> planning to make available as a web service. The login.php page itself works
> correctly, however when I try and pass parameters to the login page the are
> not being recognized by the login.php page.
>
> Here is the basic code that I am dealing with to attempt to the the
> variables:
>
>
>
> $username = $HTTP_POST_VARS['username'];
>
> $password = $HTTP_POST_VARS['password'];
>
> $username = $_POST['username'];
>
> $password = $_POST['password'];
>
> echo $username;
>
> ?>
>
> When I enter the url
> http://localost/index.php?username=jasperadmin&password=**** **
>
> Where localhost is the ip address of my server and ****** is the password of
> the user that is logging in, I am not having the username questioned and the
> login.php isacting as if I have not entered any parameters.
>
> Why are the parameters not being accepted?
>
> I am using php version 5.2.6 on a ubuntu linux box
>
>
> Thank you
>
> Eric H. Lommatsch
> Programmer
> 360 Business
>
First off, take out those HTTP_POST_VARS lines. That's an outdated way
of accessing post variables, and is made useless by the next two lines
that follow it.
Second, the two lines you are using at the end there are for post data,
but you clearly use get data in the URL! If you have to accept the
username and password from both get and post, change the lines to use
$_REQUEST instead of $_POST.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--=-VkhbOuYYSnYB8+Ehdj+/--
RE: Issue with $HTTP_POST_VARS Not getting Variables
am 11.12.2009 21:52:03 von Eric Lommatsch
------_=_NextPart_001_01CA7AA3.CB6D44FB
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Doh, I should have thought of that!
=20
Thanks, that is what happens when you use code that someone else has =
writen
and included with a software package. At least I assumed that the code =
was
already written correctly to accept parameters. I guess it wasn't.
=20
Thank you
=20
Eric H. Lommatsch
Programmer
360 Business=20
=20
=20
________________________________
From: Ashley Sheridan [mailto:ash@ashleysheridan.co.uk]=20
Sent: Friday, December 11, 2009 1:39 PM
To: Eric Lommatsch
Cc: php-general@lists.php.net
Subject: Re: [PHP] Issue with $HTTP_POST_VARS Not getting Variables
On Fri, 2009-12-11 at 13:37 -0700, Eric Lommatsch wrote:=20
Hello,
=20
I am working with a login page to use with an application that we are
planning to make available as a web service. The login.php page
itself works
correctly, however when I try and pass parameters to the login page
the are
not being recognized by the login.php page.=20
=20
Here is the basic code that I am dealing with to attempt to the the
variables:
=20
=09
$username =3D $HTTP_POST_VARS['username'];
=09
$password =3D $HTTP_POST_VARS['password'];
=09
$username =3D $_POST['username'];
=09
$password =3D $_POST['password'];
=09
echo $username;
=09
?>
=09
When I enter the url
http://localost/index.php?username=3Djasperadmin&password=3D ******
=09
Where localhost is the ip address of my server and ****** is the
password of
the user that is logging in, I am not having the username questioned
and the
login.php isacting as if I have not entered any parameters.=20
=09
Why are the parameters not being accepted?
=09
I am using php version 5.2.6 on a ubuntu linux box
=09
=20
Thank you
=20
Eric H. Lommatsch
Programmer
360 Business=20
=20
First off, take out those HTTP_POST_VARS lines. That's an outdated way =
of
accessing post variables, and is made useless by the next two lines that
follow it.
Second, the two lines you are using at the end there are for post data, =
but
you clearly use get data in the URL! If you have to accept the username =
and
password from both get and post, change the lines to use $_REQUEST =
instead of
$_POST.
Thanks,
Ash
http://www.ashleysheridan.co.uk
=09
------_=_NextPart_001_01CA7AA3.CB6D44FB--
Re: Issue with $HTTP_POST_VARS Not getting Variables
am 11.12.2009 21:54:20 von Roberto Aloi
Because you're passing the args through the Url (GET), not through a
POST request.
Roberto Aloi
On 11 Dec 2009, at 20:37, "Eric Lommatsch" wrote:
> Hello,
>
> I am working with a login page to use with an application that we are
> planning to make available as a web service. The login.php page
> itself works
> correctly, however when I try and pass parameters to the login page
> the are
> not being recognized by the login.php page.
>
> Here is the basic code that I am dealing with to attempt to the the
> variables:
>
>
>
> $username = $HTTP_POST_VARS['username'];
>
> $password = $HTTP_POST_VARS['password'];
>
> $username = $_POST['username'];
>
> $password = $_POST['password'];
>
> echo $username;
>
> ?>
>
> When I enter the url
> http://localost/index.php?username=jasperadmin&password=**** **
>
> Where localhost is the ip address of my server and ****** is the
> password of
> the user that is logging in, I am not having the username questioned
> and the
> login.php isacting as if I have not entered any parameters.
>
> Why are the parameters not being accepted?
>
> I am using php version 5.2.6 on a ubuntu linux box
>
>
> Thank you
>
> Eric H. Lommatsch
> Programmer
> 360 Business
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php