Link to home
Start Free TrialLog in
Avatar of Simon336697
Simon336697Flag for Australia

asked on

PHP and perl parameter question

Hi guys.

I have the following php page.

------------------------------------------------------------------------- test.php
echo shell_exec('perl e:\ --server serverB --datacenter "name" --username domain\username --password "password"');

When the above is run, it produces some output about serverB on the page.

What I have done in this php page is hardcode the following parameters:
the datacenter
the username
the password

That is, the
--server parameter is hardcoded with serverB,  the
--datacenter parameter is hardcoded with name, the
--username parameter is hardcoded with domain\username, and the
--password is hardcoded with password
so that when test.php loads, it always executes against these settings.

If I want to change for example, the --server parameter to point to another server, I have to manually change it within test.php itself, so if I wanted for example, to run against serverC, Id have to open up the file and do...

<?php                                                                          |change here|
echo shell_exec('perl e:\ --server serverC --datacenter "name" --username domain\username --password "password"');

What ideally would be great is the following....

--------------------------------------------------------------------------------- launch test.php

Please enter a server name to run against ______________  
Enter a datacenter _______________
Enter a username ______________
Enter a password _______________

Run the script <Button to launch>

So, I could enter in any server name in the textbox, and this would be inserted after --server as part of the perl script, and so on for the other parameters.
Also, all textboxes MUST be filled out before the script will be launched, so some kind of validation.
And, outputting an error of the perl script, for example, at a command line if i run, I would get an invalid password error if the password was wrong. It would be great to have this output on the page.

Any help greatly appreciated.
Avatar of Roonaan
Flag of Netherlands image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Simon336697


Hi Roonaan youre a genius..
Roonaan, im getting an error though...

Fatal error: Call to undefined function htlmspecialchars() in C:\wamp\www\testing01.php on line 5
When I load the page, I get...
------------------------------------------------------ testing01.php

Server: <br  Fatal error: Call to undefined function htlmspecialchars() in C:\wamp\www\him.php on line 5
I cant for the life of me work out what is wrong with...

<form method="post" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>">
Server: <input type="text" name="server" value="<?php echo htlmspecialchars(@$_POST['server']); ?>" /><br/>
The text box on page load is being populated with...


Just <br