PHP parse/syntax error?
My script is as follows:
<?php
$MYCFGMAKER_File = '/usr/etc/mrtg/mrtgd/bin/mycfgmaker';
$IP_Address = $_GET['ipaddress'];
$Community_String = $_GET['communitystring'];
$Poll_Interval = $_GET['pollinterval'];
$CFG_File = {$IP_Address}.cfg
$Execution_Code = <<<CODE
$MYCFGMAKER_File --ifref=name --ifdesc=descr --show-op-down --noreversedns --global 'PageTop[^]:<~--#include virtual="/header.html" -->' --global 'IconDir: /mrtg/gifs/' --global 'WriteExpires: Yes' --global 'Options[_]: bits' --global'WorkDir: /usr/local/httpd/htdocs/mrtgd-data' --global 'PathAdd: /usr/local/rrdtool/bin' --global 'LibAdd: /usr/local/rrdtool/lib/perl' --global 'LogFormat: rrdtool' --global '14all*maxrules[_]: 1' --global 'routers.cgi*Icon: cisco-sm.gif' --global 'WithPeak[_]: ymw' --global 'Interval: {$Poll_Interval}' --output=/usr/etc/mrtg/mrtgd/new/{$IP_Address}.cfg {$Community_String}@{$IP_Address}
CODE;
print 'PHP has assigned the variables and they are as follows:\n';
print "\nIP Address = $IP_Address\n";
print "SNMP Community String = $Community_String\n";
print "Polling Interval = {$Poll_Interval}min\n";
print "\n PHP will now attempt to run the MRTG \"mycfgmaker\":\n";
print "EXECUTING . . . $Execution_Code";
if (file_exists($MYCFGMAKER_File)) {
print "\"mycfgmaker\" exists, and will now attempt to gernerate your devices cfg file\n";
if (file_exists($CFG_File)) {
print "ERROR: {$IP_Address}.cfg already exists, and will not be overwritten!"
} else {
$cmd = $Execution_Code;
system($cmd,$return_value);
($return_value == 0) or die("returned an error: $cmd");
}
} else {
print "ERROR: \"mycfgmaker\" cannot intiate or does not exist. Please contact the server administrator.";
}
?>
When I run the script show above, I get a parse error on Line seven. Is there something with my code because as far as I know it should work.
|