<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-NZ link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal>I try to determine some data externally through an PHP
programme with the ‘exec’ module.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Everything is fine as long as I do only return one value
from PHP, the return attribute is duly accepted and processed. <o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>As soon as I return more than one the exec module gets
confused, as everything is returned in one long string (see debug output). There
is no documentation in the echo or exec module as far as I can see, so I tried
spaces, \r\n, and commas ‘,’ as delimiters. Nothing worked.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Is this a limitation of the exec module, that it only
accepts one reply value back? The name of the parameter ‘output_pairs’
seems to suggest otherwise.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Can anyone advise on the proper delimitation of multiple
return values?<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>BTW, thanks everyone for all their help so far.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Debug output:<o:p></o:p></p>
<p class=MsoNormal>...<o:p></o:p></p>
<p class=MsoNormal>Tue Jan 13 13:38:40 2009 :
Debug: expand: %{User-Name} -> yubvef24<o:p></o:p></p>
<p class=MsoNormal>Tue Jan 13 13:38:40 2009 : Debug: Exec-Program output:
WISPr-Bandwidth-Max-Down := 256000 Reply-Message :=
"Connection speed has been reduced" WISPr-Bandwidth-Max-Up :=
32000 Reply-Message := "Connection speed has been
reduced"<o:p></o:p></p>
<p class=MsoNormal>Tue Jan 13 13:38:40 2009 : Debug: Exec-Program-Wait:
plaintext: WISPr-Bandwidth-Max-Down := 256000 Reply-Message :=
"Connection speed has been reduced" WISPr-Bandwidth-Max-Up :=
32000 Reply-Message := "Connection speed has been
reduced"<o:p></o:p></p>
<p class=MsoNormal>Tue Jan 13 13:38:40 2009 : Debug: Exec-Program: returned: 0<o:p></o:p></p>
<p class=MsoNormal>Tue Jan 13 13:38:40 2009 : Info: +++[maxspeedrestrict]
returns ok<o:p></o:p></p>
<p class=MsoNormal>...<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>PHP code creating the response:<o:p></o:p></p>
<p class=MsoNormal>...<o:p></o:p></p>
<p class=MsoNormal>$colname_Recordset1 = "-1";<o:p></o:p></p>
<p class=MsoNormal>if (isset($_ENV['USER_NAME'])) {<o:p></o:p></p>
<p class=MsoNormal> $colname_Recordset1 = substr($_ENV['USER_NAME'], 1,
strlen($_ENV['USER_NAME']) - 2);<o:p></o:p></p>
<p class=MsoNormal>}<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>$retval = 2;<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>mysql_select_db($database_chilli, $chilli);<o:p></o:p></p>
<p class=MsoNormal>$query_Recordset1 = sprintf("SELECT Value, op FROM
radcheck WHERE UserName = %s AND Attribute = 'Download-Speed-Restricted'",
GetSQLValueString($colname_Recordset1, "text"));<o:p></o:p></p>
<p class=MsoNormal>$Recordset1 = mysql_query($query_Recordset1, $chilli) or
die(mysql_error);<o:p></o:p></p>
<p class=MsoNormal>$row_Recordset1 = mysql_fetch_assoc($Recordset1);<o:p></o:p></p>
<p class=MsoNormal>$totalRows_Recordset1 = mysql_num_rows($Recordset1);<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>$query_Recordset2 = sprintf("SELECT Value, op FROM
radcheck WHERE UserName = %s AND Attribute = 'Upload-Speed-Restricted'",
GetSQLValueString($colname_Recordset1, "text"));<o:p></o:p></p>
<p class=MsoNormal>$Recordset2 = mysql_query($query_Recordset2, $chilli) or
die(mysql_error);<o:p></o:p></p>
<p class=MsoNormal>$row_Recordset2 = mysql_fetch_assoc($Recordset2);<o:p></o:p></p>
<p class=MsoNormal>$totalRows_Recordset2 = mysql_num_rows($Recordset2);<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>if ($totalRows_Recordset1 == '1') {<o:p></o:p></p>
<p class=MsoNormal> echo
'WISPr-Bandwidth-Max-Down '.$row_Recordset1['op'].'
'.$row_Recordset1['Value']." \r\n";<o:p></o:p></p>
<p class=MsoNormal> echo
'Reply-Message := "Connection speed has been
reduced"'."\r\n";<o:p></o:p></p>
<p class=MsoNormal> $retval
= 0;<o:p></o:p></p>
<p class=MsoNormal>} <o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>if ($totalRows_Recordset2 == '1') {<o:p></o:p></p>
<p class=MsoNormal> echo
'WISPr-Bandwidth-Max-Up '.$row_Recordset2['op'].' '.$row_Recordset2['Value']."
\r\n";<o:p></o:p></p>
<p class=MsoNormal> echo
'Reply-Message := "Connection speed has been
reduced"'."\r\n";<o:p></o:p></p>
<p class=MsoNormal> $retval
= 0;<o:p></o:p></p>
<p class=MsoNormal>}<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>if ($retval == '2') {<o:p></o:p></p>
<p class=MsoNormal> echo
'Reply-Message := "Time or Data allowance has been exhausted"';<o:p></o:p></p>
<p class=MsoNormal>} <o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>exit ($retval);<o:p></o:p></p>
<p class=MsoNormal>?><o:p></o:p></p>
</div>
</body>
</html>