<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/athena/bin/perl

$locdb = "/var/local/www/data/bhadb";
require 'parseform.pl';

#print "Content-type: x-application/bha\n\n";
print "Content-type: text/plain\n\n";

&amp;readlocdb;
%data = &amp;parseform($ENV{'QUERY_STRING'});
$cmd = $ENV{'PATH_INFO'};
$cmd = substr($cmd, 1);
&amp;$cmd();
&amp;writelocdb;

sub readlocdb {
    open(DB, $locdb);
    while(&lt;DB&gt;){
	($user, $location) = split;
	$loc{$user} = $location;
    }
    close(DB);
}

sub SETLOC {
    $loc{$data{"user"}} = $ENV{'REMOTE_HOST'}.":".$data{'port'};
}

sub REQLOC {
    print $loc{$data{"user"}};
}

sub CONPONG {
}

sub REMLOC {
    undef $loc{$data{"user"}};
}

sub writelocdb {
    open(DB, "&gt;$locdb");
    foreach $u (keys %loc){
	print DB "$u $loc{$u}\n";
    }
    close(DB);
}
</pre></body></html>