PHP Tutorials: Magic Quotes

Source: Internet
Author: User
Tags manual ini modify sybase

For Magic quotes, it is a commonplace question for phper. Today I accidentally see an article, combined with PHP Manual and its reply, here to do a simple summary.

In short, the input data is automatically escaped when the Magic quotes is turned on. where all single quotes ('), double quotes ("), backslashes, and NULL characters are escaped (add a backslash), which essentially calls the Addslashes function.

Why use Magic quotes

Convenient and quick

The design of PHP designers at the beginning of the idea is to be able to quickly and easily programming. For example, when inserting a database, Magic quotes automatically escapes data, which is convenient.

Good for Beginners

Magic quotes can, to some extent, allow beginners to take away the security risks of scripting. For example, in the absence of any protection code, open Magic quotes will be a lot less risk, such as injection problems. Of course, a single use of this method does not completely prevent this type of security issue.

"I have no authority to close."

Obviously you may already be aware of the problem, but the host space is not entirely controlled by itself.

Why not use Magic quotes

Portability

Regardless of whether this feature is turned on, it affects the portability of the script because it affects the subsequent operation of filtering data.

Performance issues

is escaped before fetching all the external data, which undoubtedly increases the cost of the runtime (and not all data needs to be escaped).

Cause confusion

As mentioned above, not all data needs to be escaped. One possible scenario is when you're "crazy" using the Stripslashes function to get data that is not escaped.

PHP6 has not supported

The designers of PHP are clearly aware of their "mistakes", so they have been discarded in PHP6.

How to disable Magic quotes

According to my point of view, using PHP.ini configuration file to disable Magic quotes is the most reliable. Refer to the following code

; Magic Quotes
;
; Magic quotes for incoming Get/post/cookie data.
MAGIC_QUOTES_GPC = Off
; Magic quotes for runtime-generated data, e.g. data to SQL, from exec (), etc.
Magic_quotes_runtime = Off
; Use Sybase-style Magic quotes (escape ' with ' instead of ').
Magic_quotes_sybase = Off

However, the online host may not be able to allow you to modify the php.ini file, you can use the. htaccess file to disable, add the following code

Php_flag MAGIC_QUOTES_GPC off

In the case of portable code above, data must be consistent regardless of whether or not magic_quotes is disabled. So the following code can help you

<?php
if (GET_MAGIC_QUOTES_GPC ()) {
function Stripslashes_deep ($value) {
$value = Is_array ($value)?
Array_map (' Stripslashes_deep ', $value):
Stripslashes ($value);
return $value;
}

For Magic quotes, it is a commonplace question for phper. Today I accidentally see an article, combined with PHP Manual and its reply, here to do a simple summary.

In short, the input data is automatically escaped when the Magic quotes is turned on. where all single quotes ('), double quotes ("), backslashes, and NULL characters are escaped (add a backslash), which essentially calls the Addslashes function.

Why use Magic quotes

Convenient and quick

The design of PHP designers at the beginning of the idea is to be able to quickly and easily programming. For example, when inserting a database, Magic quotes automatically escapes data, which is convenient.

Good for Beginners

Magic quotes can, to some extent, allow beginners to take away the security risks of scripting. For example, in the absence of any protection code, open Magic quotes will be a lot less risk, such as injection problems. Of course, a single use of this method does not completely prevent this type of security issue.

"I have no authority to close."

Obviously you may already be aware of the problem, but the host space is not entirely controlled by itself.

Why not use Magic quotes

Portability

Regardless of whether this feature is turned on, it affects the portability of the script because it affects the subsequent operation of filtering data.

Performance issues

is escaped before fetching all the external data, which undoubtedly increases the cost of the runtime (and not all data needs to be escaped).

Cause confusion

As mentioned above, not all data needs to be escaped. One possible scenario is when you're "crazy" using the Stripslashes function to get data that is not escaped.

PHP6 has not supported

The designers of PHP are clearly aware of their "mistakes", so they have been discarded in PHP6.

How to disable Magic quotes

According to my point of view, using PHP.ini configuration file to disable Magic quotes is the most reliable. Refer to the following code

; Magic Quotes
;
; Magic quotes for incoming Get/post/cookie data.
MAGIC_QUOTES_GPC = Off
; Magic quotes for runtime-generated data, e.g. data to SQL, from exec (), etc.
Magic_quotes_runtime = Off
; Use Sybase-style Magic quotes (escape ' with ' instead of ').
Magic_quotes_sybase = Off

However, the online host may not be able to allow you to modify the php.ini file, you can use the. htaccess file to disable, add the following code

Php_flag MAGIC_QUOTES_GPC off

In the case of portable code above, data must be consistent regardless of whether or not magic_quotes is disabled. So the following code can help you

___fckpd___2
get = Array_map (' Stripslashes_deep ',

For Magic quotes, it is a commonplace question for phper. Today I accidentally see an article, combined with PHP Manual and its reply, here to do a simple summary.

In short, the input data is automatically escaped when the Magic quotes is turned on. where all single quotes ('), double quotes ("), backslashes, and NULL characters are escaped (add a backslash), which essentially calls the Addslashes function.

Why use Magic quotes

Convenient and quick

The design of PHP designers at the beginning of the idea is to be able to quickly and easily programming. For example, when inserting a database, Magic quotes automatically escapes data, which is convenient.

Good for Beginners

Magic quotes can, to some extent, allow beginners to take away the security risks of scripting. For example, in the absence of any protection code, open Magic quotes will be a lot less risk, such as injection problems. Of course, a single use of this method does not completely prevent this type of security issue.

"I have no authority to close."

Obviously you may already be aware of the problem, but the host space is not entirely controlled by itself.

Why not use Magic quotes

Portability

Regardless of whether this feature is turned on, it affects the portability of the script because it affects the subsequent operation of filtering data.

Performance issues

is escaped before fetching all the external data, which undoubtedly increases the cost of the runtime (and not all data needs to be escaped).

Cause confusion

As mentioned above, not all data needs to be escaped. One possible scenario is when you're "crazy" using the Stripslashes function to get data that is not escaped.

PHP6 has not supported

The designers of PHP are clearly aware of their "mistakes", so they have been discarded in PHP6.

How to disable Magic quotes

According to my point of view, using PHP.ini configuration file to disable Magic quotes is the most reliable. Refer to the following code

; Magic Quotes
;
; Magic quotes for incoming Get/post/cookie data.
MAGIC_QUOTES_GPC = Off
; Magic quotes for runtime-generated data, e.g. data to SQL, from exec (), etc.
Magic_quotes_runtime = Off
; Use Sybase-style Magic quotes (escape ' with ' instead of ').
Magic_quotes_sybase = Off

However, the online host may not be able to allow you to modify the php.ini file, you can use the. htaccess file to disable, add the following code

Php_flag MAGIC_QUOTES_GPC off

In the case of portable code above, data must be consistent regardless of whether or not magic_quotes is disabled. So the following code can help you

___fckpd___2
Get);

For Magic quotes, it is a commonplace question for phper. Today I accidentally see an article, combined with PHP Manual and its reply, here to do a simple summary.

In short, the input data is automatically escaped when the Magic quotes is turned on. where all single quotes ('), double quotes ("), backslashes, and NULL characters are escaped (add a backslash), which essentially calls the Addslashes function.

Why use Magic quotes

Convenient and quick

The design of PHP designers at the beginning of the idea is to be able to quickly and easily programming. For example, when inserting a database, Magic quotes automatically escapes data, which is convenient.

Good for Beginners

Magic quotes can, to some extent, allow beginners to take away the security risks of scripting. For example, in the absence of any protection code, open Magic quotes will be a lot less risk, such as injection problems. Of course, a single use of this method does not completely prevent this type of security issue.

"I have no authority to close."

Obviously you may already be aware of the problem, but the host space is not entirely controlled by itself.

Why not use Magic quotes

Portability

Regardless of whether this feature is turned on, it affects the portability of the script because it affects the subsequent operation of filtering data.

Performance issues

is escaped before fetching all the external data, which undoubtedly increases the cost of the runtime (and not all data needs to be escaped).

Cause confusion

As mentioned above, not all data needs to be escaped. One possible scenario is when you're "crazy" using the Stripslashes function to get data that is not escaped.

PHP6 has not supported

The designers of PHP are clearly aware of their "mistakes", so they have been discarded in PHP6.

How to disable Magic quotes

According to my point of view, using PHP.ini configuration file to disable Magic quotes is the most reliable. Refer to the following code

; Magic Quotes
;
; Magic quotes for incoming Get/post/cookie data.
MAGIC_QUOTES_GPC = Off
; Magic quotes for runtime-generated data, e.g. data to SQL, from exec (), etc.
Magic_quotes_runtime = Off
; Use Sybase-style Magic quotes (escape ' with ' instead of ').
Magic_quotes_sybase = Off

However, the online host may not be able to allow you to modify the php.ini file, you can use the. htaccess file to disable, add the following code

Php_flag MAGIC_QUOTES_GPC off

In the case of portable code above, data must be consistent regardless of whether or not magic_quotes is disabled. So the following code can help you

___fckpd___2
POST = Array_map (' Stripslashes_deep ',

For Magic quotes, it is a commonplace question for phper. Today I accidentally see an article, combined with PHP Manual and its reply, here to do a simple summary.

In short, the input data is automatically escaped when the Magic quotes is turned on. where all single quotes ('), double quotes ("), backslashes, and NULL characters are escaped (add a backslash), which essentially calls the Addslashes function.

Why use Magic quotes

Convenient and quick

The design of PHP designers at the beginning of the idea is to be able to quickly and easily programming. For example, when inserting a database, Magic quotes automatically escapes data, which is convenient.

Good for Beginners

Magic quotes can, to some extent, allow beginners to take away the security risks of scripting. For example, in the absence of any protection code, open Magic quotes will be a lot less risk, such as injection problems. Of course, a single use of this method does not completely prevent this type of security issue.

"I have no authority to close."

Obviously you may already be aware of the problem, but the host space is not entirely controlled by itself.

Why not use Magic quotes

Portability

Regardless of whether this feature is turned on, it affects the portability of the script because it affects the subsequent operation of filtering data.

Performance issues

is escaped before fetching all the external data, which undoubtedly increases the cost of the runtime (and not all data needs to be escaped).

Cause confusion

As mentioned above, not all data needs to be escaped. One possible scenario is when you're "crazy" using the Stripslashes function to get data that is not escaped.

PHP6 has not supported

The designers of PHP are clearly aware of their "mistakes", so they have been discarded in PHP6.

How to disable Magic quotes

According to my point of view, using PHP.ini configuration file to disable Magic quotes is the most reliable. Refer to the following code

; Magic Quotes
;
; Magic quotes for incoming Get/post/cookie data.
MAGIC_QUOTES_GPC = Off
; Magic quotes for runtime-generated data, e.g. data to SQL, from exec (), etc.
Magic_quotes_runtime = Off
; Use Sybase-style Magic quotes (escape ' with ' instead of ').
Magic_quotes_sybase = Off

However, the online host may not be able to allow you to modify the php.ini file, you can use the. htaccess file to disable, add the following code

Php_flag MAGIC_QUOTES_GPC off

In the case of portable code above, data must be consistent regardless of whether or not magic_quotes is disabled. So the following code can help you

___fckpd___2
POST);

For Magic quotes, it is a commonplace question for phper. Today I accidentally see an article, combined with PHP Manual and its reply, here to do a simple summary.

In short, the input data is automatically escaped when the Magic quotes is turned on. where all single quotes ('), double quotes ("), backslashes, and NULL characters are escaped (add a backslash), which essentially calls the Addslashes function.

Why use Magic quotes

Convenient and quick

The design of PHP designers at the beginning of the idea is to be able to quickly and easily programming. For example, when inserting a database, Magic quotes automatically escapes data, which is convenient.

Good for Beginners

Magic quotes can, to some extent, allow beginners to take away the security risks of scripting. For example, in the absence of any protection code, open Magic quotes will be a lot less risk, such as injection problems. Of course, a single use of this method does not completely prevent this type of security issue.

"I have no authority to close."

Obviously you may already be aware of the problem, but the host space is not entirely controlled by itself.

Why not use Magic quotes

Portability

Regardless of whether this feature is turned on, it affects the portability of the script because it affects the subsequent operation of filtering data.

Performance issues

is escaped before fetching all the external data, which undoubtedly increases the cost of the runtime (and not all data needs to be escaped).

Cause confusion

As mentioned above, not all data needs to be escaped. One possible scenario is when you're "crazy" using the Stripslashes function to get data that is not escaped.

PHP6 has not supported

The designers of PHP are clearly aware of their "mistakes", so they have been discarded in PHP6.

How to disable Magic quotes

According to my point of view, using PHP.ini configuration file to disable Magic quotes is the most reliable. Refer to the following code

; Magic Quotes
;
; Magic quotes for incoming Get/post/cookie data.
MAGIC_QUOTES_GPC = Off
; Magic quotes for runtime-generated data, e.g. data to SQL, from exec (), etc.
Magic_quotes_runtime = Off
; Use Sybase-style Magic quotes (escape ' with ' instead of ').
Magic_quotes_sybase = Off

However, the online host may not be able to allow you to modify the php.ini file, you can use the. htaccess file to disable, add the following code

Php_flag MAGIC_QUOTES_GPC off

In the case of portable code above, data must be consistent regardless of whether or not magic_quotes is disabled. So the following code can help you

___fckpd___2
COOKIE = Array_map (' Stripslashes_deep ',

For Magic quotes, it is a commonplace question for phper. Today I accidentally see an article, combined with PHP Manual and its reply, here to do a simple summary.

In short, the input data is automatically escaped when the Magic quotes is turned on. where all single quotes ('), double quotes ("), backslashes, and NULL characters are escaped (add a backslash), which essentially calls the Addslashes function.

Why use Magic quotes

Convenient and quick

The design of PHP designers at the beginning of the idea is to be able to quickly and easily programming. For example, when inserting a database, Magic quotes automatically escapes data, which is convenient.

Good for Beginners

Magic quotes can, to some extent, allow beginners to take away the security risks of scripting. For example, in the absence of any protection code, open Magic quotes will be a lot less risk, such as injection problems. Of course, a single use of this method does not completely prevent this type of security issue.

"I have no authority to close."

Obviously you may already be aware of the problem, but the host space is not entirely controlled by itself.

Why not use Magic quotes

Portability

Regardless of whether this feature is turned on, it affects the portability of the script because it affects the subsequent operation of filtering data.

Performance issues

is escaped before fetching all the external data, which undoubtedly increases the cost of the runtime (and not all data needs to be escaped).

Cause confusion

As mentioned above, not all data needs to be escaped. One possible scenario is when you're "crazy" using the Stripslashes function to get data that is not escaped.

PHP6 has not supported

The designers of PHP are clearly aware of their "mistakes", so they have been discarded in PHP6.

How to disable Magic quotes

According to my point of view, using PHP.ini configuration file to disable Magic quotes is the most reliable. Refer to the following code

; Magic Quotes
;
; Magic quotes for incoming Get/post/cookie data.
MAGIC_QUOTES_GPC = Off
; Magic quotes for runtime-generated data, e.g. data to SQL, from exec (), etc.
Magic_quotes_runtime = Off
; Use Sybase-style Magic quotes (escape ' with ' instead of ').
Magic_quotes_sybase = Off

However, the online host may not be able to allow you to modify the php.ini file, you can use the. htaccess file to disable, add the following code

Php_flag MAGIC_QUOTES_GPC off

In the case of portable code above, data must be consistent regardless of whether or not magic_quotes is disabled. So the following code can help you

___fckpd___2
Cookies);

For Magic quotes, it is a commonplace question for phper. Today I accidentally see an article, combined with PHP Manual and its reply, here to do a simple summary.

In short, the input data is automatically escaped when the Magic quotes is turned on. where all single quotes ('), double quotes ("), backslashes, and NULL characters are escaped (add a backslash), which essentially calls the Addslashes function.

Why use Magic quotes

Convenient and quick

The design of PHP designers at the beginning of the idea is to be able to quickly and easily programming. For example, when inserting a database, Magic quotes automatically escapes data, which is convenient.

Good for Beginners

Magic quotes can, to some extent, allow beginners to take away the security risks of scripting. For example, in the absence of any protection code, open Magic quotes will be a lot less risk, such as injection problems. Of course, a single use of this method does not completely prevent this type of security issue.

"I have no authority to close."

Obviously you may already be aware of the problem, but the host space is not entirely controlled by itself.

Why not use Magic quotes

Portability

Regardless of whether this feature is turned on, it affects the portability of the script because it affects the subsequent operation of filtering data.

Performance issues

is escaped before fetching all the external data, which undoubtedly increases the cost of the runtime (and not all data needs to be escaped).

Cause confusion

As mentioned above, not all data needs to be escaped. One possible scenario is when you're "crazy" using the Stripslashes function to get data that is not escaped.

PHP6 has not supported

The designers of PHP are clearly aware of their "mistakes", so they have been discarded in PHP6.

How to disable Magic quotes

According to my point of view, using PHP.ini configuration file to disable Magic quotes is the most reliable. Refer to the following code

; Magic Quotes
;
; Magic quotes for incoming Get/post/cookie data.
MAGIC_QUOTES_GPC = Off
; Magic quotes for runtime-generated data, e.g. data to SQL, from exec (), etc.
Magic_quotes_runtime = Off
; Use Sybase-style Magic quotes (escape ' with ' instead of ').
Magic_quotes_sybase = Off

However, the online host may not be able to allow you to modify the php.ini file, you can use the. htaccess file to disable, add the following code

Php_flag MAGIC_QUOTES_GPC off

In the case of portable code above, data must be consistent regardless of whether or not magic_quotes is disabled. So the following code can help you

___fckpd___2
REQUEST = Array_map (' Stripslashes_deep ',

For Magic quotes, it is a commonplace question for phper. Today I accidentally see an article, combined with PHP Manual and its reply, here to do a simple summary.

In short, the input data is automatically escaped when the Magic quotes is turned on. where all single quotes ('), double quotes ("), backslashes, and NULL characters are escaped (add a backslash), which essentially calls the Addslashes function.

Why use Magic quotes

Convenient and quick

The design of PHP designers at the beginning of the idea is to be able to quickly and easily programming. For example, when inserting a database, Magic quotes automatically escapes data, which is convenient.

Good for Beginners

Magic quotes can, to some extent, allow beginners to take away the security risks of scripting. For example, in the absence of any protection code, open Magic quotes will be a lot less risk, such as injection problems. Of course, a single use of this method does not completely prevent this type of security issue.

"I have no authority to close."

Obviously you may already be aware of the problem, but the host space is not entirely controlled by itself.

Why not use Magic quotes

Portability

Regardless of whether this feature is turned on, it affects the portability of the script because it affects the subsequent operation of filtering data.

Performance issues

is escaped before fetching all the external data, which undoubtedly increases the cost of the runtime (and not all data needs to be escaped).

Cause confusion

As mentioned above, not all data needs to be escaped. One possible scenario is when you're "crazy" using the Stripslashes function to get data that is not escaped.

PHP6 has not supported

The designers of PHP are clearly aware of their "mistakes", so they have been discarded in PHP6.

How to disable Magic quotes

According to my point of view, using PHP.ini configuration file to disable Magic quotes is the most reliable. Refer to the following code

; Magic Quotes
;
; Magic quotes for incoming Get/post/cookie data.
MAGIC_QUOTES_GPC = Off
; Magic quotes for runtime-generated data, e.g. data to SQL, from exec (), etc.
Magic_quotes_runtime = Off
; Use Sybase-style Magic quotes (escape ' with ' instead of ').
Magic_quotes_sybase = Off

However, the online host may not be able to allow you to modify the php.ini file, you can use the. htaccess file to disable, add the following code

Php_flag MAGIC_QUOTES_GPC off

In the case of portable code above, data must be consistent regardless of whether or not magic_quotes is disabled. So the following code can help you

___fckpd___2
REQUEST);
}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.