11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

www.it-ebooks.infoCHAPTER 3 • <strong>PHP</strong> BASICS$_FILES['upload-name']['tmp_name']: Once uploaded, the file will be assigned atemporary name before it is moved to its final location.$_FILES['upload-name']['error']: An upload status code. Despite the name, thisvariable will be populated even in the case of success. There are five possiblevalues:UPLOAD_ERR_OK: The file was successfully uploaded.UPLOAD_ERR_INI_SIZE: The file size exceeds the maximum size imposed by theupload_max_filesize directive.UPLOAD_ERR_FORM_SIZE: The file size exceeds the maximum size imposed by anoptional MAX_FILE_SIZE hidden form-field parameter.UPLOAD_ERR_PARTIAL: The file was only partially uploaded.UPLOAD_ERR_NO_FILE: A file was not specified in the upload form prompt.Chapter 15 is devoted to a complete introduction of <strong>PHP</strong>’s file upload functionality.Learning More About the Operating System EnvironmentThe $_ENV superglobal offers information regarding the <strong>PHP</strong> parser’s underlying server environment.Some of the variables found in this array include the following:$_ENV['HOSTNAME']: The server hostname$_ENV['SHELL']: The system shell■ Caution <strong>PHP</strong> supports two other superglobals, namely $GLOBALS and $_REQUEST. The $_REQUEST superglobal isa catch-all of sorts, recording variables passed to a script via the GET, POST, and Cookie methods. The order ofthese variables doesn’t depend on the order in which they appear in the sending script; rather, it depends on theorder specified by the variables_order configuration directive. The $GLOBALS superglobal array can be thoughtof as the superglobal superset and contains a comprehensive listing of all variables found in the global scope.Although it may be tempting, you shouldn’t use these superglobals as a convenient way to handle variablesbecause it is insecure. See Chapter 21 for an explanation.Retrieving Information Stored in SessionsThe $_SESSION superglobal contains information regarding all session variables. Registering sessioninformation allows you the convenience of referring to it throughout your entire web site, without thehassle of explicitly passing the data via GET or POST. Chapter 18 is devoted to <strong>PHP</strong>’s formidable sessionhandlingfeature.65

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!