#!/usr/local/bin/perl require '/httpd/cgi-bin/headfoot.pl'; if ($ENV{'SERVER_PORT'} eq "443") { print "Location: http://www.flash.net/~domain/tools\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; $domain =~ s/ //g; $user = $in{'user'}; $logging = $in{'logging'}; $logging = "n" unless $logging; if ($domain) { &get_info; } else { &startup; } ######################################################################## sub print_header { print "Content-type: text/html \n\n"; print "$header"; } ######################################################################## sub startup { &print_header; print <<_EOF_;
Use domainname.com, without the www. ie. javahaus.com
- Domain name to Add

- User Name to associate the Domain with

- Enable Logging


$footer _EOF_ exit; } ######################################################################## sub get_info { &print_header; $nslookup = `/usr/sbin/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; } unless ($user =~ /^\w{3}/) { print <<_EOF_;

$domain


HEY!!!! We have to know where to point the damn thing.... Go back and try again.... _EOF_ &printfooter; } $frst = substr($user,0,1); $scnd = substr($user,1,1); unless (-e "/home/$frst/$scnd/$user/www/") { print <<_EOF_;

$domain


Sorry, can't do it.... I do not show that the user directory
/home/$frst/$scnd/$user/www
actually exists, therefore I will not add the domain.... Try running FART and then readding it, if that is the right username. _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; $rootdir = "/home/$frst/$scnd/$user/www/"; $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||$domain||$logging"; print "$domain=$rootdir||$domain||$logging"; #mod by Jeremy to write to mail2.allow 6/29/98 open(MAIL2LIST,">>/usr/local/etc/httpd/cgi-bin/mail2.list") or print "




$!
"; print MAIL2LIST "$domain\n"; close(MAIL2LIST); } undef $db_obj; untie(%data); &printfooter; } sub printfooter { print "$footer"; exit; } ########################################################################