Solved

button or link that runs exec commands

Posted on 2004-03-24
3
443 Views
Last Modified: 2013-11-18
Hoi,

I have 5 exec comamnds like

<?php
echo exec('/tmp/run/example1.sh');
?>

How can I make a page where you ckick to activate the scripts, I don't have
GD so it can be text based.

Now it runs the scripts when the page is loaded, and that is not what I want.

Jeffeny
0
Comment
Question by:harryv
  • 2
3 Comments
 
LVL 33

Expert Comment

by:snoyes_jw
ID: 10669601
Separate files:

index.html:
<a href="mypage1.php">click</a>
<a href="mypage2.php">click</a>

mypage1.php:
<?php
echo exec('/tmp/run/example1.sh');
?>

mypage2.php:
<?php
echo exec('/tmp/run/example2.sh');
?>
0
 

Author Comment

by:harryv
ID: 10670000
Hi,

I had that one as last option in mind but what I need is one page whitout opening new pages.
Just klik one a link or (better an image but text is also good) and that the script is running then.

Best regards,

Jeffeny
0
 
LVL 33

Accepted Solution

by:
snoyes_jw earned 125 total points
ID: 10670071
Use a frame or a separate window, and change the target of the link accordingly.

Alternatively, have the page submit to itself, something like this:

<?php
switch($_GET['link'])
{
    case 1: echo exec('/tmp/run/example1.sh');
    break;
    case 2: echo exec('/tmp/run/example2.sh');
    break;
}
// or, instead of a switch, you could use this if numbered correctly:
// if(is_set($_GET['link']))
// echo exec('/tmp/run/example' . $_GET['link'] . '.sh');
?>
<a href="thispage.php?link=1">Click</a>
<a href="thispage.php?link=2">Click</a>

0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question