I have lots of http://www.hfcarbon.com on this page that I want to find the positions.
Domande varie
Ci sono diverse domande che ricorrono frequentemente ma che non possono essere inserite in una delle categorie principali: puoi torvare queste domande in questa sezione.
- Come posso gestire i file compressi bz2 sotto Windows?
- Cosa significa il simbolo & davanti agli argomenti nelle dichiarazione di funzioni come, ad esempio, asort()?
- Come gestisco i register_globals?
-
Come posso gestire i file compressi bz2 sotto Windows?
-
Se non hai un software in grado di estrarre gli archivi bz2, scarica » questo programma a riga di comando per RedHat (leggi più sotto per maggiori informazioni).
Se non vuoi usare la riga di comando, puoi scaricare uno di questi software grauiti: » Stuffit Expander, » UltimateZip, » 7-Zip o » Quick Zip. Se hai già dei software tipo » WinRAR o » Power Archiver, puoi gestire senza problemi gli archivi bz2. Se usi Total Commander (un tempo Windows Commander), sul sito » Windows Commander è disponibile un plugin gratuito per gestire i file bz2.
Programma a riga di comando per RedHat:
Gli utenti Sp2 Win2k possono scaricare l'ultima versione, la 1.0.2, tutti gli altri utenti Windows devono scaricare la versione 1.00. Dopo aver scaricato il file, rinominarlo in bzip2.exe. Per comodità copia questo file in una cartella del tuo hard disk principale, per esempio C:\Windows (dove C rappresenta la lettera del tuo hard disk).
Nota: 'lang' indica la tua lingua e x il formato desiderato, per esempio pdf. Per decomprimere il file php_manual.x.bz2 segui queste semplici istruzioni:
- Apri il prompt dei comandi di WIndows
- Entra nella cartella che contiene il file php_manual_lang.x.bz2 (cd nome_cartella)
- digita bzip2 -d php_manual_lang.x.bz2 per estrarre il file nella stessa cartella
Nel caso tu abbia scaricato il manuale php_lang.tar.bz2 nel formato contenente molti file HTML, la procedura sarà la stessa. La sola differenza è che hai scaricato un file *.tar. Il formato *.tar è famoso perchè viene riconosciuto dalla maggior parte dei software di archiviazione per Windows, per esempio » WinZip.
-
Cosa significa il simbolo & davanti agli argomenti nelle dichiarazione di funzioni come, ad esempio, asort()?
-
Significa che l'argomento è passato per riferimento e la funzione può modificarlo, come specificato nella documentazione. In questo modo si possono solo passare variabili e non occorre scrivere & nella chiamata (è persino deprecato).
-
Come gestisco i register_globals?
-
Per informazione sulle implicazioni di sicurezza dei register_globals, leggi il capitolo sulla sicurezza sull' Uso dei register_globals.
Si preferisce utilizzare i superglobals, piuttosto che basarsi sui register_globals.
Se sei un un host condiviso con register_globals spenti e hai bisogno di usare delle applicazioni particolari che li richiedono attivi, o se sei su un server in hosting con questa opzione attiva, ma vuoi eliminare rischi di sicurezza, puoi emulare l'impostazione corretta con PHP. Ovviamente è sempre un'ottima idea chiedere se è possibile cambiare l'opzione nella configurazione di PHP, ma se ciò non è possibile, puoi usare queste snippet di compatibilità.
Example #1 Emulazione dei Register Globals
Questo emula register_globals On. Se hai alterato la direttiva variables_order, cambia la $superglobals di conseguenza.
<?php
// Emulazione di register_globals on
if (!ini_get('register_globals')) {
$superglobals = array($_SERVER, $_ENV,
$_FILES, $_COOKIE, $_POST, $_GET);
if (isset($_SESSION)) {
array_unshift($superglobals, $_SESSION);
}
foreach ($superglobals as $superglobal) {
extract($superglobal, EXTR_SKIP);
}
}
?>Questo emula register_globals Off. Ricorda che questo codice deve essere chiamato all'inizio dello script, oppure dopo session_start() se lo usi per iniziare la session.
<?php
// Emulazione di register_globals off
function unregister_GLOBALS()
{
if (!ini_get('register_globals')) {
return;
}
// Might want to change this perhaps to a nicer error
if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) {
die('GLOBALS overwrite attempt detected');
}
// Variables that shouldn't be unset
$noUnset = array('GLOBALS', '_GET',
'_POST', '_COOKIE',
'_REQUEST', '_SERVER',
'_ENV', '_FILES');
$input = array_merge($_GET, $_POST,
$_COOKIE, $_SERVER,
$_ENV, $_FILES,
isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
foreach ($input as $k => $v) {
if (!in_array($k, $noUnset) && isset($GLOBALS[$k])) {
unset($GLOBALS[$k]);
}
}
}
unregister_GLOBALS();
?>
Domande varie
15-Jul-2008 01:37
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
19-Jun-2005 06: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+ :)
13-Apr-2005 11: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.
19-Feb-2005 03:34
I added many links to software that can at least decompress Bzip2-files here:
http://en.wikipedia.org/wiki/Bzip2
