if ($result2) {
        $sql = "DELETE FROM counter_daily WHERE MinOfDay<{$minbeforeday}";
        $result = mysql_query($sql);
    }
}
$result = mysql_query("SELECT ID, ipfw_rule, IP, Mode, Enabled, Balans FROM users WHERE ID<>0");
while ($result && ($field = mysql_fetch_assoc($result))) {
    $user = $field["ID"];
    $ipfw_rule = $field["ipfw_rule"];
    $tp = $field["Mode"];
    $IP = explode(" ", $field["IP"]);
    if ($ipfw_rule) {
        $CountBytes = getUserBytes($user);
    }
    if (!$ipfw_rule || $CountBytes === false) {
        AddRule($user, $config['modes'][$tp]['fullspeed'], $IP[0]);
        $CountBytes = 0;
    } else {
        if ($CountBytes > 0) {
            $sql = "INSERT INTO counter_daily (UserID,MinOfDay,Bytes) VALUES({$user},{$MinOfDay},{$CountBytes})";
            $result2 = mysql_query($sql);
            if ($result2) {
                exec($ipfw . ' zero ' . $ipfw_rule);
            }
        }
    }
}
$sumBytes = array();
$result = mysql_query("SELECT ID, ipfw_rule, IP, Mode, Enabled, Balans FROM users WHERE ID<>0");
while ($result && ($field = mysql_fetch_assoc($result))) {
    $user = $field["ID"];
Exemplo n.º 2
0
 function SetDefaultRule($name)
 {
     if (isset($this->defaults->default_tag_rules[$name])) {
         AddRule($name, $this->defaults->default_tag_rules[$name]);
     } else {
         RemoveRule($name);
     }
 }
Exemplo n.º 3
0
 public function getRulesAttribute()
 {
     if ($this->rulesParsed) {
         return $this->rules;
         //Prevents 'required' and update IDS being added many times
     }
     if ($this->id) {
         //Existing record
         foreach ($this->unique as $value) {
             //Stops the unique values from ruining everything
             $this->rules[$value] = $this->rules[$value] . "," . $this->id;
         }
         $this->rules = AddRule($this->rules, $this->onUpdateRequired, 'required');
         //Need to require things after appending the ID
     }
     if (Request::method() == "POST" || Request::method() == "GET") {
         //Initial create
         $this->rules = AddRule($this->rules, $this->onCreateRequired, 'required');
         //return $this->rules; //DOn't add on things that aren't actual validation rules
     }
     $this->rulesParsed = true;
     return $this->rules;
 }