Private
Server IP : 195.201.23.43  /  Your IP : 18.222.97.243
Web Server : Apache
System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64
User : kdecoratie ( 1041)
PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/webmin/virtual-server/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /usr/share/webmin/virtual-server/bwreset.cgi
#!/usr/bin/perl
# Set the last scanned date for all domains back to the date selected, for
# selected features

require './virtual-server-lib.pl';
&ReadParse();
&error_setup($text{'bwreset_err'});
&can_edit_templates() || &error($text{'newbw_ecannot'});

# Validate inputs
$in{'date_d'} =~ /^\d+$/ || &error($text{'bwreset_eday'});
$in{'date_y'} =~ /^\d{4}$/ || &error($text{'bwreset_eyear'});
$time = eval { timelocal(0, 0, 0, $in{'date_d'}, $in{'date_m'}, $in{'date_y'}-1900) };
$time && !$@ || &error($text{'bwreset_edate'});
$date = $time/(24*60*60);
@features = split(/\0/, $in{'feature'});
@features || &error($text{'bwreset_efeatures'});
if ($in{'domains_def'}) {
	@doms = &list_domains();
	}
else {
	foreach $did (split(/\0/, $in{'domains'})) {
		$d = &get_domain($did);
		push(@doms, $d) if ($d);
		}
	}
@doms || &error($text{'bwreset_edoms'});

&ui_print_header(undef, $text{'bwreset_title'}, "");

# Update all bandwidth files in selected domains
print $text{'bwreset_doing'},"<br>\n";
foreach $d (@doms) {
	$bwinfo = &get_bandwidth($d);
	foreach $f (@features) {
		if ($bwinfo->{'last_'.$f} && $bwinfo->{'last_'.$f} > $time) {
			# Move last-processed time back to the reset point
			$bwinfo->{'last_'.$f} = $time;
			}
		foreach $k (keys %$bwinfo) {
			if ($k =~ /^\Q$f\E_(\d+)$/ && $1 >= $date) {
				$bwinfo->{$k} = 0;
				}
			}
		}
	&save_bandwidth($d, $bwinfo);
	}
print $text{'bwreset_done'},"<p>\n";

# Kick off bw.pl
print $text{'bwreset_running'},"<br>\n";
system("$bw_cron_cmd >/dev/null 2>&1 </dev/null &");
print $text{'bwreset_started'},"<p>\n";

&ui_print_footer("edit_newbw.cgi", $text{'newbw_return'},
		 "", $text{'index_return'});

Private