#!/usr/local/bin/perl
# list_conns.cgi
# List all active connections

require './pptp-server-lib.pl';
&ui_print_header(undef, $text{'conns_title'}, "", "conns");

@conns = &list_connections();
if (@conns) {
	print "<br>$text{'conns_desc'}<p>\n";
	print "<table border width=100%>\n";
	print "<tr $tb> <td><b>$text{'conns_iface'}</b></td> ",
	      "<td><b>$text{'conns_client'}</b></td> ",
	      "<td><b>$text{'conns_stime'}</b></td> ",
	      "<td><b>$text{'conns_local'}</b></td> ",
	      "<td><b>$text{'conns_remote'}</b></td> </tr>\n";
	foreach $c (@conns) {
		print "<tr $cb>\n";
		print "<td><a href='disc.cgi?pid=$c->[0]'>",
		      $c->[3] ? "<tt>$c->[3]</tt>" : $text{'conns_unknown'},
		      "</a></td>\n";
		print "<td><tt>$c->[2]</tt></td>\n";
		print "<td>",$c->[6] || $text{'conns_unknown'},"</td>\n";
		print "<td>",$c->[4] ? "<tt>$c->[4]</tt>"
				     : $text{'conns_unknown'},"</td>\n";
		print "<td>",$c->[5] ? "<tt>$c->[5]</tt>"
				     : $text{'conns_unknown'},"</td>\n";
		print "</tr>\n";
		}
	print "</table>\n";
	}
else {
	print "<br><b>$text{'conns_none'}</b><p>\n";
	}

&ui_print_footer("", $text{'index_return'});

