403Webshell
Server IP : 210.245.233.93  /  Your IP : 216.73.216.226
Web Server : Apache/2.2.15 (CentOS)
System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 5.3.3
Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/onesolution.com.hk/onesupport/job/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/onesolution.com.hk/onesupport/job/services_report.php
<?php
require_once(__DIR__ . '/../checkuser.php');
require_once('../inc/class.phpmailer.php');

set_time_limit(0);
ini_set('memory_limit', '512M');
session_start();

if (!function_exists('insert_nbsp')) {
    function insert_nbsp($num)
    {
        $result = '';
        for ($i = 0; $i < $num; $i++) {
            $result .= '&nbsp;';
        }
        return $result;
    }
}

global $dbh;

$sql = "
SELECT job.staff_tel_no as job_staff_tel_no, staff.staff_tel_no as staff_staff_tel_no, job.contact_person as job_contact_person, job.*,customer.*,staff.*, job.id as job_id, job.email1
FROM sup_job job, v_cm_customer_support customer, sys_login staff
WHERE job.customer_id = customer.cust_id AND job.staff_id = staff.id AND job.deleted = ? AND job.id = ?
GROUP BY job.id
";

$parameters = array("0", (int)$_GET['id']);

if (!($sth = $dbh->prepare($sql))) {
    throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
    exit;
}

if (!$sth->execute($parameters)) {
    throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
    exit;
}

$job_info = $sth->fetch(PDO::FETCH_ASSOC);

if(!empty($_GET['email'])){
    //check email again
    if(empty($job_info['email1'])){
        echo '<script>alert("Email is empty."); history.back();</script>';
        exit;
    }else{
        $email_array = explode(';', $job_info['email1']);
        foreach ($email_array as $email){
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
                $message = "Invalid email format.";
            }
        }

        if(!empty($message)){
            echo '<script>alert("'.$message.'"); history.back();</script>';
            exit;
        }
    }
}

//============================================================+
// File name   : example_006.php
// Begin       : 2008-03-04
// Last Update : 2013-05-14
//
// Description : Example 006 for TCPDF class
//               WriteHTML and RTL support
//
// Author: Nicola Asuni
//
// (c) Copyright:
//               Nicola Asuni
//               Tecnick.com LTD
//               www.tecnick.com
//               info@tecnick.com
//============================================================+

/**
 * Creates an example PDF TEST document using TCPDF
 * @package  com.tecnick.tcpdf
 * @abstract TCPDF - Example: WriteHTML and RTL support
 * @author   Nicola Asuni
 * @since    2008-03-04
 */

// Include the main TCPDF library (search for installation path).
require_once('../libraries/tcpdf/tcpdf.php');

// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('One Solution');
$pdf->SetTitle('One Solution');
$pdf->SetSubject('One Solution');
$pdf->SetKeywords('One Solution');

// set default header data
//$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 006', PDF_HEADER_STRING);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));

// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

// set margins
//$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetMargins(PDF_MARGIN_LEFT, 10, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);


// set auto page breaks
$pdf->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM);

// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

// set some language-dependent strings (optional)
/*if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
    require_once(dirname(__FILE__).'/lang/eng.php');
    $pdf->setLanguageArray($l);
}*/

// ---------------------------------------------------------

// set font
//$pdf->SetFont('msjh', '', 12, '', false);
//$pdf->SetFont('msjhbd', 'B', 12, '', false);

// add a page
$pdf->AddPage();

// create some HTML content


