Since the birth of the Internet, website security has always been with us. In particular, the security of website data is particularly important. As a mature programmer, the processing of website data is particularly important.
Course playback address: http://www.php.cn/course/394.html
The teacher’s teaching style:
The teacher’s lectures are simple, clear, layer-by-layer analysis, interlocking, rigorous argumentation, rigorous structure, and use the logical power of thinking to attract students’ attention Strength, use reason to control the classroom teaching process. The teaching skills are full of wit. Various teaching methods and techniques are readily available and can be used freely and appropriately without any trace of polishing.
The more difficult part in this video should be: URL encoding encryption technology:
URL encoding encryption technology
The two functions urlencode and urldecode are related. On the contrary, urlencode encodes and encrypts data, and urldecode encodes and decrypts data.
The specific content of the urlencode function is as follows:
string urlencode ( string $str ) str
The string to be encoded.
Return value:
Returns a string. All non-alphanumeric characters in this string except -_. will be replaced with a percent sign (%) followed by two tens Hexadecimal numbers, spaces are encoded as plus signs (+). This encoding is the same as the encoding method of WWW form POST data, and the same as the media type encoding method of application/x-www-form-urlencoded. For historical reasons, this encoding differs from the RFC3896 encoding (see rawurlencode()) in encoding spaces as plus signs (+).
The main functions of urlencode:
First, it is usually used to hide plain text data
<?PHP $url = 'admin.php?act=zhongguo&tx=123'; echo urlencode($url); ?>
admin.php%3Fact%3Dzhongguo%26tx%3D123 ?=> %3F = => %3D % => %25 & => %26 \ => %5C
urlencode() will encode the string, as for which characters it is used for Special encoding has been mentioned when introducing the urlencode function above.
Second, encode the data submitted for GET
Perhaps you have not encountered the following situation:
admin.php?act=del&add&data=abcd
Seeing this, everyone may start to complain, Axi! What is the act of this thing, del or del&add? What to do? Here we can use URL encoding to deal with this problem. By encoding del&add, act can be equal to del&add,
<?php $str = 'del&add'; $url = 'admin.php?act='.urlencode($str).'&data=abcd'; echo $url; ?>
admin.php?act=del%26add&data=abcd
In this way, we can get the data we want to transmit, so we can divide It’s very clear
Then there is urldecode
string urldecode ( string $str )
Just decrypt the urlencode encoded data
There is also rawurlencode() and rawurldecode() function, they just have different character encoding results.
The string returned after the two of them are used. The sequence of percent signs (%) followed by two hexadecimal numbers in this string will be replaced with literal characters.
The above is the detailed content of Recommended resources for PHP encryption technology video tutorials. For more information, please follow other related articles on the PHP Chinese website!