PHP Classes

Variable not used

Recommend this page to a friend!

      Firewall  >  All threads  >  Variable not used  >  (Un) Subscribe thread alerts  
Subject:Variable not used
Summary:$ip variable in isAllowed method
Messages:2
Author:emulienfou
Date:2011-09-11 13:17:52
Update:2011-09-11 14:08:35
 

 


  1. Variable not used   Reply   Report abuse  
Picture of emulienfou emulienfou - 2011-09-11 13:17:53
The $ip variable in this method is not used :
final public function isAllowed($ip){
$this->matched_rule="";
$rules=$this->code_rules;
// first check allowed arrays. if not results, check denied array. if not results return true;
if(!empty($rules['allow'])) {
if(eval($rules['allow'] . "return false;")) {
$this->matched_rule=$rule_finded;
return true;
}
}

if(!empty($rules['deny'])) {
if(eval($rules['deny'] . "return false;")){
$this->matched_rule=$rule_finded;
return false;
}
}
return true;
}

normally ?

  2. Re: Variable not used   Reply   Report abuse  
Picture of Temperini Mirko Temperini Mirko - 2011-09-11 14:08:35 - In reply to message 1 from emulienfou
Hi,

the variable is not used, and it's just a typo in the design of the class.

I'm still working on a new version of the class can also use IPv6.

DO you want use `IsAllowed` to test other IP than the client IP?