diff options
author | Kristian Lyngstol <kly@kly.no> | 2016-02-26 13:04:35 +0000 |
---|---|---|
committer | Kristian Lyngstol <kly@kly.no> | 2016-02-26 13:04:35 +0000 |
commit | c6997a4810e09619e9018c91d163f3f38b17212c (patch) | |
tree | c41dbd78a3d2602b6f60a6185a8826b2106cd360 /web | |
parent | 9ecc4690b2546ac117204207bec21ee1f6d585cf (diff) |
nms: Basic switches_add API
Needs lots of work.
And also, I removed CGI.pm because it sucks.
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(); |