#!/bin/perl use strict; use mysql; use CGI qw(:standard); my $edit = param('edit'); my $edit1 = param('edit1'); my $descr=param('descr'); my $hostn=param('hostname'); my $ipadd=param('ip'); my $rocom=param('roc'); my $rwcom=param('rwc'); my $snmpp=param('port'); my $dbh = DBI->connect("DBI:mysql:database=c2;host=localhost",'root','', {RaiseError => 1}); print header(); print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "Host editieren\n"; if ($edit eq "") { my $sth = $dbh->prepare("select ind,description,hostname,ip from hosts order by 'hostname'"); $sth->execute; print "
\n"; print "\n"; while (my $ref = $sth->fetchrow_arrayref()) { print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "\n\n"; print "
\n"; print "
\n"; } else { if ($edit1 eq "Edit") { my $sth = $dbh->prepare("select ind,description,hostname,ip,rw_community,ro_community,snmp_port from hosts where ind='$edit'"); $sth->execute; while (my $ref = $sth->fetchrow_arrayref()) { print "
\n"; print "\n"; print "\n\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
Description
Hostname
IP
RO-community
RW-community
SNMP-Port
\n"; print "\n"; print "\n"; print "
\n"; } } if ($edit1 eq "Speichern") { $dbh->do("update hosts set description='$descr', hostname='$hostn', ip='$ipadd', rw_community='$rwcom', ro_community='$rocom', snmp_port='$snmpp' where ind='$edit'"); #$dbh->do( print "
Gespeichert\n"; } #print "Löschen durchgeführt!"; } print "\n"; print "\n";