Solved

button or link that runs exec commands

Posted on 2004-03-24
3
441 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
This article discusses how to create an extensible mechanism for linked drop downs.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now