diff options
author | Kristian Lyngstol <kristian@bohemians.org> | 2016-02-26 19:43:52 +0100 |
---|---|---|
committer | Kristian Lyngstol <kristian@bohemians.org> | 2016-02-26 19:43:52 +0100 |
commit | 63c2e8b35da1ee8de3bf9ff71ca4e25f7829dcec (patch) | |
tree | cd8630142da4e9e060d096fbb05d09f4ea379fc2 /web | |
parent | d60fa2b998aebf8e65b319f9322a76abfd0a2a9b (diff) | |
parent | 885156ee6a26ed047bba3f90541eaab92b65d758 (diff) |
Merge branch 'master' of github.com:tech-server/tgmanage
Diffstat (limited to 'web')
-rwxr-xr-x | web/nms.gathering.org/switches_add.pl | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/web/nms.gathering.org/switches_add.pl b/web/nms.gathering.org/switches_add.pl new file mode 100755 index 0000000..06edf66 --- /dev/null +++ b/web/nms.gathering.org/switches_add.pl @@ -0,0 +1,29 @@ +#! /usr/bin/perl +# vim:ts=8:sw=8 + +#use CGI qw(fatalsToBrowser); +use DBI; +use lib '../../include'; +use nms; +use nms::web qw(%get_params %json finalize_output get_input); +use strict; +use warnings; +use JSON; +use Data::Dumper; + +$nms::web::cc{'max-age'} = "0"; + +my $in = get_input(); +my %tmp = %{JSON::XS::decode_json($in)}; + +my $query = "INSERT INTO SWITCHES (ip, sysname, switchtype) VALUES('" + . $tmp{'mgtmt4'} . "','" + . $tmp{'name'} . "','ex2200');"; + +$json{'sql'} = $query; + +my $q = $nms::web::dbh->prepare($query); +$q->execute() || die "foo"; + + +finalize_output(); |