PluginProbe
Loginizer / 2.0.4
Loginizer v2.0.4
2.1.0 2.0.9 2.0.8 1.9.8 1.9.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 trunk 1.0 1.0.1 1.0.2 1.1.0 1.1.1 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 All 74 releases
← All changes | init.php +53 -14 2.0.72.0.4 View file →
@@ -4,9 +4,9 @@
4 4 echo 'You are not allowed to access this page directly.';
5 5 exit;
6 6 }
7 7
8 -define('LOGINIZER_VERSION', '2.0.7');
8 +define('LOGINIZER_VERSION', '2.0.4');
9 9 define('LOGINIZER_DIR', dirname(LOGINIZER_FILE));
10 10 define('LOGINIZER_URL', plugins_url('', LOGINIZER_FILE));
11 11 define('LOGINIZER_PRO_URL', 'https://loginizer.com/features#compare');
12 12 define('LOGINIZER_PRICING_URL', 'https://loginizer.com/pricing');
@@ -494,31 +494,26 @@
494 494
495 495 if(empty($blacklist)){
496 496 return false;
497 497 }
498 -
499 - $current_ip_inet = inet_ptoi($loginizer['current_ip']);
500 -
498 +
501 499 foreach($blacklist as $k => $v){
502 -
503 - $start_inet = inet_ptoi($v['start']);
504 - $end_inet = inet_ptoi($v['end']);
505 -
500 +
506 501 // Is the IP in the blacklist ?
507 - if($start_inet <= $current_ip_inet && $current_ip_inet <= $end_inet){
502 + if(inet_ptoi($v['start']) <= inet_ptoi($loginizer['current_ip']) && inet_ptoi($loginizer['current_ip']) <= inet_ptoi($v['end'])){
508 503 $result = 1;
509 504 break;
510 505 }
511 -
506 +
512 507 // Is it in a wider range ?
513 - if($start_inet >= 0 && $end_inet < 0){
508 + if(inet_ptoi($v['start']) >= 0 && inet_ptoi($v['end']) < 0){
514 509
515 510 // Since the end of the RANGE (i.e. current IP range) is beyond the +ve value of inet_ptoi,
516 511 // if the current IP is <= than the start of the range, it is within the range
517 512 // OR
518 513 // if the current IP is <= than the end of the range, it is within the range
519 - if($start_inet <= $current_ip_inet
520 - || $current_ip_inet <= $end_inet){
514 + if(inet_ptoi($v['start']) <= inet_ptoi($loginizer['current_ip'])
515 + || inet_ptoi($loginizer['current_ip']) <= inet_ptoi($v['end'])){
521 516 $result = 1;
522 517 break;
523 518 }
524 519
@@ -524,12 +519,56 @@
524 519
525 520 }
526 521
527 522 }
528 -
523 +
529 524 // You are blacklisted
530 525 if(!empty($result)){
531 526 $lz_error['ip_blacklisted'] = $loginizer['msg']['ip_blacklisted'];
527 + return true;
528 + }
529 +
530 + return false;
531 +
532 +}
533 +
534 +function loginizer_is_whitelisted(){
535 +
536 + global $wpdb, $loginizer, $lz_error;
537 +
538 + $whitelist = $loginizer['whitelist'];
539 +
540 + if(empty($whitelist)){
541 + return false;
542 + }
543 +
544 + foreach($whitelist as $k => $v){
545 +
546 + // Is the IP in the blacklist ?
547 + if(inet_ptoi($v['start']) <= inet_ptoi($loginizer['current_ip']) && inet_ptoi($loginizer['current_ip']) <= inet_ptoi($v['end'])){
548 + $result = 1;
549 + break;
550 + }
551 +
552 + // Is it in a wider range ?
553 + if(inet_ptoi($v['start']) >= 0 && inet_ptoi($v['end']) < 0){
554 +
555 + // Since the end of the RANGE (i.e. current IP range) is beyond the +ve value of inet_ptoi,
556 + // if the current IP is <= than the start of the range, it is within the range
557 + // OR
558 + // if the current IP is <= than the end of the range, it is within the range
559 + if(inet_ptoi($v['start']) <= inet_ptoi($loginizer['current_ip'])
560 + || inet_ptoi($loginizer['current_ip']) <= inet_ptoi($v['end'])){
561 + $result = 1;
562 + break;
563 + }
564 +
565 + }
566 +
567 + }
568 +
569 + // You are whitelisted
570 + if(!empty($result)){
532 571 return true;
533 572 }
534 573
535 574 return false;