Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Piatok, 16. október 2026

Rozdiely pre scripts/perl/accounting/netacct-stats.cgi medzi verziami 1.2 a 1.3

verzia 1.2, 2005/03/26 13:29:05 verzia 1.3, 2005/03/27 00:34:51
Riadok 12 
Riadok 12 
 # 2005-03-14 - created  # 2005-03-14 - created
 #  #
   
 # $Platon: scripts/perl/accounting/netacct-stats.cgi,v 1.1 2005/03/15 23:16:37 rajo Exp $  # $Platon: scripts/perl/accounting/netacct-stats.cgi,v 1.2 2005/03/26 13:29:05 rajo Exp $
   
 use strict;  use strict;
 umask 002;  umask 002;
Riadok 46  use vars qw (
Riadok 46  use vars qw (
         %query %cookie          %query %cookie
         $start_gener_time $output          $start_gener_time $output
         $template_data          $template_data
         @http_cookies @errors          @http_cookies @errors @messages
           $log_tables
 );  );
   
 sub print_output($$;);  sub print_output($$;);
Riadok 103  $user->{logged_in} = 1;
Riadok 104  $user->{logged_in} = 1;
   
 $template_data = {  $template_data = {
         errors          => \@errors,          errors          => \@errors,
           messages        => \@messages,
         query           => \%query,          query           => \%query,
 };  };
   
   $log_tables = $db->selectcol_arrayref("/* log_tables " . __FILE__ . ':' . __LINE__ . " */
            SHOW TABLES LIKE 'net_acct_20%'
   ");
   
 unless(defined $query{template}) {  unless(defined $query{template}) {
         $query{template} = 'intro';          $query{template} = 'intro';
 }  }
Riadok 133  if ($query{template} eq 'netacct/edit' o
Riadok 139  if ($query{template} eq 'netacct/edit' o
                 $template_data->{data}  = $admin->get_record($query{config_id}) if (defined $query{config_id});                  $template_data->{data}  = $admin->get_record($query{config_id}) if (defined $query{config_id});
         }          }
 } # }}}  } # }}}
   elsif ($query{template} eq 'netacct/delete') { # {{{
           $template_data->{delete_id} = $admin->delete_record($query{config_id});
           $query{template} = 'netacct/config';
   } # }}}
   elsif ($query{template} eq 'netacct/clearassign') { # {{{
           my $retval;
           foreach my $table (@$log_tables) {
                   $retval = $db->do("/* netacct/clearassign " . __FILE__ . ':' . __LINE__ . " */
                           UPDATE $table SET config_id = NULL
                           ");
                   push @errors, "There was a problem with updating table '$table': " . $db->errstr() unless $retval;
           }
           $query{template} = 'netacct/config';
   } # }}}
   elsif ($query{template} eq 'netacct/assign') { # {{{
           my $retval;
           my $data = $admin->get_data();
   
           my $update = $db->prepare("/* netacct/assign " . __FILE__ . ':' . __LINE__ . " */
                   UPDATE ? SET config_id = ?
                   WHERE
                           ip_proto = ?
                           AND (interface = ?              OR ? = '')
                           AND (source_ip = ?              OR ? = '')
                           AND (dest_ip = ?                OR ? = '')
                           AND (source_port = ?    OR ? = 0)
                           AND (dest_port = ?              OR ? = 0)
                   ");
           foreach my $i (1) {
                   $update->bind_param($i, 0, SQL_INTEGER);
           }
   
           foreach my $table (@$log_tables) {
                   push @messages, "Table $table:";
                   foreach my $entry (@$data) {
                           $update->execute(
                                   $table, $entry->{config_id},
                                   $entry->{ip_proto},
                                   $entry->{interface},    $entry->{interface},
                                   $entry->{source_ip},    $entry->{source_ip},
                                   $entry->{dest_ip},              $entry->{dest_ip},
                                   $entry->{source_port},  $entry->{source_port},
                                   $entry->{dest_port},    $entry->{dest_port}
                           ) or push @errors, "There was a problem with updating table '$table': " . $db->errstr();
                           push @messages, "\tEntry ID $entry->{config_id} matched " . $update->rows() . " rows.";
                   }
           }
           $query{template} = 'netacct/config';
   } # }}}
   
 if ($query{template} eq 'netacct/config') {  if ($query{template} eq 'netacct/config') {
         $template_data->{data} = $admin->get_data();          $template_data->{data} = $admin->get_data();

Legend:
Odstranené z verzie1.2  
zmenené riadky
  Pridané vo verzii1.3

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok