#!/usr/bin/perl

print "Content-Type: Text/HTML\n\n";

use CGI ':standard';
use Vpanel 1.00;
require $header;
require $accountinfo;

$domainname = find_domain ($mainuser);
$spam_trap_status = spam_actions_status($domainname);

# Define the tab which appears to the front
$tab_section = $tabnum_mailwall;

# Output the content associated with this tab
print "<body class=section-$tab_section>";

# display tabs
require $tabdisplay;

print_header("Removal of a spam trap for $domainname");

print "Thank you for your request to delete the spam trap for your account $domainname.";

if ( $spam_trap_status eq "on" )
{
	# Get the spam trap name
	$spam_trap_name = "spam".$mainuser;

	# Write to file for later processing
	open (DELTRAP, ">>$delete_spam_trap_file") || file_error($delete_spam_trap_file);
	print DELTRAP "$domainname\n";
	close (DELTRAP);

	# Write the user to a file for later deletion

        open (DELUSER, ">>$deleteuserfile") || file_error($deleteuserfile);
        print DELUSER $spam_trap_name, "\n";
        close DELUSER;
	
	show_time_to_change();

} else {
	print "<BR><BR>Sorry, but it seems that you either don't have a spam trap or your spam trap is in the process of being deleted. ";
	print_support_contact_information();	
}

require $footer;
