Computing.Net > Forums > Web Development > running bash commands on web pages

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

running bash commands on web pages

Reply to Message Icon

Name: surfistadesampa
Date: September 5, 2006 at 08:49:02 Pacific
OS: LINUX RED HAT 7.1
CPU/Ram: Pentium III
Comment:

Hi people,

I have a big problem ...

Well, I have a Web Server, running in a linux system ...

Imagine that you type: www.caca.com.br/index.html

This page contains a field and a botton:

Type or name: xxxxxxxxxxxx

Botton: Search

Then, when I click in botton (called Search), a script (shell script) will be executed and the result(output) will be showed on the screen ...

Does anyone know how can I do this code ? I will use HTML or any other ?

Thanks




Sponsored Link
Ads by Google

Response Number 1
Name: Laler
Date: September 5, 2006 at 14:07:33 Pacific
Reply:

can't do that with html only.

in PHP, you can use a couple functions to work with console commands.

Here a sample with system(), which will only return the last line from the result.

-----


A little more detailed:

You need to create a page which will display the form, with a text-input field and a button (search).

Then you do this in the form's target:

<?php

$result = exec('locate' . $_POST['query']);

// Now $result will contain the last line from
// the result of the 'locate' command.


?>


---


0

Response Number 2
Name: Laler
Date: September 5, 2006 at 14:11:39 Pacific
Reply:

whoops.

exec() is supposed to be system().

exec() is more suitable as it can be filled with every line from the result, but you should look at system() first if you're not familiar with html/php... Then you can click another similar command on the bottom of the system()'s manual page above, to look at other useful PHP commands.

---


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: running bash commands on web pages

Objects moving on web page www.computing.net/answers/webdevel/objects-moving-on-web-page/994.html

Viewing index of web page www.computing.net/answers/webdevel/viewing-index-of-web-page/1749.html

web page positioning www.computing.net/answers/webdevel/web-page-positioning/1878.html