Page 1 of 1

Swtiched webservers and passing variables by url doesnt wrk

Posted: Mon Mar 13, 2006 4:48 pm
by peternemser
Hi,

I just moved files to a new webserver. My site is controlled by passing variables on the URL. The php includes works - its just can't seem to read the variable from the url.

Can anyone point me in the right direction.

Regards,
Peter Freedman

Posted: Mon Mar 13, 2006 4:51 pm
by feyd
Run the following in a new file (on both servers) and tell us the results please.

Code: Select all

<?php

$ve = phpversion();
$os = PHP_OS;
$er = intval(error_reporting());
$rg = (in_array(strtolower(ini_get('register_globals')), array(0, false, '', null, 'off')) ? 'Off' : 'On');
$de = (in_array(strtolower(ini_get('display_errors')), array(0, false, '', null, 'off')) ? 'Off' : 'On');
$eol = (isset($_SERVER['HTTP_HOST']) ? "<br />\n" : "\n");

$ec = array(
'E_STRICT' => 2048,
'E_ALL' => 2047,
'E_USER_NOTICE' => 1024,
'E_USER_WARNING' => 512,
'E_USER_ERROR' => 256,
'E_COMPILE_WARNING' => 128,
'E_COMPILE_ERROR' => 64,
'E_CORE_WARNING' => 32,
'E_CORE_ERROR' => 16,
'E_NOTICE' => 8,
'E_PARSE' => 4,
'E_WARNING' => 2,
'E_ERROR' => 1,
);

$e = array();
$t = $er;
foreach ($ec as $n => $v)
{
if (($t & $v) == $v)
{
$e[] = $n;
$t ^= $v;
}
}
$er = $er . ' (' . implode(' | ', $e) . ')';

echo 'PHP Version: ' . $ve . $eol;
echo 'PHP OS: ' . $os . $eol;
echo 'Error Reporting: ' . $er . $eol;
echo 'Register Globals: ' . $rg . $eol;
echo 'Display Errors: ' . $de . $eol;

?>

Test Results

Posted: Mon Mar 13, 2006 7:56 pm
by peternemser
Thanks,

My running this script I get:

PHP Version: 4.3.9
PHP OS: Linux
Error Reporting: 2047 (E_ALL)
Register Globals: Off
Display Errors: Off

What does this mean?

I really appreciate any help.

-peter

Posted: Mon Mar 13, 2006 8:07 pm
by feyd
that's from both servers?

Posted: Mon Mar 13, 2006 8:16 pm
by peternemser
OLD SITE
-----------------------------------------------

PHP Version: 4.3.10
PHP OS: Linux
Error Reporting: 2047 (E_ALL)
Register Globals: On
Display Errors: Off




New Site
-----------------------------------------------
PHP Version: 4.3.9
PHP OS: Linux
Error Reporting: 2047 (E_ALL)
Register Globals: Off
Display Errors: Off




> So it seems that I have to configure the Register Globals? If so how do I do this?

Regards,
Peter

Posted: Mon Mar 13, 2006 8:39 pm
by nickman013
In your PHP.ini add this line.

Code: Select all

register_globals = On
I know some people may think that is the incorrect way, but when my web server disabled register globals on all accounts, that is what they told me to do. Make a php.ini in every folder containing PHP.

Posted: Mon Mar 13, 2006 8:47 pm
by feyd
Rewriting the code to support register globals being off is the preferred method as that code will work regardless if they are on or not.

$_GET, $_POST and the like would be used.

Posted: Mon Mar 13, 2006 8:49 pm
by John Cartwright
nickman013 wrote:In your PHP.ini add this line.

Code: Select all

register_globals = On
I know some people may think that is the incorrect way, but when my web server disabled register globals on all accounts, that is what they told me to do. Make a php.ini in every folder containing PHP.
Or you could write proper code -- relying on register globals is more often than not a big security risk. Wonder why it is not disabled by default :wink:

Posted: Mon Mar 13, 2006 8:57 pm
by nickman013
Yes, as somebody on this board told me, dont always rely on globals. Write every code like register_globals is disabled. :D

One Last Question?

Posted: Mon Mar 13, 2006 9:15 pm
by peternemser
Where is the php.ini congfig loacted? How do I update this?

Regards,
Peter

Posted: Mon Mar 13, 2006 9:32 pm
by nickman013
You just create your own.