in reply to Ping from HTML
This seems like an excellent job for Java, given a recent post here with the title Java is the machine that goes "Ping!".
Sorry, absolutely off topic and not helpful at all, but I really couldn't resist ;-)
Given that you need an entry in the syslog, you'll have little choice but server side logic, I'd think. That means writing a simple CGI script. Here's a quick and dirty hack that shows the basic things to do. Cleaning it up is left as an exercise to the reader. Obviously the first thing to change is the $ping_cmd which is right for my Windows box but probably wrong for your machine.
No syslog entry though since you don't specify what OS this is supposed to run under. Have a look at CGI::Carp error redirection for a possible approach.
The HTML code to call it for a specific IP address would look like
<a href="http://www.you.com/cgi-bin/ping.pl?ip=131.133.33.18">131.133. +33.18</a>
Hope this helps, -gjb-
Update: As IlyaM points out, there are a number of security holes in this code. I'm not a web programmer (well, not since CGI.pm was invented), so I'd better refrain from answering web related questions. The first problem he mentions is very bad, I wouldn't have done that when I wrote CGI scripts years ago. I'll leave the code as is for educational purposes, but don't use it without heeding IlyaM's advice in the reply below.
#!perl use strict; use warnings; use CGI qw( :standard ); use CGI::Carp qw( fatalsToBrowser ); my $ping_cmd = 'c:/WINNT/system32/ping'; my $query = CGI->new(); my $param = $query->Vars(); print header(); print start_html("Ping page"); if (exists $param->{ip}) { my $result = `$ping_cmd $param->{ip}`; print p("You try to ping $param->{ip}, the result is:", br(), pre($result)); } else { print p("No ip address specified in query"); } print end_html();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Ping from HTML
by IlyaM (Parson) on Jan 06, 2003 at 13:26 UTC | |
by shotgunefx (Parson) on Jan 06, 2003 at 14:19 UTC | |
by IlyaM (Parson) on Jan 06, 2003 at 14:40 UTC | |
by shotgunefx (Parson) on Jan 06, 2003 at 14:47 UTC | |
by IlyaM (Parson) on Jan 06, 2003 at 14:51 UTC | |
|
Re: Re: Ping from HTML
by davorg (Chancellor) on Jan 06, 2003 at 13:09 UTC |