Understanding and analysis of phpmagic_quotes_gpc. "The process of learning is to constantly discover and correct errors! For average people, the first two paragraphs can be viewed. MagicQuot blkyao says, "the learning process is to constantly
PHP string-encoding and escaping. Because PHP programs often interact with HTML pages, Web addresses (URLs), and databases, PHP provides some functions to help you process these types of data. HTML, webpage addresses, and database commands are
Ec (2); phpaddslashes the description string is equivalent to an automatic (string $ Strait) that needs to be queried in the database before being returned. These characters are single quotes (), string backslash (& ldquo;), backslash (), and NUL
After repeated writes to the database, the same query statement cannot be queried. & lt ;? Phpset_time_limit (0); & nbsp; $ filepath =$ _ GET ['uploadfile']; require_once & nbsp ;'.. /conn. php '; after error_re is repeatedly written to the database,
Important Functions of PHP
Added up--Author: zccst
8, String Base64_encode (string data);
This function encodes a string in MIME BASE64. This encoding allows Chinese text or pictures to be transferred smoothly on the network. The BASE64 encoded
Specific usage
addslashes Preventing SQL injection
Although many PHP programmers in the country still rely on addslashes to prevent SQL injection, it is recommended to strengthen Chinese to prevent SQL injection check. The problem with addslashes
The day before yesterday to make a blog post a content batch modification, due to bug in the source program, resulting in a lot of path or code in the anti-slash is innocent removal, yesterday through the bankw3000 Netizen's message found this
Important functions of PHP are much less Accumulated-author: zccst8, stringbase64_encode (stringdata); this function encodes strings with MIMEBASE64. This encoding method enables smooth transmission of Chinese text or images over the network. The
The day before yesterday, Tianyuan made a batch modification to the content of his blog post. due to bugs in the source program, many backslashes in the path or code were removed. this problem was discovered only yesterday when bankw3000 posted a
"The learning process is to constantly discover and correct errors," said blankyao ";
Let's take a look at what I said in the manual!
For average people, just look at the first two paragraphs.
Magic quotes
Code:Magic quotes is a process
SQL injection with MySQLThe author of this article: AngelArticle Nature: OriginalRelease Date: 2004-09-16This article has been published in the "Hacker defense" July issue, reproduced please specify. As a result of writing for a long time,
Using php5.3 or above we can use PDO and mysqli to process data directly
1. Use PDO (PHP Data Objects)
The code is as follows
Copy Code
$stmt = $pdo->prepare (' SELECT * FROM employees WHERE name =: Name
Blankyao said that "the process of learning is to constantly find mistakes, constantly correcting errors";
Let's see what the manual says!
For the average person, just take a look at the first two paragraphs.
Magic Quotes
Code:
Magic Quotes is a
When the user submits the form, some users will submit some special characters,such as single quote double quotes, at this point,If you insert the database directly as a normal string,The database may not be inserted correctlyPdo::quote to escape
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.
"One, server-side Configuration"Security, PHP code writing is on the one hand, PHP configuration is very critical.We PHP hand-installed, PHP default configuration file in/usr/local/apache2/conf/php.ini, we mostly want to configure the content in PHP.
For server configuration level protection, should ensure that the production environment webserver is to turn off the error message, such as PHP in the production environment configuration file php.ini Display_errors should be set to off, so that
SQL injection attacks are the most common means for hackers to attack websites. If your site does not use strict user input tests, it is often vulnerable to SQL injection attacks. SQL injection attacks are usually implemented by submitting bad data
Php function code for SQL injection and escape. SQL injection: Normally: delete. php? Deletefromnewswhereid. $ _ GET [id]; malicious situation: delete. php? Deletefromnewswhereid3or1; --- SQL injection:
Under normal circumstances:
Delete. php? Id =
The default session validity period in PHP is 1440 seconds (24 minutes) [weiweiok note: the default value in php5 is 180 minutes]. That is to say, if the client does not refresh for more than 24 minutes, the current session will become invalid.
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.