11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 2• CONFIGURING YOUR ENVIRONMENTwww.it-ebooks.infonot intended to delimit the string. If you don’t do this, unexpected errors could occur. Consider thefollowing:$sentence = "John said, "I love racing cars!"";Which quote marks are intended to delimit the string and which are used to delimit John’s utterance? <strong>PHP</strong>doesn’t know unless certain quote marks are escaped, like this:$sentence = "John said, \"I love racing cars!\"";Escaping nondelimiting quote marks is known as enabling magic quotes. This process could be doneeither automatically, by enabling the directive magic_quotes_gpc (introduced in this section), or manually,by using the functions addslashes() and stripslashes(). The latter strategy is recommended becauseit gives you total control over the application (although in those cases where you’re trying to use anapplication in which the automatic escaping of quotations is expected, you’ll need to enable this behavioraccordingly).However, because this feature has long been a source of confusion among developers, it’s beendeprecated as of <strong>PHP</strong> 5.3.0.magic_quotes_gpc = On | OffScope: <strong>PHP</strong>_INI_SYSTEM; Default value: OffThis parameter determines whether magic quotes are enabled for data transmitted via the GET,POST, and cookie methodologies. When enabled, all single and double quotes, backslashes, and nullcharacters are automatically escaped with a backslash.magic_quotes_runtime = On | OffScope: <strong>PHP</strong>_INI_ALL; Default value: OffEnabling this parameter results in the automatic escaping (using a backslash) of any quote markslocated within data returned from an external resource, such as a database or text file.magic_quotes_sybase = On | OffScope: <strong>PHP</strong>_INI_ALL; Default value: OffThis parameter is only of interest if magic_quotes_runtime is enabled. If magic_quotes_sybase isenabled, all data returned from an external resource will be escaped using a single quote rather than abackslash. This is useful when the data is being returned from a Sybase database, which employs arather unorthodox requirement of escaping special characters with a single quote rather than abackslash.auto_prepend_file = stringScope: <strong>PHP</strong>_INI_SYSTEM; Default value: NULLCreating page header templates or including code libraries before a <strong>PHP</strong> script is executed is mostcommonly done using the include() or require() function. You can automate this process and forgo the32

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

Saved successfully!

Ooh no, something went wrong!