Hello,
I am trying to make a new PHP block, or static page to wake up other PCs on my LAN using MagicPackets. Right now I am trying to get it to work on a static page, but I would like it to be in a block later. I am using a static page because I figured it would work there without much trouble. However, it errors and I am not sure if it is syntax. I am not a PHP expert at all. If I place the php file in the doc root of my server, it works in stand alone mode. I will place the code below. Maybe someone could spot why it errors in Geeklog.
I have tried with both execute php and execute php (return).
When I paste this code into the static page and chose execute PHP, this error appears when I try to view it:
Parse error: parse error in /var/www/html/home2/staticpages/index.php(59) : eval()'d code on line 1
It seems like it does not like this tag:
Nothing errors when I select (return), but no select option dropdown appears either.
Thanks a lot for any help.
Regards,
Rick
Here is the full code of the working standalone PHP page:
Text Formatted Code
<?php
/*
** CVS info: $Id$
** ---------------------------------------------------------
*/
/****************************
** Configuration section **
****************************/
// List of hosts
$hosts = array(
"Carolines(FTP)" => "00:e0:29:3d:bd:84",
"Ninas" => "00:01:03:11:97:3b",
"Bereks" => "00:10:dc:e4:8f:21",
"Rick2" => "00:04:23:1b:a5:b8",
);
// Set this to the location of the perl executable
$perlexec = "/usr/bin/perl";
// Set this to the location of the perl script to execute
$perlscript = "/srv/www/cgi-bin/wakeup.pl";
/***********************************
** The stuff that makes it work **
***********************************/
if ($mac != "")
{
system($perlexec." ".$perlscript." ".$mac);
}
?>
<html>
<head>
<title>Berek's WOL front</title>
</head>
<body>
<form action="<?php print($PHP_SELF) ?>" method="post">
<table>
<tr>
<td>
<select name="mac">
<option value="">Select host to wake up:
<?php
foreach ($hosts AS $hostname => $macaddress)
{
print(" <option value="".$macaddress.""> ".$hostname);
}
?>
</select>
</td>
<td><input type="submit" value="GO!"></td>
</tr>
</table>
</form>
</body>
</html>