Portrety Uliczne Nieznajomych - zobacz wyjątkową galerię portretów z warszawskich ulic
ZALOGUJ SIĘ
login:
hasło:
przypomnij hasło
załóż konto użytkownika
(i zobacz kilka porad gratis)
   
WYSZUKIWARKA I DZIAŁY
całe porady  tytuły
zaznacz działy do przeszukania
(brak wyboru = wszystkie działy)
PHP
MySQL >
PostgreSQL
SQLite
Perl
Java
XML
XSLT
XPath
WML
SVG
RegExp
Wyszukiwarki
Ochrona
VBScript
Google Plus
XHTML/CSS
JavaScript
Grafika
Flash
Photoshop
Windows
Linux
Bash
Apache
Procmail
E-biznes
Explorer
Opera
Firefox
Inne porady
   
KURSY, DOKUMENTACJE
Własne:
XHTML/CSS
JavaScript
ActionScript
WML, RSS, SSI
Pozostałe:
PHP
MySQL
Java API
więcej...
   
użytkowników online: 68
W CZYM MOGĘ POMÓC?


   
OPINIE UŻYTKOWNIKÓW
Przyznam, że jestem pod sporym wrażeniem. Od wielu lat zajmuje się grafiką przeznaczoną do druku ze szczególnym uwzględnieniem opakowań. Z radością stwierdzam, iż twórca serwisu jest moim ulubionym typem potencjalnego współpracownika (choć branża troszeczkę inna) tzn. pada pytanie i błyskawicznie pada konkretna odpowiedź bez względu na stopień skomplikowania pytania. Gorąco polecam współpracę, gdyż macie pewność że nie zostaniecie potraktowani sloganami typu "oczywiście", "nie ma sprawy" tylko otrzymacie konkretną pomoc. Tak trzymać! Na pewno jeszcze nie raz skorzystam

Paweł
Studio Gama

   
GALERIA FOTOGRAFII
   
PODRĘCZNIK PHP 5.x, 4.x, 3.x - częściowo spolszczony / źródło: www.php.net

[Spis] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [X] [W] [Z]

Rozdział 77. Miscellaneous Questions

There can be some questions we can't put into other categories. Here you can find them.

1. How can I handle the bz2 compressed manuals on Windows?
2. What does & beside argument mean in function declaration of e.g. asort()?
3. How do I deal with register_globals?

1. How can I handle the bz2 compressed manuals on Windows?

If you don't have an archiver-tool to handle bz2 files download the commandline tool from Redhat (please find further information below).

If you would not like to use a command line tool, you can try free tools like Stuffit Expander, UltimateZip, 7-Zip, or Quick Zip. If you have tools like WinRAR or Power Archiver, you can easily decompress the bz2 files with it. If you use Total Commander (formerly Windows Commander), a bz2 plugin for that program is available freely from the Total Commander site.

The bzip2 commandline tool from Redhat:

Win2k Sp2 users grab the latest version 1.0.2, all other Windows user should grab version 1.00. After downloading rename the executable to bzip2.exe. For convenience put it into a directory in your path, e.g. C:\Windows where C represents your windows installation drive.

Note: lang stands for your language and x for the desired format, e.g.: pdf. To uncompress the php_manual_lang.x.bz2 follow these simple instructions:

  • open a command prompt window

  • cd to the folder where you stored the downloaded php_manual_lang.x.bz2

  • invoke bzip2 -d php_manual_lang.x.bz2, extracting php_manual_lang.x in the same folder

In case you downloaded the php_manual_lang.tar.bz2 with many html-files in it, the procedure is the same. The only difference is that you got a file php_manual_lang.tar. The tar format is known to be treated with most common archivers on Windows like e.g. WinZip.

2. What does & beside argument mean in function declaration of e.g. asort()?

It means that the argument is passed by reference and the function will likely modify it corresponding to the documentation. You can pass only variables this way and you don't need to pass them with & in function call (it's even deprecated).

3. How do I deal with register_globals?

For information about the security implications of register_globals, read the security chapter on Using register_globals.

It's preferred to use superglobals, rather than relying upon register_globals being on.

If you are on a shared host with register_globals turned off and need to use some legacy applications, which require this option to be turned on, or you are on some hosting server, where this feature is turned on, but you would like to eliminate security risks, you might need to emulate the opposite setting with PHP. It is always a good idea to first ask if it would be possible to change the option somehow in PHP's configuration, but if it is not possible, then you can use these compatibility snippets.

Przykład 77-1. Emulating Register Globals

This will emulate register_globals On.

<?php
// Emulate 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);
   }
}
?>

This will emulate register_globals Off.

<?php
// Emulate register_globals off
if (ini_get('register_globals')) {
  
$superglobals = array($_SERVER, $_ENV,
      
$_FILES, $_COOKIE, $_POST, $_GET);
   if (isset(
$_SESSION)) {
      
array_unshift($superglobals, $_SESSION);
   }
   foreach (
$superglobals as $superglobal) {
       foreach (
$superglobal as $global => $value) {
           unset(
$GLOBALS[$global]);
       }
   }
}
?>




User Contributed Notes

19-Jul-2005 06:08

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 &amp;

The example turns off register_globals and sets the value of arg_separator.output to &amp; 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


markus
19-Jun-2005 12: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+ :)


26-May-2005 11:12

Concerning the emulation of "register globals off" snippet. What happens if someone puts superglobals into the list of variables to be unset? Just a thought... :-)


26-May-2005 11:01

Concerning the emulation of "register globals off" snippet. What happens if someone puts superglobals into the list of variables to be unset? Just a thought... :-)


djalex at pisem dot net
22-May-2005 11:29

How i can connect to remout computer (if i know local ip, mac, port. its loacate in local net, which connect to internet) from internet by PHP sockets with (tcp)?


php at REMOVEMEkennel17 dot co dot uk
13-Apr-2005 05: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.


Juhapekka Tolvanen
18-Feb-2005 08:34

I added many links to software that can at least decompress Bzip2-files here:

http://en.wikipedia.org/wiki/Bzip2


 

 
  © 1996-2012 & Reporter.plmiejscao serwisieabonamentwarunki korzystaniaRSSkontakt