コード例 #1
0
}
if ($str_where_condition == "") {
    $str_where_condition = " where 1 ";
} else {
    $str_where_condition .= " and gateway_id = -1";
}
$str_qry_company = "select * from cs_companydetails {$str_where_condition} order by companyname";
//$str_qry_company ="select * from cs_companydetails where userId = $company_name";
// print($str_qry_company);
$rst_qry_company = mysql_query($str_qry_company);
$zipfile = new zipfile();
while ($arr_qry_company = mysql_fetch_array($rst_qry_company)) {
    $str_company_name = $arr_qry_company['companyname'];
    $company_id = $arr_qry_company['userId'];
    $i_max_file_size_MB = 3;
    $dir_company_name = "Documents/" . func_replace_invalid_literals($str_company_name);
    //$dir_company_name = "Documents/";
    //print("company= ".$dir_company_name);
    // add the subdirectory ... important!
    if ($is_app != "") {
        $str_legal_company_name = $arr_qry_company['legal_name'];
        $company_type = $arr_qry_company['company_type'];
        $other_company_type = $arr_qry_company['other_company_type'];
        if ($company_type == "other") {
            $company_type = $other_company_type;
        }
        $address = $arr_qry_company['address'];
        $city = $arr_qry_company['city'];
        $state = $arr_qry_company['state'];
        $other_state = $arr_qry_company['ostate'];
        if ($state == "") {
コード例 #2
0
function func_send_documents($zipfile, $str_company_name, $other_email, $str_failure_companies, $i_max_file_size_MB, $error_msg)
{
    $arr_result = array(2);
    $zip_file_name = func_replace_invalid_literals($str_company_name);
    $filename = "csv/" . $zip_file_name . "_document.zip";
    $fd = fopen($filename, "wb");
    $out = fwrite($fd, $zipfile->file());
    fclose($fd);
    $file_size = fsize($filename);
    //print($file_size."<br>");
    if ($file_size < $i_max_file_size_MB) {
        $mailbody = "<html><head></head><body>";
        $mailbody .= "Application / Documents for " . $str_company_name . " are being attached herewith.";
        $mailbody .= "</body></html>";
        $mail_response = "";
        $arrFiles = array($filename);
        $arrFileNames = array("application_document.zip");
        if ($other_email != "") {
            //print("$str_company_name<br>");
            if (!sendMail($_SESSION['gw_emails_sales'], "Application/Documents", $mailbody, $other_email, $arrFiles, $arrFileNames)) {
                //print("failure: $str_company_name<br>");
                $str_failure_companies .= "<br> {$str_company_name}";
            } else {
                //print("success: $str_company_name<br>");
            }
        }
    } else {
        $error_msg .= "<br> {$str_company_name}";
    }
    delete($filename);
    $arr_result[0] = $str_failure_companies;
    $arr_result[1] = $error_msg;
    return $arr_result;
}