[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: execute command from HTML page



On Tue, Jan 15, 2002 at 08:31:36AM +0000, Hugh Saunders wrote:
> On Tuesday 12 November 2002 12:40 am, sean finney wrote:
> > just to chime in on this, you should think of the security implications
> > of what you're doing.  if you're putting a button on a webpage that
> > re-initializes your net connection, then anyone feeling particularly
> > riley could keep you without an internet connection.
> Yes, i would limit the availablity of the service to within the local network 
> as it would not be helpfull if outside users could down my link! 
> thanks for the input,
> 

Just recently I've done that trick with a web page; we have three
computers here, two with Linux and one with Windows. It's quite
simple for my girlfriend (let aside the security issues) to click on
a link in her default homepage to start or stop the connection.

Basically, if you're still interested, that is, you first create a
normal page with a link to the cgi script. Following the basic
apache configuration, you put it in the /var/www folder (check your
configuration for "DocumentRoot") and the script in
/usr/lib/cgi-bin (look for "ScriptAlias"), thus the page will be
accessible as, say, http://thehost/page.html. 
Add there a link to your script; if you follow the above procedure,
the link should point to /cgi-bin/script, which means
/usr/lib/cgi-bin (ScriptAlias). In your little script, call the
command to start/stop your connection. If you don't want to mix the
script with html, you can easily do it as follows:

#! /bin/bash
pon provider

echo -e "Location: http://thehost/conpage.html \n\n"

That's it, following this link, you'll start the connection and get
redirected to another page. Of course, that's not needed, as someone
has already pointed out, the script could end with the pon command,
and you could type the location as http://thehost/cgi-bin/script to
start it without further ado.


	andrej

-- 
echo ${girl_name} > /etc/dumpdates



Reply to: