From: jdegraeve Date: Fri, 10 Feb 2006 15:44:23 +0000 (+0000) Subject: Convert volume array into normal vars, hopefully this fix the integer issue we curren... X-Git-Url: https://git.gsnw.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3802728752f8a1581145e4c89926a1105d245b0;p=m0n0chwall.git Convert volume array into normal vars, hopefully this fix the integer issue we currently are suffering from git-svn-id: https://svn.m0n0.ch/wall/trunk@83 e36fee2c-cc09-0410-a7cc-ebac5c6737de --- diff --git a/captiveportal/radius_accounting.inc b/captiveportal/radius_accounting.inc index 2ad5d25..9125835 100644 --- a/captiveportal/radius_accounting.inc +++ b/captiveportal/radius_accounting.inc @@ -32,7 +32,7 @@ This code cannot simply be copied and put under the GNU Public License or any other GPL-like (LGPL, GPL2) License. -settype($foo, "integer") + This code is made possible thx to samples made by Michael Bretterklieber author of the PHP PECL Radius package @@ -166,12 +166,11 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius $volume['output_gigawords'] = gigawords($volume['output_bytes']); // Make the volume data safe for our radius.inc functions (It really needs to be integer or we get an error) - settype($volume['input_pkts'], "integer"); - settype($volume['input_bytes_radius'], "integer"); - settype($volume['input_gigawords'], "integer"); - settype($volume['output_pkts'], "integer"); - settype($volume['output_bytes_radius'], "integer"); - settype($volume['output_gigawords'], "integer"); + // Working with an array to hold the data gives problems so we change them to normal vars + foreach ($volume as $var => $value) { + $var = $value; + settype($var, "integer"); + } switch($radiusvendor) { @@ -236,14 +235,14 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius $racct->putAttribute(RADIUS_CALLING_STATION_ID, $callingstationid); $racct->putAttribute(RADIUS_CALLED_STATION_ID, $calledstationid); - // Volume stuff: Ingress - $racct->putAttribute(RADIUS_ACCT_INPUT_PACKETS, $volume['input_pkts'], integer); - $racct->putAttribute(RADIUS_ACCT_INPUT_OCTETS, $volume['input_bytes_radius'], integer); - $racct->putAttribute(RADIUS_ACCT_INPUT_GIGAWORDS, $volume['input_gigawords'], integer); + // Volume stuff: Ingress (Note: remove the explicit integer if the type conversion works like we expect) + $racct->putAttribute(RADIUS_ACCT_INPUT_PACKETS, $input_pkts, integer); + $racct->putAttribute(RADIUS_ACCT_INPUT_OCTETS, $input_bytes_radius, integer); + $racct->putAttribute(RADIUS_ACCT_INPUT_GIGAWORDS, $input_gigawords, integer); // Volume stuff: Outgress - $racct->putAttribute(RADIUS_ACCT_OUTPUT_PACKETS, $volume['output_pkts'], integer); - $racct->putAttribute(RADIUS_ACCT_OUTPUT_OCTETS, $volume['output_bytes_radius'], integer); - $racct->putAttribute(RADIUS_ACCT_OUTPUT_GIGAWORDS, $volume['output_gigawords'], integer); + $racct->putAttribute(RADIUS_ACCT_OUTPUT_PACKETS, $output_pkts, integer); + $racct->putAttribute(RADIUS_ACCT_OUTPUT_OCTETS, $output_bytes_radius, integer); + $racct->putAttribute(RADIUS_ACCT_OUTPUT_GIGAWORDS, $output_gigawords, integer); if (!$interimupdate) $racct->putAttribute(RADIUS_ACCT_TERMINATE_CAUSE, $term_cause);