ob_start();
?>
    <table style="width: 100%;">
        <tr>
            <td>
                <br>
                <br>
                <img src="../images/header_logo.png"/>
            </td>
            <td style="font-size: 10px;">
                <table>
                    <tr>
                        <td></td>
                        <td style="width: 200px;">
                            One Solution Limited<br>
                            Unit 16, 11/F., Wah Shing Centre,<br>
                            11-13 Shing Yip Street, Kwun Tong,<br>
                            Kowloon, Hong Kong<br>
                            Tel : (852) 3189 9000<br>
                            Fax : (852) 3189 9099<br>
                            Email : info@onesolution.com.hk
                        </td>
                    </tr>
                </table>
            </td>
        </tr>

        <tr style="text-align: center">
            <td colspan="2" style="font-size: 20px;">
                <br>
                <br>
                <u><b>SERVICES REPORT</b></u>
            </td>
        </tr>

        <tr>
            <td colspan="2">
                <br>
                <br>
                Customer : <?= $job_info{"company_name"} ?>
            </td>
        </tr>

        <tr>
            <td>
                <br>
                <br>
                Contact : <?php if (empty($job_info{"job_contact_person"})) echo "&nbsp;"; else echo $job_info{"job_contact_person"}; ?>
            </td>

            <td>
                <br>
                <br>
                Tel No : <?php if (empty($job_info{"contact_tel_no"})) echo "&nbsp;"; else echo $job_info{"contact_tel_no"}; ?>
            </td>
        </tr>

        <tr>
            <td>
                <br>
                <br>
                Engineer :

                <?php
                echo $job_info{"username"};

                if (!empty($job_info["other_staff_id"])) {
                    $other_staff_id_list = explode(",", $job_info["other_staff_id"]);

                    $other_staff_name_list = "";
                    foreach ($other_staff_id_list as $staff_id) {
                        $sql3 = "SELECT * from sys_login where id = ?";

                        $parameters3 = array($staff_id);

                        if (!($sth3 = $dbh->prepare($sql3))) {
                            throw new Exception("sql prepare statement failure: $sql3");
                        }

                        if (!$sth3->execute($parameters3)) {
                            throw new Exception("sql execute statement failure: $sql3");
                        }

                        $staff_info = $sth3->fetch();

                        $other_staff_name_list .= ", " . $staff_info["username"];
                    }

                    echo $other_staff_name_list;
                }
                ?>
            </td>

            <td>
                <br>
                <br>
                Tel No : <?php if (empty($job_info{"job_staff_tel_no"})) echo "&nbsp;"; else echo $job_info{"staff_tel_no"}; ?>
            </td>
        </tr>

        <tr>
            <td colspan="2">
                <br>
                <br>
                Actual Time <?= insert_nbsp(12) ?> Start
                : <?php if (!empty($job_info{"actual_start_time"}) && $job_info{"actual_start_time"} != "00:00:00") echo $job_info{"actual_start_time"}; else echo "&nbsp;" ?>  <?= insert_nbsp(12) ?>
                End
                : <?php if (!empty($job_info{"actual_end_time"}) && $job_info{"actual_end_time"} != "00:00:00") echo $job_info{"actual_end_time"}; else echo "&nbsp;"; ?> <?= insert_nbsp(12) ?>
                Date : <?= $job_info{"date"} ?>
            </td>
        </tr>

        <tr>
            <td colspan="2">
                <br>
                <br>
                Service Type :
                <?php
                $type_list = Job::typeOptions();
                foreach ($type_list as $key => $this_type) {
                    if ($job_info{"type"} == $key) {
                        echo '<img src="../images/checkbox_checked.png" style="height: 12px;"/>';
                    } else {
                        echo '<img src="../images/checkbox_unchecked.png" style="height: 12px;"/>';
                    }
                    echo '&nbsp;' . $this_type . '&nbsp;&nbsp;&nbsp;';
                }
                ?>

            </td>
        </tr>

        <tr>
            <td colspan="2">
                <br>
                <br>
                Remarks : <?php if (empty($job_info{"remarks"})) echo "&nbsp;"; else echo nl2br($job_info{"remarks"}); ?>
            </td>
        </tr>


        <?php
        $sql5 = "select * from sup_job_detail where deleted = ? and job_id = ? order by id ASC";
        if (!($sth5 = $dbh->prepare($sql5))) {
            throw new Exception("sql prepare statement failure: $sql5");
        }

        if (!$sth5->execute(array("0", (int)$_GET['id']))) {
            throw new Exception("sql execute statement failure: $sql5");
        }
        $job_detail = $sth5->fetchAll();

        foreach ($job_detail as $key => $this_task) {
            ?>
            <tr>
                <td colspan="2">
                    <br>
                    <br>
                    Job Symptoms : <?= $this_task{"title"} ?>
                </td>
            </tr>

            <tr>
                <td colspan="2">
                    <br>
                    <br>
                    Action : <?php if (empty($this_task{"remarks"})) echo "&nbsp;"; else echo nl2br($this_task{"remarks"}); ?>
                </td>
            </tr>

            <tr>
                <td colspan="2">
                    <br>
                    <br>
                    Job Status :

                    <?php
                    $job_status_array = array(2 => "Done", 3 => "Follow Up", 4 => "Cancel");

                    foreach ($job_status_array as $key2 => $row2) {
                        if ($this_task{"status"} == $key2) {
                            echo '<img src="../images/checkbox_checked.png" style="height: 12px;"/>';
                        } else {
                            echo '<img src="../images/checkbox_unchecked.png" style="height: 12px;"/>';
                        }
                        echo '&nbsp;' . $row2 . '&nbsp;&nbsp;&nbsp;';
                    }
                    ?>
                </td>
            </tr>

            <tr>
                <td colspan="2">
                    <br>
                    <br>
                    Parts Service Status :<br>

                    <table border="1" cellpadding="4">
                        <tr>
                            <td>Model.</td>
                            <td>Part S/N</td>
                            <td>Description</td>
                            <td>Qty</td>
                        </tr>

                        <tr>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                        </tr>
                    </table>
                </td>
            </tr>

            <tr style="page-break-inside:avoid;">
                <td style="text-align: center;">
                    <br>
                    <br>
                    Service confirmed, Accepted & product Received By :
                    <br>
                    <br>
                    <br>
                    <br>
                    <br>
                    <br>

                    <div style="border-bottom: 1px solid #000;"></div>
                    <br>
                    Company Chop And Signature
                </td>

                <td style="text-align: left;">
                    <br>
                    <br>
                    Services By :
                    <br>
                    <br>
                    <br>
                    <br>
                    <br>
                    <br>

                    <div style="text-align: center;">
                        <div style="border-bottom: 1px solid #000;"></div>
                        <br>
                        One Solution Limited
                    </div>
                </td>
            </tr>
        <?php } ?>
    </table>
