#!/usr/local/bin/perl if ($ENV{'SERVER_PORT'} eq "443") { print "Location:http://www.flash.net/domains\n\n"; } use Fcntl; use DB_File; read(STDIN,$in,$ENV{'CONTENT_LENGTH'}); @in = split(/&/,$in); foreach $i (0 .. $#in) { $in[$i] =~ s/\+/ /g; ($key, $val) = split(/=/,$in[$i],2); $key =~ s/%(..)/pack("c",hex($1))/ge; $val =~ s/%(..)/pack("c",hex($1))/ge; $in{$key} .= "\0" if (defined($in{$key})); $in{$key} .= $val; foreach (keys %in) { $in{$_} =~ tr/"/ /; } } $in{'domain'} =~ /(^.+)/; $domain = $1; $serveralias = $in{'serveralias'}; if ($domain) { &get_info; } else { &startup; } ######################################################################## sub print_header { print "Content-type: text/html \n\n"; print <<_EOF_; Adding that Domain
FlashNet Communications _EOF_ } ######################################################################## sub startup { &print_header; print <<_EOF_;

- IP address to Add

- rootdir

- server name

Enable logging



_EOF_ exit; } ######################################################################## sub get_info { &print_header; $nslookup = `nslookup $domain`; #unless ($nslookup =~ /209\.30\.0\.12/) { # print <<_EOF_; #

$domain

#
#This domain does not appear to be hosted by FlashNet and therefore will not #be added to the DB. #
#$nslookup
#
#_EOF_ #&printfooter; #} $rootdir = $in{'rootdir'}; $logging = "n" unless $in{'logging'}; unless (-e $rootdir) { print <<_EOF_;

$domain


Sorry, can't do it.... I do not show that the root directory
$rootdir;
actually exists, therefore I will not add the domain.... _EOF_ &printfooter; } print <<_EOF_;

$domain


_EOF_ #$db_file = "/home/httpd/conf/domains.db"; #$db_obj = tie(%data, 'DB_File', $db_file, O_RDWR, 0666) or print $!; #if ($data{$domain}) { # print "I show that the domain, $domain, already exists on our server."; # print "If you need to make a change, go there..."; # #} else { print "OK, looks like you have a good one...."; print " I have added the domain with the following info, if it isn't correct"; print " try the Change Domain link."; $h = $domain; #$host; $serveraliases = $domain; $first = substr($h,0,1); $log_name = "${h}_log"; $access_log = "domain_logs/$first/$log_name"; #$serveralias = (split(' ',$serveraliases))[0]; if ($h =~ /\d+\.\d+\.\d+\.\d+/) { $host = $serveralias; } else { $host = $h; } print ""; print ""; print ""; print ""; print ""; print ""; print "
VirtualHost $h
SeverAdmin webmaster\@$host
DocumentRoot $rootdir
ServerName $host
ServerAlias $serveraliases www.$serveralias
TransferLog "; if($logging eq "y"){ print "$access_log"; }else{ print "n/a" } print "
ErrorLog logs/error_log
"; $data{$domain} = "$rootdir||$serveralias||$logging"; # print "$domain=$rootdir||$serveralias||$logging"; #} #undef $db_obj; #untie(%data); print "Testing
\n"; print "h = $h
\n"; print "domain = $domain
\n"; print "serveraliases = $serveraliases
\n"; print "serveralias = $serveralias\n"; &printfooter; } sub printfooter { print <<_EOF_;
_EOF_ exit; } ########################################################################