PHP anti-theft Chain
The code is as follows
Copy Code
Session_Start ();Session_register (' check ');$_session[' Check ']=true;?>
Check session variables to determine whether to visit the home page. And check
The most common sight is probably
First set the MAGIC_QUOTES_GPC to On,display_errors set to off, and if the ID type, we use Intval () to convert it to an integer type, such as code:$id =intval ($id);
All right, let me introduce you to the basic
What is injection?
For example, when we query the database, we use the ID number of the article to retrieve all the information of this article. Then the SQL statement can be written like this:
The code is as follows
Copy Code
Nonetheless, the attacker still had the opportunity to perform a SQL injection attack ... The premise is that when the parameter is numeric and not processed by the intval () function, because after the processing of intval (), all data is coerced
PHP includes any other network programming language security, specifically in the local security and remote security two aspects, here we should develop the following habits to ensure that our PHP program itself is safe.1, to verify the user input
The MySQL tutorial _real_escape_string-the special characters in the string used in the escape SQL statement, taking into account the current character set of the connection.
But note: This function does not escape% and _. In addition, it is best
When you want to prevent page attacks, you can include an anti-attack file in the header of the page, like a generic anti-injection file. We can do this in three different ways:1, in each file reference. Such a document is OK, but it is inconvenient
Method one window to authenticate user login
The code is as follows
Copy Code
$admin _name= "admin";$admin _pawd= "admin";if ($php _auth_user!= $admin _name| | $php _auth_pw!= $admin _pawd){Header ('
Method filters HTML Custom functions
The code is as follows
Copy Code
function Ihtmlspecialchars ($string) {if (Is_array ($string)) {foreach ($string as $key => $val) {$string [$key] = Ihtmlspecialchars ($val);}} else
As we all know, all the library names are stored in the INFORMATION_SCHEMA library in the MySQL 5+, indicating the field name information. So the attack mode is as follows:
1. Determine whether the first character of the first table name is a A-Z
From an array of random out of n values, with Array_rand () can be easily implemented, when facing a large array, we will worry about his efficiency, performance problems.
I tested it, and when it was randomly taken out of 20 values in an array of
The four basic sorting algorithms are: Bubble sort method, fast sorting method, select sorting method, insert Sort method, this article we use PHP example to explain the four basic sorts. 1. Bubble sortTrain of thought analysis: In order to sort
Recently, a production of the server (CentOS 5.2 64-bit 4G memory), always appear in the Web site can not open, log on to the server to view, found Nginx and php-cgi are running, and usually different is at this time php-cgi CPU occupied 0,
PHP and AJAX XML tutorials
In an HTML formThe example above contains a simple HTML table and links to a javascript:
Select a CD:
bob dylan
bee gees cat stevens
CD info would be listed here.
For example to
The code is as follows:Copy code $ Urls = parse_url ($ db_bbsurl );$ Domain = $ urls ['host'];Include_once (R_P. 'Require/admvclient. Php ');$ Adm_oem = new Cnzz_Adm_Oem ();// Determine whether the user password exists in the config filePwCache:
Directory1. What are PEAR and Benchmark classes?2. Why should I analyze the PHP read and write cookies?III. Performance test codeIV. Performance test results5. Performance test summaryVI. setcookie function descriptionVII. Download performance test
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