Home > Archive > PHP Language > December 2005 > Code doesn't work after upgrading PHP
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Code doesn't work after upgrading PHP
|
|
| Lennart Zuur 2005-12-16, 7:55 am |
| Somebody help me please!
Recently I upgraded PHP from a 3.x version to PHP 4.1
as I need PHP 4.1 for certain fuctions.
However some code is no longer working, that DID work in the previous PHP
version.
(no code changed)
It's a very simple code. one page with a form, and the other one
interpreting the form data.
Below is the problem, with only the code involved.
================= page 01 (index.php) ===============
//here's the form tag:
<form action="do_login.php" method="post" name="login" id="login">
//The some form elements.
//And the submit button:
<input name="login" type="submit" id="login" value="login">
</form>
================= page 01 (index.php) ===============
================= page 02 do_login.php=============
// Second page checks wether sumbit button has been used
if($login) {
//Do some login check against database
}
else
{
// Call redirect function
ac_redirect("index.php?error=Direct request, aborting.");
}
================= page 02 do_login.php=============
When page 1 form is submitted, the $login variable is always empty
and the redirect function is executed.
Also, the function for redirecting contains a querystring, and this error
was interpreted by index.php. This also doesn't work anymore.
So it looks like variables don't travel from one page to another?
Could this be the PHP config?
any help would be highly appriciated.
best regards,
- Lennart.
| |
| Philip Ronan 2005-12-16, 7:55 am |
| "Lennart Zuur" wrote:
> Somebody help me please!
> Recently I upgraded PHP from a 3.x version to PHP 4.1
> as I need PHP 4.1 for certain fuctions.
>
> However some code is no longer working, that DID work in the previous PHP
> version.
(snip)
> if($login) {
>
> //Do some login check against database
Change that to if($_POST['login']) {
For more information visit http://php.net/register_globals
--
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan/
| |
| Kimmo Laine 2005-12-16, 7:55 am |
| "Lennart Zuur" <lennart@renderstream.nl> wrote in message
news:52301$43a29b70$3ea337f6$32175@news.chello.nl...
> Somebody help me please!
> Recently I upgraded PHP from a 3.x version to PHP 4.1
> as I need PHP 4.1 for certain fuctions.
Why not go all the way to php 5, it's the same trouble anyway, but you'll
get the latest version of it and you may just find some additional useful
functions in php 5 that don't exist in either php 3 or 4. Or at least php
4.4 which is the latest of the 4.x series. Come on, php 4.1 was first
released in 2001, don't you think it would be best to get the latest
edition? Bottom line is that it's your server and you install whatever
version you want, I'm just wondering why.
> So it looks like variables don't travel from one page to another?
> Could this be the PHP config?
Yes, it's a configuration issue. They changed the default value of
register_globals setting to 'off', so that the form parameters aren't
registered automatically as variables but you need to fetch them from the
$_GET and $_POST arrays to use them. To change the behaviour back to how it
was in php 3, edit the value of register_globals in php.ini, or better yet,
edit your code to use the $_GET and $_POST arrays instead (it's more secure
that way).
--
"En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirviö
antaatulla.sikanautaa@gmail.com.NOSPAM.invalid
| |
| Connector5 2005-12-16, 6:57 pm |
| My 4 cents:
register_globals is bad form. You should always manually bring globals into
the local scope. That way you have full control over any collisions that
occur.
"Lennart Zuur" <lennart@renderstream.nl> wrote in message
news:52301$43a29b70$3ea337f6$32175@news.chello.nl...
> Somebody help me please!
> Recently I upgraded PHP from a 3.x version to PHP 4.1
> as I need PHP 4.1 for certain fuctions.
>
> However some code is no longer working, that DID work in the previous PHP
> version.
> (no code changed)
>
> It's a very simple code. one page with a form, and the other one
> interpreting the form data.
> Below is the problem, with only the code involved.
>
> ================= page 01 (index.php) ===============
> //here's the form tag:
>
> <form action="do_login.php" method="post" name="login" id="login">
>
> //The some form elements.
>
> //And the submit button:
>
> <input name="login" type="submit" id="login" value="login">
> </form>
> ================= page 01 (index.php) ===============
>
> ================= page 02 do_login.php=============
> // Second page checks wether sumbit button has been used
>
> if($login) {
>
> //Do some login check against database
>
> }
> else
> {
> // Call redirect function
> ac_redirect("index.php?error=Direct request, aborting.");
> }
> ================= page 02 do_login.php=============
>
> When page 1 form is submitted, the $login variable is always empty
> and the redirect function is executed.
> Also, the function for redirecting contains a querystring, and this error
> was interpreted by index.php. This also doesn't work anymore.
> So it looks like variables don't travel from one page to another?
> Could this be the PHP config?
>
> any help would be highly appriciated.
>
> best regards,
>
> - Lennart.
>
>
>
>
>
>
>
|
|
|
|
|