using .htaccess file to disable register globals (register_globals)
The syntax for setting an option is:
php_value name value
php_flag name on or off
Example:
php_flag register_globals off
php_value arg_separator.output &
The example turns off register_globals and sets the value of arg_separator.output to & which is preferred rather than the default &.
Note: you can also set boolean options with the php_value directive, the string will be converted to boolean before assignment.
you can also use .htaccess to turn magic quotes on or off.
Search php.net and you'll find it
Mohou existovat otázky, které nemůžeme umístit do žádné jiné kategorie. Najdete je zde.
| 62.1. | Mohu s manuály komprimovanými pomocí bz2 pracovat ve Windows? |
Pokud nemáte archivační nástroj pro práci se soubory bz2, » stáhněte si nástroj pro příkazovou řádku od RedHatu (viz níže). Pokud byste nechtěli používat nástroj pro příkazovou řádku, můžete zkusit free software » Stuffit Expander, » UltimateZip, » 7-Zip nebo » Quick Zip. Máte-li » WinRAR nebo » Power Archiver, můžete s ním také snadno dekomprimovat bz2 soubory. Pokud používáte Windows Commander, plugin pro bz2 je k dispozici zdarma přímo na stránce programu » Windows Commander. Nástroj příkazové řádky bzip2 od firmy Redhat: Uživatelé Win2k SP2 ať si stáhnou nejnovější verzi 1.0.2, uživatelé ostatních systémů Windows by si měli stáhnout verzi 1.00. Po stažení přejmenujte spustitelný soubor na bzip2.exe. Je výhodné přesunout ho do adresáře v nastavení cest, např. C:\Windows (kde C představuje disk, kde jsou nainstalovány Windows). Pozn.: "lang" představuje váš jazyk a "x" zvolený formát, např. pdf. K rozbalení souboru php_manual_lang.x.bz2 postupujte podle těchto kroků:
V případě, že jste stáhli php_manual_lang.tar.bz2 obsahující v sobě více HTML souborů, je procedura stejná. Jediný rozdíl je ten, že obdržíte soubor php_manual_lang.tar. O formátu tar je známo, že ho lze zpracovat běžnými archivačními programy na Windows, jako je » WinZip. |
Ostatní otázky
18-Jun-2005 03:34
Considering the comment below. I think there's a way to avoid that "problem":
<?php
//
// $starttime is an example of a variable that we might need to define,
// even before, running the "register_globals OFF" emulator below.
//
list($msec, $sec) = explode(' ', microtime());
$starttime = ((float)$msec + (float)$sec);
//
// If register_globals is ON, ensure no unexpected globals are defined.
// ie. We'll try to emulate a register_globals OFF environment.
//
if( (bool)@ini_get('register_globals') )
{
$superglobals = array($_ENV, $_GET, $_POST, $_COOKIE, $_FILES, $_SERVER);
if( isset($_SESSION) )
{
array_unshift($superglobals, $_SESSION);
}
$knownglobals = array(
//
// Known PHP Reserved globals and superglobals:
//
'_ENV', 'HTTP_ENV_VARS',
'_GET', 'HTTP_GET_VARS',
'_POST', 'HTTP_POST_VARS',
'_COOKIE', 'HTTP_COOKIE_VARS',
'_FILES', 'HTTP_FILES_VARS',
'_SERVER', 'HTTP_SERVER_VARS',
'_SESSION', 'HTTP_SESSION_VARS',
'_REQUEST',
//
// Global variables used by this code snippet:
//
'superglobals',
'knownglobals',
'superglobal',
'global',
'void',
//
// Known global variables defined before this code snippet is reached.
//
'starttime',
);
foreach( $superglobals as $superglobal )
{
foreach( $superglobal as $global => $void )
{
if( !in_array($global, $knownglobals) )
{
unset($GLOBALS[$global]);
}
}
}
}
?>
Note the stuff related to the $_SESSION array depends on whether the PHP session has been started or not. You might want to call session_start() before this point (or set session.auto_start ON).
HTH+ :)
12-Apr-2005 08:22
Regarding simulating register_globals = off, note that it is impossible to adequately prevent $_SESSION variables from being globalised, as the array (and thus the globals) are created on a call to session_start(). You would therefore have to 'undo' this when you start a session as using it at the start of your script will have no effect.
To avoid potential problems, use a prefix that is unique for all session variables (e.g. 'SESS_'), and only access them via the $_SESSION array. The prefix ensures that you don't have a naming clash (and therefore a security risk) with any non-session globals.
18-Feb-2005 11:34
I added many links to software that can at least decompress Bzip2-files here:
http://en.wikipedia.org/wiki/Bzip2
