In order to prevent collection, really think a lot of ways, before the limit of IP, the current basic completion, the idea said: in the unit time, such as the number of pages browsed in a minute exceeds the limit, then wait, and finally when the total browsing page to reach the set limit of the day, the lock IP, still need further adjustment, Now consider adding random characters to the content page to disrupt the data collected by the collectors!
Attach two random strings of code, each has its own characteristics, see how you use to achieve reasonable results.
First paragraph:
function rand_string ($len =, $type = ", $addChars =") {
$str = ";
Switch ($type) {
Case 0:
$chars = ' abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz '. $addChars;
Break
Case 1:
$chars = Str_repeat (' 0123456789′, 3);
Break
Case 2:
$chars = ' abcdefghijklmnopqrstuvwxyz '. $addChars;
Break
Case 3:
$chars = ' abcdefghijklmnopqrstuvwxyz '. $addChars;
Break
Default:
By default remove easily confusing characters Ooll and number 01, to add please use Addchars parameter
$chars = ' abcdefghijkmnpqrstuvwxyzabcdefghijkmnpqrstuvwxyz23456789′. $addChars;
Break
}
if ($len > 10) {//bit too long repeat string a certain number of times
$chars = $type = = 1? Str_repeat ($chars, $len): Str_repeat ($chars, 5);
}
if ($type!= 4) {
$chars = Str_shuffle ($chars);
$str = substr ($chars, 0, $len);
} else {
Random word
for ($i = 0; $i < $len; $i + +) {
$str. = Msubstr ($chars, Floor (mt_rand (0, Mb_strlen ($chars, ' utf-8′) –1), 1);
}
}
return $str;
}
Echo rand_string ();
Second paragraph code:
function Generateweirdstr ($var) {
$table = ' abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789′;
$len =rand (30,30+ $var);
$text = ";
for ($i =0; $i < $len; $i + +) {
$ch = $table [rand (0,61)];
$text. = $i >0? ' | '. $ch: $ch;
}
return $text;
}
Echo Generateweirdstr (15);
With these two pieces of code, can achieve reasonable results!