[PHP] function 2. 1. copy the code to generate a random string function: functionrandom ($ length) {$ hash ##; $ chars # signature ##; $ maxstrl 1. Generate a random string function
The code is as follows:
Function random ($ length ){$ Hash = @#@#;
This article mainly introduces several practical PHP user-defined functions, and analyzes the PHP network operations, string operations, time operations, and regular expressions using examples, for more information about PHP user-defined functions,
PHP-based restricted IP voting program IP source analysis, ip voting. The IP address source of the restricted IP voting program implemented by PHP. in this article, we analyze the restricted ip voting program implemented by PHP. I would like to
I'm doing it. A parody of beauty said jquery+ajax+php implementation of the "Like" rating feature has now been done to click on the image "like" the number of changes.
When you click on a color picture, the picture becomes another gray, and the
One is the POST request function of curl, is mainly used for the development of Platform API, the processing function of the request interface, if you have multiple platforms, to pass data between each other, use this function absolutely useful:
192.168.1.1 Single IP
192.168.1.* such proxy 192.168.1.1-192.168.1-255
192.158.1.2-20 this is representative 192.158.1.2-192.158.1.20.
It is also possible to write 192.168.1. [1|2|3]
Hehe ~ a method does not know whether the idea is thoughtful, take
Fire Station College reproducedThe usual accumulation of PHP skills, share with you, there may be some very basic, but everyone has a short-circuit of the brain, often take out to turn over also no harm ...
If there is something wrong to point out,
PHP restricts IP segment access, prevents IP from submitting the form's code
Recently, the small series found that there is a Yunnan netizen often in help the home to publish some rubbish information comment, because www.bkjia.com system dedecms
Cold front: Both methods are available, the first to take advantage of the built-in curl support, and the second to be more generic. It is recommended to use the second type.
Method One: Curl
function Get_onlineip () {$ch = Curl_init (http://www.ip1
We just need to add the following code in the feedback.php to judge it.
Note: The following is just a PHP restricted IP instance code, if you intend to apply to the CMS, please modify it yourself, or if you are using DEDECMS, you can contact the
Some very useful PHP functions with high application frequency. generate a random string function 2. truncate a string of a certain length 3. obtain the client IP address 4. create a folder. determining the email address 7. paging (two functions
Common functions extracted from phpcmsv9 *** return the strings or arrays processed by addslashes * @ param $ string or strings to be processed * @ returnmixed * functionnew_addslashes ($ string) {?? If (! Is_array ($ string) returnaddslashes ($
"Turn" Super practical PHP Function Summary, practical PHP function Summary
Original link: http://www.codeceo.com/article/php-function.html
1, PHP encryption and decryption
PHP encryption and decryption functions can be used to encrypt some useful
To achieve the likes, stepping on the function needs some requirements:1. Record the user's IP, determine whether the user's voting behavior is valid according to IP2. Need two tables, one is to count the number of like and tread, one is a record
1
2 // Example use of getenv ()
3 $ ip = getenv ('remote _ ADDR ');
4 // Or simply use a Superglobal ($ _ SERVER or $ _ ENV)
5 $ ip = $ _ SERVER ['remote _ ADDR '];
6?>
This is the method provided by manual, the official PHP website.
However, when
Leng Feng: both methods are available. The first method must be supported by the built-in curl, and the second method is more common. The second type is recommended.Method 1: curl
Function get_onlineip (){$ Ch = curl_init
Function:1. Get the current IP address,2. Call Sina API to obtain the current city.3. Convert Chinese to Pinyin and then jump.
Copy codeThe Code is as follows:Include './pinyin. php ';
// Obtain the current ip AddressFunction getIp (){$ Onlineip = ''
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.