LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-04-2005, 10:23 PM   #16
fbfd1338
LQ Newbie
 
Registered: Mar 2004
Location: Motor City, MI
Distribution: Redhat 7.3
Posts: 12

Original Poster
Rep: Reputation: 0

I run a small game server, and with this server there are numerous scripts that do different things to or for the server. I want to be able to allow my admin staff to be able to run some of these scripts, while not giving them access to an actual command line. If you could do something similar to what was posted before with a menu similar to :

1. Execute Script A
2. Execute Script B

(Q)uit

Where if the person presses 1, it would ask if you were sure to execute, then if you select yes, executes the script. "Q" would cause the person to quit.

Alternatively if there was a way I could add buttons to my password protected admin website that would execute the scripts via a web based system that would work also.
 
Old 04-05-2005, 07:22 AM   #17
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
That's not hard...

1. form.html :
PHP Code:
<form action="script.php" method="POST">
    <
input type="submit" name="ScriptA" value="Click to start script A">
    <
input type="submit" name="ScriptB" value="Click to start script B">
</
form
2. script.php :
PHP Code:
<?php
// set the path to scripts here
$scriptA "/path/to/scriptA";
$scriptB "/path/to/scriptB";

if(isset(
$_POST["ScriptA"])) {
    
$output=shell_exec($scriptA);

} elseif(isset(
$_POST["ScriptB"])) {
    
$output=shell_exec($scriptB);

} else {
    
$output "Error, no script variable set";
}

echo 
"<pre>$output</pre>";
?>
Save both files in a directory and browse to form.html

Last edited by keefaz; 04-05-2005 at 07:23 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration