php.ini中修改; You should do your best to write your scripts so that they do not require ; register_globals to be on; Using form variables as globals can easily lead ; to possible security problems, if the code is not very well thought of. register_globals = On (●); This directive tells PHP whether to declare the argv&argc variables (that ; would contain the GET information). If you don't use these variables, you ; should turn it off for increased performance. register_argc_argv = On (●)好象其中一个就可以了!!
两个都已经打开了,还是没用 <? global $hosts; $hosts=$HTTP_SERVER_VARS["HTTP_HOST"]; function host(){ $goto="Location:http://$hosts/share/error.php"; return $goto; } host(); ?>
function host(){ global $HTTP_SERVER_VARS; $goto="Location:http://$hosts/share/error.php"; return $goto; }
上面写错了 <? $hosts=$HTTP_SERVER_VARS["HTTP_HOST"]; function host(){ global $hosts; $goto="Location:http://$hosts/share/error.php"; return $goto; } host(); ?> 或 <? function host(){ global $HTTP_SERVER_VARS; $hosts=$HTTP_SERVER_VARS["HTTP_HOST"]; $goto="Location:http://$hosts/share/error.php"; return $goto; } host(); ?>
; register_globals to be on; Using form variables as globals can easily lead
; to possible security problems, if the code is not very well thought of.
register_globals = On (●); This directive tells PHP whether to declare the argv&argc variables (that
; would contain the GET information). If you don't use these variables, you
; should turn it off for increased performance.
register_argc_argv = On (●)好象其中一个就可以了!!
<?
global $hosts;
$hosts=$HTTP_SERVER_VARS["HTTP_HOST"]; function host(){
$goto="Location:http://$hosts/share/error.php";
return $goto;
}
host();
?>
global $HTTP_SERVER_VARS;
$goto="Location:http://$hosts/share/error.php";
return $goto;
}
<?
$hosts=$HTTP_SERVER_VARS["HTTP_HOST"]; function host(){
global $hosts;
$goto="Location:http://$hosts/share/error.php";
return $goto;
}
host();
?>
或
<?
function host(){
global $HTTP_SERVER_VARS;
$hosts=$HTTP_SERVER_VARS["HTTP_HOST"];
$goto="Location:http://$hosts/share/error.php";
return $goto;
}
host();
?>
用$_*[]系列就好了.
这里就用$_SERVER[]