#!/usr/local/bin/perl require '/httpd/cgi-bin/headfoot.pl'; 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; # $in{'ddomain'} =~ /(^.+)/; # $ddomain = $1; $ddomain = $in{'ddomain'}; if ($domain) { &get_info; } elsif ($ddomain) { &delete; } 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 Delete


$footer _EOF_ exit; } ######################################################################## sub get_info { &print_header; print <<_EOF_;

$domain


_EOF_ $db_file = "/home/httpd/conf/domains.db"; $db_obj = tie(%data, 'DB_File', $db_file, O_RDONLY, 0444) or print $!; if (!$data{$domain}) { print "I do not show that the domain, $domain, exists on our server."; print "You can not delete something that does not exist..."; } else { print "OK, looks like you have a good one...."; $h = $domain; $host = $domain; ($rootdir,$serveraliases,$logging) = split (/\|\|/,$data{$domain}); $first = substr($h,0,1); $log_name = "${h}_log"; $access_log = "domain_logs/$first/$log_name"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; 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
\n"; print "$domain=$rootdir||$domain||$logging"; print "
\n"; print "
\n"; print "

If you are 100\% sure you want to delete the domain, hit continue

\n"; print "\n"; print "

\n"; print "\n"; print "
\n"; print "
\n"; } undef $db_obj; untie(%data); &printfooter; } sub printfooter { print "$footer"; exit; } ######################################################################## sub delete { &print_header; print "

$ddomain


\n"; $db_file = "/httpd/conf/domains.db"; $db_obj = tie(%data, 'DB_File', $db_file, O_RDWR, 0666) or print $!; print "OK, $ddomain is GONE...."; delete $data{$ddomain}; undef $db_obj; untie(%data); &printfooter; }