- Home
- Categorie
- Coding e Sistemistica
- CMS & Piattaforme Self-Hosted
- PHP register_globals
-
PHP register_globals
Salve a tutti,
la dicitura che compare nel pannello di amministrazione PHP register_globals setting isON
instead ofOFF
deve esere necessariamente modificata per motivi di sicurezza? Posso farlo io o è meglio che ci pensi il mio providergrazie
-
@trench said:
Salve a tutti,
la dicitura che compare nel pannello di amministrazione PHP register_globals setting isON
instead ofOFF
deve esere necessariamente modificata per motivi di sicurezza? Posso farlo io o è meglio che ci pensi il mio providergrazie
ciao trench puoi farlo te se ti è concesso la modifica del php.ini. In ogni modo senti prima il tuo provider.
Facci sapere
-
La situazione può divenire complicata quando il provider che ospita il nostro sito non permette la variazione del file PHP.INI, in modo da poterci garantire una perfetta compatibilità e sicurezza del nostro sito Joomla.
Per aggirare l'ostacolo è possibile copiare il file PHP.INI modificato su tutte le cartelle/sottocartelle di Joomla ( ---
hai detto poco sono metà di mille --- ).
Allego i sorgenti di tre piccoli programmini PHP che permettono di facilitarci questo gravoso compito:
** 1 - Creazione del file PHP.INI** copia il file php.ini originale nella root di Joomla impostando la riga register_globals=Off (nulla vieta di aggiungere qualcosa d'altro):
A questo programma serve il percorso del file PHP.INI originale, quindi usa:```
<?php phpinfo(); ?><!-- /* NOME PROGRAMMA: create_phpini.php */ -->
<?php
// Put all the php.ini parameters you want to change below. One per line.
// Follow the example format $parm[] = "parameter = value";
$parm[] = "register_globals = Off";
$parm[] = "session.use_trans_sid = 0";
// full unix path - location of the default php.ini file at your host
// you can determine the location of the default file using phpinfo()
$defaultPath = '/usr/local/lib/php.ini';
// full unix path - location where you want your custom php.ini file
$customPath = "/joomla/php.ini";
// nothing should change below this line.
if (file_exists($defaultPath)) {
$contents = file_get_contents($defaultPath);
$contents .= "\n\n; MODIFICATI I SEGUENTI PARAMETRI UTENTE:\n\n";
foreach ($parm as $value) $contents .= $value . " \n";
if (file_put_contents($customPath,$contents)) {
if (chmod($customPath,0600)) $message = "<b>File PHP.INI modificato e copiato.</b>";
else $message = "ERRORE DI PROCESSO - Aggiornamento dei diritti file php.ini fallito.";
} else {
$message = "ERRORE DI PROCESSO - Scrittura del file php.ini fallita";
}
} else {
$message = "ERRORE DI PROCESSO - File php.ini non trovato";
}
echo $message;
?>**Questo programma va lanciato ogni volta che installate un nuovo modulo, componente, estensione oppure ogni volta che create una nuova cartella.
<!-- /* NOME PROGRAMMA: copy_phpini.php */ -->
<?php
// - - Start Script Here - -// set this value to Y if you only want to overwrite old php.ini files
// set this value to N if you want to put a php.ini file in every directory
$overwriteOnly = "N";
// full path to the location of your home directory where the php.ini file is located that you want to copy to lower lever directories
$path = "/home/" . get_current_user() . "/public_html";
// change nothing below this line
if ($overwriteOnly == "Y") echo "Operating in Overwrite Only Mode<br><br>";
$source = $path . "/php.ini";
//if (!file_exists($source)) die('ERRORE - nessun file PHP.INI origine - trovato');
function search($dir) {
global $source, $overwriteOnly;
if (file_exists($source)) {
foreach(scandir($dir) as $filename) {
if ($filename !== '.' AND $filename !== '..' AND $filename !== 'cgi-bin' AND is_dir("$dir/$filename") ) {
$path = $dir."/".$filename;
$target = $path . "/php.ini";
if (!file_exists($target) AND $overwriteOnly == "Y") {
echo "$path <b>SALTATO - nessun file php.ini copiato</b><br>";
} else {
echo "$target <br>";
if (!copy($source,$target)) echo "<b>Scrittura fallita per $target </b><br>";
if (file_exists($target)) chmod($target,0600);
}
search($path);
}
}
} else {
echo '<b>ERRORE</b> - nessun file PHP.INI origine - trovato';
}
}
search($path);
echo "<br />FATTO.<br /><br />";
?><!-- /* NOME PROGRAMMA: del_phpini.php */ -->
<?php
// this script will delete all your php.ini files
// full path to the location of your home directory
$path = "/home/" . get_current_user() . "/public_html";
// change nothing below this line
function search($dir) {
foreach(scandir($dir) as $filename) {
if ( $filename !== '.' AND $filename !== '..' AND is_dir("$dir/$filename") ) {
$path = $dir."/".$filename;
$target = $path . "/php.ini";
if (file_exists($target)) {
if (unlink($target)) echo "CANCELLAZIONE - $target <br>"; else echo "<b>Eliminazion FALLITA per $target </b><br>";
}
search($path);
}
}
}
$target = $path . "/php.ini";
if (file_exists($target)) {
echo "Eliminazione - $target <br>";
if (!unlink($target)) echo "<b>Eliminazione FALLITA per $target </b><br>";
}
search($path);
echo "<br />FATTO.<br /><br />";
?>Spero che il suggerimento sia utile.* Ciao Denis :wink3:
-
Grazie, tds e surfwork provo a chidere al provider poi vi faccio sapere
-
@trench said:
Grazie, tds e surfwork provo a chidere al provider poi vi faccio sapere
Certo trenchattendiamo tue notizie..
Bel e utile post tds