// print "<br /><center><strong>Address added!</strong></center><br />\n";
        inf_resp_message_box('Address blacklisted!');
        # Remove from subscriber and custom fields tables
        $query = "DELETE FROM " . $infrespsubscribers . " WHERE EmailAddress = '{$address}'";
        $DB_result = mysql_query($query) or die("Invalid query: " . mysql_error());
        $query = "DELETE FROM " . $infrespcustomfields . " WHERE email_attached = '{$address}'";
        $DB_result = mysql_query($query) or die("Invalid query: " . mysql_error());
    }
    # Back button
    // $return_action = "list";
    // include('templates/back_button.blacklist.php');
} elseif ($action == "remove" && isEmail($address)) {
    # Delete from blacklist
    $query = "DELETE FROM " . $infrespblacklist . " WHERE EmailAddress = '{$address}'";
    $DB_result = mysql_query($query) or die("Invalid query: " . mysql_error());
    inf_resp_message_box('Address unblacklisted!');
    # Print msg
    // print "<br /><center><strong>Address deleted!</strong></center><br />\n";
    # Back button
    // $return_action = "list";
    // include('templates/back_button.blacklist.php');
}
# MOD to display in all cases anyway
// else {
$query = "SELECT * FROM " . $infrespblacklist;
$DB_result = mysql_query($query) or die("Invalid query: " . mysql_error());
if (mysql_num_rows($DB_result) > 0) {
    # Remove address box
    print "<center>\n";
    # MOD Action to Wordpress Menu
    print "<FORM action=\"?page=infinityresponder&subpage=blacklist\" method=POST> \n";
     // include('templates/back_button.responders.php');
 } elseif (($action == "pause" || $action == "activate") && ResponderExists($Responder_ID)) {
     # MOD New pause/activate toggle via Enabled value
     $query = "SELECT * FROM " . $infresponders . " WHERE ResponderID = '{$Responder_ID}'";
     $result = mysql_query($query) or die("Invalid query: " . mysql_error());
     if (mysql_num_rows($result) > 0) {
         $this_row = mysql_fetch_assoc($result);
         if ($this_row['Enabled'] == "1" && $action == "pause") {
             $msg = "Responder paused.";
             $toggle_query = "UPDATE " . $infresponders . " SET Enabled = '0' WHERE ResponderID = '{$Responder_ID}'";
         } elseif ($this_row['Enabled'] == "0" && $action == "activate") {
             $msg = "Reponder re-activated.";
             $toggle_query = "UPDATE " . $infresponders . " SET Enabled = '1' WHERE ResponderID = '{$Responder_ID}'";
         }
         $tog_result = mysql_query($toggle_query) or die("Invalid query: " . mysql_error());
         inf_resp_message_box($msg);
         $action = 'list';
     }
 } elseif ($action != "list") {
     admin_redirect();
 }
 # MOD moved list action here
 if ($action == "list") {
     // include('templates/controlpanel.php');
     $query = "SELECT * FROM " . $infresponders . " ORDER BY ResponderID";
     $DB_result = mysql_query($query) or die("Invalid query: " . mysql_error());
     # Top template
     $alt = TRUE;
     include 'templates/list_top.responders.php';
     # Loop thru the list
     if (mysql_num_rows($DB_result) > 0) {
        # Print msg
        inf_resp_message_box("RegExp added.");
        // print "<p class=\"big_header\">Regexp Added!</p>\n";
    }
} elseif ($action == "remove") {
    $regexp_id = MakeSafe($_REQUEST['regx']);
    if (regexp_exists($regexp_id)) {
        # Delete from the regexp table
        $query = "DELETE FROM " . $infrespbounceregs . " WHERE BounceRegexpID = '{$regexp_id}'";
        $result = mysql_query($query) or die("Invalid query: " . mysql_error());
        # Print msg
        inf_resp_message_box("Bouncer RegExp deleted.");
        // print "<p class=\"big_header\">Bouncer Regexp Deleted!</p>\n";
    } else {
        # Print msg
        inf_resp_message_box("That RegExp wasn't found.");
        // print "<p class=\"big_header\">That Regexp Wasn't Found!</p>\n";
    }
}
print "<p class=\"big_header\">- Bouncer RegExps -</p>\n";
$query = "SELECT * FROM " . $infrespbounceregs;
$DB_result = mysql_query($query) or die("Invalid query: " . mysql_error());
if (mysql_num_rows($DB_result) > 0) {
    # Remove regexp box
    print "<center>\n";
    # MOD Action to Wordpress Menu
    print "<FORM action=\"?page=infinityresponder&subpage=regexps\" method=GET> \n";
    print "<select name=\"regx\" size=\"10\">\n";
    while ($result = mysql_fetch_assoc($DB_result)) {
        print "<option value=\"" . $result['BounceRegexpID'] . "\">" . $result['RegX'] . "</option>\n";
    }
     # MOD Save new Wordpress Mailer Options
     update_option('inf_resp_mailer', $_REQUEST['inf_resp_mailer']);
     update_option('inf_resp_word_wrap', $_REQUEST['inf_resp_word_wrap']);
     update_option('inf_resp_signature', $_REQUEST['inf_resp_signature']);
     update_option('inf_resp_address', $_REQUEST['inf_resp_address']);
     update_option('inf_resp_embed_images', $_REQUEST['inf_resp_embed_images']);
     update_option('inf_resp_image_url', $_REQUEST['inf_resp_image_url']);
     update_option('inf_resp_image_dir', $_REQUEST['inf_resp_image_dir']);
     update_option('inf_resp_embed_external', $_REQUEST['inf_resp_embed_external']);
     # Fix the session
     // $_SESSION['l'] = md5(WebEncrypt($config['admin_user'], $config['random_str_1']));
     // $_SESSION['p'] = md5(WebEncrypt($config['admin_pass'], $config['random_str_2']));
     # Done!
     // print "<center><H2>Changes Saved!</H2></center>\n";
     # MOD message box display
     inf_resp_message_box('Changes Saved!');
 }
 # MOD removed - passwords no longer used
 # If our password is empty print an warning message!
 // if (empty($config['admin_pass'])) {
 //     print "<center><H2>Warning: Your admin password is not set!</H2></center>\n";
 // }
 # MOD New Wordpress Options for wp_mail / phpmailer
 $infrespmailer = get_option('inf_resp_mailer');
 $infrespwordwrap = get_option('inf_resp_word_wrap');
 $infrespsignature = get_option('inf_resp_signature');
 $infrespaddress = get_option('inf_resp_address');
 $infrespembedimages = get_option('inf_resp_embed_images');
 $infrespimageurl = get_option('inf_resp_image_url');
 $infrespimagedir = get_option('inf_resp_image_dir');
 $infrespembedexternal = get_option('inf_resp_embed_external');
    echo '<tr bgcolor="#1EABDF" height="54"><td align="center"><font color="#FFFFFF" style="font-size:18px;">Tools</font></td></tr>';
    echo '<tr><td>';
    # Handle actions
    if ($_REQUEST['action'] == "run_sendmails") {
        $sendmails_included = TRUE;
        include 'sendmails.php';
        // print "<p class=\"big_header\">Sendmails Done!</p>\n";
        inf_resp_message_box('Sendmails Done!');
    } elseif ($_REQUEST['action'] == "run_mailchecker") {
        $included = TRUE;
        include 'mailchecker.php';
        // print "<p class=\"big_header\">Mail Checker Done!</p>\n";
        inf_resp_message_box('Mail Checker Done!');
    } elseif ($_REQUEST['action'] == "run_bouncechecker") {
        $included = TRUE;
        include 'bouncechecker.php';
        // print "<p class=\"big_header\">Bounce Checker Done!</p>\n";
        inf_resp_message_box('Bounce Checker Done!');
    }
    # Display config template
    include 'templates/main.tools.php';
    # Display back to admin button
    include 'templates/back_button.tools.php';
    echo '</td></tr></table>';
    # Display the bottom template
    copyright();
    include 'templates/close.page.php';
} else {
    admin_redirect();
}
DB_disconnect();
function Run_UserQuery($query)
{
    global $DB_ResponderID, $DB_ResponderName, $DB_OwnerEmail;
    global $DB_OwnerName, $DB_ReplyToEmail, $DB_MsgList, $DB_LastActivity;
    global $DB_result, $DB_LinkID, $DB_ResponderDesc, $DB_RespEnabled;
    global $Responder_ID, $action, $SearchCount;
    global $Search_EmailAddress, $Subscriber_ID, $SubsPerPage;
    global $DB_FirstName, $DB_LastName, $DB_IPaddy, $DB_Real_TimeJoined;
    if ($SubsPerPage != 0) {
        $Limitedquery = $query . " LIMIT {$SearchCount}, {$SubsPerPage}";
    } else {
        $Limitedquery = $query;
    }
    $DB_MaxList_result = mysql_query($query) or die("Invalid query: " . mysql_error());
    $DB_search_result = mysql_query($Limitedquery) or die("Invalid query: " . mysql_error());
    $Max_Results_Count = mysql_num_rows($DB_MaxList_result) - 1;
    # MOD display message if any
    if ($_SESSION['inf_resp'] != '') {
        inf_resp_message_box($_SESSION['inf_resp']);
        unset($_SESSION['inf_resp']);
    }
    if (mysql_num_rows($DB_search_result) > 0) {
        # User top template
        $alt = FALSE;
        include 'templates/listuser_top.admin.php';
        # Display the rows
        while ($search_query_result = mysql_fetch_assoc($DB_search_result)) {
            $DB_SubscriberID = $search_query_result['SubscriberID'];
            $DB_ResponderID = $search_query_result['ResponderID'];
            $DB_SentMsgs = $search_query_result['SentMsgs'];
            $DB_EmailAddress = $search_query_result['EmailAddress'];
            $DB_TimeJoined = $search_query_result['TimeJoined'];
            $DB_Real_TimeJoined = $search_query_result['Real_TimeJoined'];
            $CanReceiveHTML = $search_query_result['CanReceiveHTML'];
            $DB_LastActivity = $search_query_result['LastActivity'];
            $DB_FirstName = $search_query_result['FirstName'];
            $DB_LastName = $search_query_result['LastName'];
            $DB_IPaddy = $search_query_result['IP_Addy'];
            $DB_ReferralSource = $search_query_result['ReferralSource'];
            $DB_UniqueCode = $search_query_result['UniqueCode'];
            $DB_Confirmed = $search_query_result['Confirmed'];
            $Responder_ID = $DB_ResponderID;
            if (!ResponderExists($Responder_ID)) {
                admin_redirect();
            }
            $ResponderInfo = GetResponderInfo($Responder_ID);
            # User row template
            $alt = !$alt;
            include 'templates/listuser_row.admin.php';
        }
        # List bottom template
        include 'templates/listuser_bottom.admin.php';
        if ($SubsPerPage != 0) {
            $Search_Count_BackStr = $SearchCount - $SubsPerPage;
            $Search_Count_ForwardStr = $SearchCount + $SubsPerPage;
            if ($Search_Count_BackStr < 0) {
                $Search_Count_BackStr = 0;
            }
            if ($Search_Count_ForwardStr > $Max_Results_Count) {
                $Search_Count_ForwardStr = $Max_Results_Count;
            }
            # Back and forward buttons
            include 'templates/back_forward.admin.php';
        }
        # Add new user button
        include 'templates/addnew_button.admin.php';
    } else {
        if (!ResponderExists($Responder_ID)) {
            admin_redirect();
        }
        $ResponderInfo = GetResponderInfo($Responder_ID);
        $DB_ResponderName = $ResponderInfo['Name'];
        print "<br><center><font size=\"3\" color=\"#330000\">No subscriber(s) found for Responder '" . $DB_ResponderName . "'.</font></center><br>\n";
        print "<br>\n";
        # Add new user button
        include 'templates/addnew_button.admin.php';
    }
    # Back button
    // print "<br> \n";
    // print "<font size=\"4\" color=\"#666666\">Back to Main:</font><br>\n";
    $return_action = "list";
    include 'templates/back_button.admin.php';
}
         // print "<p class=\"big_header\">That address is already assigned!</p>\n";
         inf_resp_message_box('That address is already assigned!');
     } else {
         # Insert the row
         DB_Insert_Array($infrespbouncers, $form);
         # Done! Take us back...
         // print "<p class=\"big_header\">Bouncer added!</p>\n";
         inf_resp_message_box('Bouncer added!');
     }
 } elseif ($action == "do_delete" && bouncer_exists($bouncer_id)) {
     # Delete from the bouncer table
     $query = "DELETE FROM " . $infrespbouncers . " WHERE BouncerID = '{$bouncer_id}'";
     $result = mysql_query($query) or die("Invalid query: " . mysql_error());
     # Done! Take us back...
     // print "<p class=\"big_header\">Bouncer deleted!</p>\n";
     inf_resp_message_box('Bouncer deleted!');
 }
 # Init vars
 $alt = TRUE;
 $return_action = "list";
 # Show the page
 $query = "SELECT * FROM " . $infrespbouncers;
 $DB_Result = mysql_query($query) or die("Invalid query: " . mysql_error());
 if (mysql_num_rows($DB_Result) > 0) {
     # Top template
     include 'templates/list_top.bouncers.php';
     # Run the list
     for ($i = 0; $i < mysql_num_rows($DB_Result); $i++) {
         $data = mysql_fetch_assoc($DB_Result);
         # Show the template
         include 'templates/list_row.bouncers.php';
     }
     $heading = "Delete Mailburst?";
     $submit_action = "do_delete";
     $return_action = "list";
     # Get the math numbers
     $the_math = get_send_figures($mail_id);
     # Show the template
     include 'templates/delete.mailbursts.php';
 } elseif ($action == "do_delete" && mail_msg_exists($mail_id)) {
     # Delete from the mail table
     $query = "DELETE FROM " . $infrespmail . " WHERE Mail_ID = '{$mail_id}'";
     $result = mysql_query($query) or die("Invalid query: " . mysql_error());
     # Delete from the mail cache table
     $query = "DELETE FROM " . $infrespmailcache . " WHERE Mail_ID = '{$mail_id}'";
     $result = mysql_query($query) or die("Invalid query: " . mysql_error());
     inf_resp_message_box("Message deleted.");
     $action = 'list';
     # Done! Take us back...
     // $return_action = "list";
     // print "<p class=\"big_header\">Mailburst deleted!</p>\n";
     // include('templates/back_button.mailbursts.php');
 }
 # ---------------
 # MOD mailburst list
 if ($action == "list" || $action == "") {
     # Init vars
     $submit_action = "create";
     $return_action = "list";
     $heading = "Mailbursts for: {$DB_ResponderName}";
     # Responder button template
     include 'templates/responder_button.mailbursts.php';