| @@ 311-326 (lines=16) @@ | ||
| 308 | * |
|
| 309 | * @return bool |
|
| 310 | */ |
|
| 311 | public function write_file_bwlimit($expire) |
|
| 312 | { |
|
| 313 | $expire = min((int)$expire, time() + 300); |
|
| 314 | ||
| 315 | $fp = @fopen($this->get_filepath4bwlimit(), 'w'); |
|
| 316 | if ($fp) { |
|
| 317 | @flock($fp, LOCK_EX); |
|
| 318 | fwrite($fp, $expire . "\n"); |
|
| 319 | @flock($fp, LOCK_UN); |
|
| 320 | fclose($fp); |
|
| 321 | ||
| 322 | return true; |
|
| 323 | } else { |
|
| 324 | return false; |
|
| 325 | } |
|
| 326 | } |
|
| 327 | ||
| 328 | /** |
|
| 329 | * @return mixed |
|
| @@ 352-367 (lines=16) @@ | ||
| 349 | * |
|
| 350 | * @return bool |
|
| 351 | */ |
|
| 352 | public function write_file_badips($bad_ips) |
|
| 353 | { |
|
| 354 | asort($bad_ips); |
|
| 355 | ||
| 356 | $fp = @fopen($this->get_filepath4badips(), 'w'); |
|
| 357 | if ($fp) { |
|
| 358 | @flock($fp, LOCK_EX); |
|
| 359 | fwrite($fp, serialize($bad_ips) . "\n"); |
|
| 360 | @flock($fp, LOCK_UN); |
|
| 361 | fclose($fp); |
|
| 362 | ||
| 363 | return true; |
|
| 364 | } else { |
|
| 365 | return false; |
|
| 366 | } |
|
| 367 | } |
|
| 368 | ||
| 369 | /** |
|
| 370 | * @param int $jailed_time |
|