For security reasons, you can open the Safe mode of the "php.ini" file, set "Safe_mode=on", and display the "display_erros" option for PHP execution error messages if it is turned on, it will return a lot of available information to the intruder, so
Basic error handling: Using the Die () functionThe first example shows a simple script that opens a text file:
The code is as follows
Copy Code
$file =fopen ("Welcome.txt", "R");?>
If the file does not exist,
1: Basic Type,Include $module. '. PHP '; $module If you get it directly, then this is a very destructive bug, Linux makes you miserable, Windows let you dump production, such security will be directly discovered by people, and effectively blocked.
The general idea of SQL injection attack
• Find SQL injection location;• Judge the background database type;• Determination of xp_cmdshell performance• Discovery Web Virtual directory• Upload asp,php,jsp Trojan;• Get admin privileges;
? PhpPHP
The code is as follows
Copy Code
Public Function Captcha () {$font _dir = $_server ["Document_root"]. "Your_ttf_file.ttf"; Font Library$img _w = 58; Set Picture width$img _h = 20; Set Picture height$font _size = 11; Font size$angle _
/** Auth_code () is a validation code function* @access Public* @param int $width Indicates the length of the verification code and defaults to 80* @param int $height Indicates the height of the verification code, and defaults to 20* @param int $num
There are built-in functions available in PHP for the escape of some common output destinations, including clients, database tutorials, and URLs.If you want to write your own algorithm, it is important to be foolproof. You need to find a reliable
We just need to add in the PHP tutorial. ini
Disable_functions =phpinfo
PHP.ini introduces a feature disable_functions, which is useful and can be used to disable some functions. For example, in php.ini, add disable_functions = PassThru exec
The disabled methods are as follows:Open the/etc/php.ini file,Search to locate this line
1.disable_functions =
Add the name of the function you want to disable, for example:
The code is as follows
Copy Code
Example, session method
code is as follows
copy code
if ($_post) { if ($_session["token"]!=$_post["token"]) { die ("illegal submission!") "); }else{ echo "secure submission!"; } } $
Instance
The code is as follows
Copy Code
/*** Generate signature content based on original text** @param string $data original content** @return String*/function sign ($strData){$filePath = ' test.pfx ';if (!file_exists (
A UUID is a number generated on a single machine that guarantees that all machines in the same space-time are unique. Typically, the platform provides APIs for generating UUID. The UUID, based on the standard calculations developed by the Open
The following is the original description in php.ini and the default configuration:; Open_basedir, if set, limits all file operations to the defined directory; and below. This directive makes most sense if used in a per-directory or; Per-virtualhost
Suppose the PHP directory is/usr/local/phpMySQL directory for/usr/local/mysql1. Enter the PHP source code package EXT/PDO Directory
CD Ext/pdo
2. Execute/usr/local/php/bin/phpize[assume that the installation directory for PHP is/usr/local/php]
1. Install Phpize (if it is compiled with PHP source code is free, itself)
2. Open the PHP source code, EXT has Ext_skel tools, use it can be convenient
./ext_skel--extname = Myext
After you build the extended framework, you need to
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