From c6997a4810e09619e9018c91d163f3f38b17212c Mon Sep 17 00:00:00 2001 From: Kristian Lyngstol Date: Fri, 26 Feb 2016 13:04:35 +0000 Subject: nms: Basic switches_add API Needs lots of work. And also, I removed CGI.pm because it sucks. --- web/nms.gathering.org/switches_add.pl | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 web/nms.gathering.org/switches_add.pl (limited to 'web') 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(); -- cgit v1.2.3