#!/bin/perl

# get base URL

$server_name = $ENV{'SERVER_NAME'};
$script_name = $ENV{'SCRIPT_NAME'};
$script_name =~ s/\/ADMIN\/firsttime\.cgi$//;

$base_url = "http://$server_name$script_name";

open(LOCK,"config.lock") || die;  flock(LOCK,2);
open(CONFIG,"config");
open(CONSCR,">config.bak");
while(<CONFIG>) {
   s/baseurl/$base_url/o;
   print CONSCR;
}
open(CONFIG,">config");
open(CONSCR,"config.bak");
while(<CONSCR>) {
   print CONFIG;
}
###

print "Content-type: text/html\n\n";
print "Configuration of <A HREF=\"$base_url/list.cgi\">this board</A> is complete.\n";



