Introduction to PHP Tutorials-Database Tutorial operations
In this tutorial, we will build a small web site step-by-step, using the following features of PHP and MySQL:1. View the database;2. Edit the records of the database;3. Modify the records
Basic file include vulnerability:
The code is as follows
Copy Code
* Contains files under the same path:? file=.htaccess* Path Traversal:? file=. /.. /.. /.. /.. /.. /.. /.. /.. /var/lib/locate.db(This file is very
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
Discover that the current project is to put all the included files under the home directory, as shown in the following figure:
The site Directory is public, in addition to the entry file, all the source code and configuration files, are outside
Eval () has a lot of lethality for PHP security. In general, to prevent
The code is as follows
Copy Code
Usage examples
The code is as follows
Copy Code
$string = ' Cup ';$name = '
Intention:
Defines a one-to-many dependency between objects, and when the state of an object changes, all objects that depend on it are notified and automatically updated "GOF95"
Also known as publish-subscribe (publish-subscribe) mode, model-view
Simple Factory mode:
① abstract base class: class definition abstract Some methods to implement in subclasses② inherits from the abstract base class: Implementing an abstract method in a base class③ Factory class: Used to instantiate objects
One, read the file
First explain what is reading the file itself, what is called reading the file input. For example test.php inside the content
1, read the file itself is to read all the contents of the file, read it can get 2, read the file
1. Upload safe.func.php to the directory of the files to be included
2. In the page to add protection, there are two ways, according to the situation two choose one:
a). Add code to the page you want to protect
Require_once (' safe.func.php
The principle is to generate a random string in the session. Submitting the form later validates the string. You can prevent others from writing form to cheat submissions, repeat submissions, or double click Submit.
token.php
/** Created on 2013-3-
There is a need for the situation as follows:Two servers, a test server [Apache], a production server [Nginx], product editors use PHP upload in the test servers to upload products in bulk, pictures, after checking,Can synchronize its uploaded
In the development process, the return value type of the function should be invariant, but PHP is a weakly typed language. So PHP does not have this kind of syntax verification, because of this, caused a lot of pits. For example, the following code:
Array Array_map (callable $callback, array $arr 1 [, Array $ ...])
Array_map () returns an array that contains the cells of all cells in the arr1 after the callback function.
The number of arguments accepted by callback should be consistent with
A summary of the vulnerabilities in PHP website
Judging from the current network security, the most attention and contact with the most Web page vulnerability should be ASP, in this respect, small bamboo is an expert, I have no say. However, in PHP,
Can read/etc/passwd!
This paragraph.
[File Upload]
PHP automatically supports file uploads based on RFC 1867, let's look at the following example:
The above code allows the user to select a file from the local machine, and the file is uploaded
--js with PHP is a weakly typed language weakly typed language just does not display the performance definition variable when the system automatically gives defaultSo you can define variables when you define PHP variables.1:---------common
Sorting algorithms-Simple selection and sorting algorithms --
Simply select sorting, that is, execute the n-I comparison, and then select the smallest value from the n-I + 1 data. If the minimum value is not I (1 =
1 $ array [$ j]) {17 $ min = $ j;
1. ArrayThe array in the php Tutorial is actually an associated array, or a hash table. Php does not need to declare the array size in advance. You can create an array by directly assigning values. For example:// The most traditional method: Use
PhpMyAdmin lacks the mysqli extension. Check the PHP configuration solution:The mysqli extension is missing. Check the PHP configuration.Open your php. ini-> in the C: WINDOWS directory.Find The code is as follows:Copy code ; Extension =
1> error message The code is as follows:Copy code Warning: Cannot send session cookie-headers already sentWarning: Cannot send session cache limiter-headers already sent The cause is that when session_start () is used in the program, actual
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