require_lib("ext");
require_lib("mail.smtp");
#read get vars into post vars
foreach ($_GET as $each => $own) {
    $_POST[$each] = $own;
}
if (isset($_POST["key"])) {
    switch ($_POST["key"]) {
        case "confirm":
            $OUTPUT = send_email_groups($_POST);
            break;
        case "remove":
            $OUTPUT = remove_group($_POST);
            break;
        case "confirm_remove":
            $OUTPUT = confirm_remove($_POST);
            break;
        case "viewgroup":
            $OUTPUT = view_fails($_POST);
            break;
        case "removefails":
            $OUTPUT = remove_fails($_POST);
            break;
        default:
            $OUTPUT = show_email_groups();
    }
} else {
    if (isset($_GET["send"])) {
        $OUTPUT = send_email_groups($_GET);
    } else {
        $OUTPUT = show_email_groups();
<?php

require "../settings.php";
if (isset($_POST["key"])) {
    $OUTPUT = write_remove();
} else {
    $OUTPUT = confirm_remove();
}
require "gw-tmpl.php";
function confirm_remove()
{
    extract($_GET);
    if (!isset($docid)) {
        return "Invalid Use Of Module.";
    }
    db_conn('crm');
    $get_cust_doc = "SELECT * FROM customer_docs WHERE id = '{$docid}' LIMIT 1";
    $run_cust_doc = db_exec($get_cust_doc) or errDie("Unable to get customer document information.");
    if (pg_numrows($run_cust_doc) > 0) {
        $darr = pg_fetch_array($run_cust_doc);
    } else {
        return "Invalid Use Of Module. Selected Document Not Found.";
    }
    $display = "\n\t\t<h4>Confirm Removal Of Customer Document</h4>\n\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t<input type='hidden' name='key' value='confirm'>\n\t\t\t<input type='hidden' name='docid' value='{$docid}'>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<td>Document Description</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>{$darr['filename']}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>Document File Name</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>{$darr['real_filename']}</td>\n\t\t\t</tr>\n\t\t\t<tr><td><br></td></tr>\n\t\t\t<tr>\n\t\t\t\t<td><input type='submit' value='Remove'></td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</form>";
    return $display;
}
function write_remove()
{
    extract($_POST);
    db_conn('crm');
    #remove the document