<?php
$html = ob_get_contents();
ob_end_clean();

/*echo $html;
exit;*/
// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');

// ---------------------------------------------------------

//Close and output PDF document
if (empty($_GET['email'])) {
    $attachment = $pdf->Output('services_report.pdf', 'I');
} else {
    $attachment = $pdf->Output('services_report.pdf', 'S');
//for customer
    $sender_email = 'kelvinchan@onesolution.com.hk';
    $company_name = 'onesolution';
    $email = $sender_email;
    $name = $company_name;
    $email_subject = 'send pdf to customer';
    $email_body = $email_subject;

    $x_mail = new PHPMailer();
    $x_mail->IsSMTP();

    /*$x_mail->Host = "localhost";
    $x_mail->SMTPAuth = true;*/
    $x_mail->Host = 'smtp.mailtrap.io';                 // Specify main and backup server
    $x_mail->Port = 2525;                                    // Set the SMTP port
    $x_mail->SMTPAuth = true;                               // Enable SMTP authentication
    $x_mail->Username = '3165d93ccd00b0';                // SMTP username
    $x_mail->Password = 'cbf21159427c09';                  // SMTP password
    $x_mail->SMTPSecure = 'tls';
    $x_mail->CharSet = "UTF-8";
    $x_mail->WordWrap = 50;
    $x_mail->IsHTML(true);
//$x_mail->SMTPDebug = 2;

    $x_mail->Sender = $sender_email;
    $x_mail->AddReplyTo($sender_email, $company_name);
    $x_mail->From = $sender_email;
    $x_mail->FromName = $company_name;

    if(!empty($email_array)){
        foreach ($email_array as $_email){
            $email = trim($email);
            $x_mail->AddAddress($email, $_email);
        }
    }
    //$x_mail->AddAddress($email, $name);

    $x_mail->Subject = $email_subject;
    $x_mail->Body = $email_body;
    $x_mail->AddStringAttachment($attachment, 'services_report.pdf');

    if ($x_mail->Send()) {
        echo 1;
    } else {
        echo 0;
    }
}


//$attachment = chunk_split($attachment);
/*var_dump($attachment);
exit;*/
//============================================================+
// END OF FILE
//============================================================+

Youez - 2016 - github.com/yon3zu
LinuXploit