Preguntas Varias

Puede que existan algunas preguntas que no podemos colocar en otras categorías. Este es el lugar en donde puede encontrarlas.

¿Cómo puedo manipular los manuales comprimidos mediante bz2 en Windows?

Si no cuenta con una herramienta de archivación que pueda manejar archivos bz2, » descargue la herramienta de línea de comandos de RedHat (por favor refiérase a la inforamción presentada más adelante).

Si no desea usar una herramienta de línea de comandos, puede probar herramientas gratuitas como » Stuffit Expander, » UltimateZip, » 7-Zip, o » Quick Zip. Si dispone de herramientas como » WinRAR o » Power Archiver, puede descomprimir fácilmente archivos bz2 con ellas. Si usa Total Commander (anteriormente Windows Commander), un módulo adicional para ese programa se encuentra disponible de forma gratuita desde el sitio de » Total Commander.

La herramienta bzip2 de línea de comandos por Redhat:

Los usuarios de Win2k Sp2 deben obtener la versión más reciente, 1.0.2, todos los demás usuarios de Windows deben obtener la versión 1.00. Después de la descarga, renombre el ejecutable a bzip2.exe. Para mayor conveniencia, colóquelo en un directorio que sea parte de sus rutas predeterminadas, p.ej. C:\Windows, en donde C representa la unidad en donde se encuentra su instalación de Windows.

Nota: lang representa su lenguaje, y x el formato deseado, p.ej: pdf. Para descomprimir el archivo php_manual_lang.x.bz2 siga las siguientes instrucciones:

  • abra una ventana con el intérprete de comandos
  • cambie de directorio hacia la carpeta en donde almacenó el archivo php_manual_lang.x.bz2 descargado
  • invoque bzip2 -d php_manual_lang.x.bz2, extrayendo de este modo php_manual_lang.x en la misma carpeta

En caso de que haya descargado el archivo php_manual_lang.tar.bz2 con varios archivos html en su interior, el procedimiento es el mismo. La única diferencia es que recibe un archivo php_manual_lang.tar. Se conoce que el formato tar es tratado por la mayoría de archivadores en Windows, como por ejemplo » WinZip.

add a note add a note

User Contributed Notes 3 notes

up
4
doerr at apkk dot de
13 years ago
If you only needed register_globals for get/post variables, the effictive solution for 5.3 is:
  import_request_variables("GPC", "");

But if the skripts relied on session_register() you'll have to do more:
- Replace all variables that appeared after session_register with _SESSION equivalents - so $myvar becomes $_SESSION['myvar']
- Take care if your variables appeared inside strings - 'Hello $user !' works, but 'Hello $_SESSION['user'] !' not - so you have to concatenate the string: 'Hello '.$_SESSION['user'] .' !'
- Session variables in function declarations (for whatever purpose) will not work - keeping the old (local) names will work in most cases.
- Finally, replace the session_register(..) line with session_start()
up
0
php at REMOVEMEkennel17 dot co dot uk
18 years ago
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.
up
-2
markus
18 years ago
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+ :)
To Top