403Webshell
Server IP : 103.234.187.230  /  Your IP : 216.73.216.216
Web Server : Apache
System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/b2bzend/application/views/scripts/customer/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/b2bzend/application/views/scripts/customer/member-document-upload.phtml
<?php
$sessionLogin_user = new Zend_Session_Namespace('sessionLogin_user');
$DefaultCountryCode = $sessionLogin_user->agencyDetails['DefaultCountryCode'];
$AgencySysId = $this->AgencySysId;
$docarr = array(
    "1" => array(
        "documentIdentifiers" => array(
            '1' => 'Aadhar Front',
            '2' => 'Aadhar Back',
            '3' => 'Pancard',
            '4' => 'Passport Front',
            '5' => 'Passport Back',
            '6' => 'Photo',
            '7' => 'Other Document',
        ),
    )
);
$docarr1 = [];
foreach ($docarr as $dockey => $docval) {
    $docarr1 = $docval['documentIdentifiers'];
}
$memdocarray = $this->memberdocumentdata;
?>
<style>
    .share-icon {
  display: none;
}
.country_box_wrap2 {
    width: 46px;
}
</style>
<div class="modal-content" id="main-container">
    <div class="modal-header">
        <button type="button" id="closeModal1Button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title" id="myModalLabel">Member Document Upload</h4>
    </div>
    <div class="modal-body">
        <div class="row">
            <div class="col-md-12">
                <form id="memberdocform" name="memberdocform" method="POST" enctype="multipart/form-data">
                    <input type="hidden" name="counter" id="counter" value="<?= !empty($memdocarray) ? (count($memdocarray) + 1) : '2'; ?>" class="form-control">
                    <input type="hidden" name="memberCustSysId" id="memberCustSysId" value="<?= $this->mid; ?>">
                    <input type="hidden" name="CustomerSysId" id="CustomerSysId" value="<?= $this->CustomerSysId; ?>">
                    <table class="table tablestyle sortable-theme-bootstrap leadeBorder2 RowsGroup" data-sortable>
                        <thead>
                            <tr class="alert alert-graylight">
                           <?php if (isset($memdocarray) && (count($memdocarray) > 0)) { ?><th class="small smallbold" style="vertical-align:middle;width:20px;">Select</th> <?php } ?>
                                <th class="small smallbold" style="vertical-align:middle;">Document Type</th>
                                <th class="small smallbold" style="vertical-align:middle;">Document Name</th>
                                <th class="small smallbold" style="vertical-align:middle;">Document File (PDF/JPEG/JPG)(2MB)</th>
                                <th class="small smallbold" style="vertical-align:middle; width:85px;">Action</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            if (isset($memdocarray) && (count($memdocarray) > 0)) {
                                $i = 1;
                                foreach ($memdocarray as $value) {
                                    $filename = (isset($value['FileName'])) ? trim($value['FileName']) : '';
                                    $folderNamePath = 'doc/' .  $AgencySysId . '/customer/' . $value['CustomerSysId'] . '/';
                                    $folderNamePath .= empty($value['MemberSysId']) ? 'document/' : 'member/' . $value['MemberSysId'] . '/document/';
                                    $folderNamePath .= $filename;
                                    $data = array(
                                        'AgencySysId' => $AgencySysId,
                                        'folderName' => $folderNamePath,
                                    );
                                    $responseArr = Zend_Controller_Action_HelperBroker::getStaticHelper('FileUpload')->getFileFromAWS($data);
                            ?>
                                    <input type="hidden" name="MembersDocumentSysId[]" id="MembersDocumentSysId<?= $i ?>" value="<?= $value['MembersDocumentSysId']; ?>">
                                    <tr id="row<?= $i ?>">
                                    <td>
                                    <label>
                                      <input type="checkbox" class="share-checkbox" id="sharedoc<?= $i ?>" name="sharedoc[]">
                                    </label>
                                    </td>
                                        <td style="width:200px;">
                                            <select name="documenttype[]" id="documenttype<?= $i ?>" class="form-control" index="<?= $i ?>" onchange="changeDocType(this)" required style="display:none">
                                                <option value="">Select Document Type</option>
                                                <?php foreach ($docarr1 as $key => $val) { ?>
                                                    <option value="<?= $key ?>" <?= (trim($value['TitleType']) === trim($val)) ? 'selected' : '' ?>><?= $val ?></option>
                                                <?php } ?>
                                            </select>
                                            <span><?= $value['TitleType']; ?></span>
                                        </td>
                                        <td style="width:200px;">
                                            <div class="docnameinput<?= $i ?>" style="display:<?= ($value['TitleType'] == trim('Other Document')) ? 'none' : 'none'; ?>">
                                                <input type="hidden" name="titletype[]" id="titletype<?= $i ?>" value="<?= $value['TitleType']; ?>">
                                                <input type="text" name="docname[]" id="docname<?= $i ?>" class="form-control" value="<?= $value['Title'] ?>">
                                            </div>
                                            <div class="docnametext<?= $i ?>" style="display:<?= ($value['TitleType'] == trim('Other Document')) ? 'block' : 'block'; ?>">
                                                <span><?= $value['Title'] ?></span>
                                            </div>
                                        </td>
                                        <td style="width:200px;">
                                            <?php if (!empty($responseArr[0]['document']) && !empty($value['FileName'])) { ?>
                                                <div class="docfileview<?= $i ?>">
                                                    <a href="<?= $responseArr[0]['document'] ?>" target="_blank" class="btn btn-danger">View</a>
                                                    <a href="javascript:void(0);" id="remove<?= $i ?>" onclick="removeDocFile(<?= $i ?>);" class="btn btn-danger">Update</a>
                                                </div>
                                                <div class="docfileinput<?= $i ?>" style="width:170px;<?= (!empty($value['FileName'])) ? "display:none" : '' ?>">
                                                    <input type="file" name="docfile[]" id="docfile<?= $i ?>" index="<?= $i ?>" class="form-control" onchange="validateFileExtension(this, 'fileError<?= $i ?>');">
                                                    <p id="fileError<?= $i ?>" style="color: red;"></p>
                                                </div>
                                            <?php  } else { ?>
                                                <div class="docfileinput<?= $i ?>" style="width:170px;">
                                                    <input type="file" name="docfile[]" id="docfile<?= $i ?>" index="<?= $i ?>" class="form-control" onchange="validateFileExtension(this, 'fileError<?= $i ?>');" required>
                                                    <p id="fileError<?= $i ?>" style="color: red;"></p>
                                                </div>
                                            <?php  } ?>
                                        </td>
                                        <td>
                                            <a href="javascript:void(0);" data-placement="top" title="Delete" class="tooltipLink view_text1" onclick="deleteItem(<?= $value['MembersDocumentSysId'] ?>);">
                                                <i class="fa fa-minus-circle"></i>
                                            </a>
                                        </td>
                                    </tr>
                                <?php
                                    $i++;
                                }
                            } else {

                                $i = 1;
                                foreach ($docarr as $value) { ?>
                                    <tr id="row1">
                                        <td style="width:200px;">
                                            <select name="documenttype[]" id="documenttype<?= $i ?>" class="form-control" index="<?= $i ?>" onchange="changeDocType(this)" required>
                                                <option value="">Select Document Type</option>
                                                <?php foreach ($docarr1 as $key => $val) { ?>
                                                    <option value="<?= $key ?>"><?= $val ?></option>
                                                <?php } ?>
                                            </select>
                                        </td>
                                        <td style="width:200px;">
                                            <div class="docnameinput<?= $i ?>" style="display:none">
                                                <input type="hidden" name="titletype[]" id="titletype<?= $i ?>" value="<?= $value['TitleType']; ?>">
                                                <input type="text" name="docname[]" id="docname<?= $i ?>" class="form-control" value="">
                                            </div>
                                            <div class="docnametext<?= $i ?>">
                                                <span>------</span>
                                            </div>
                                        </td>
                                        <td style="width:200px;">
                                            <div class="" style="width:170px;">
                                                <input type="file" name="docfile[]" id="docfile<?= $i ?>" index="<?= $i ?>" class="form-control" onchange="validateFileExtension(this, 'fileError<?= $i ?>');"  required>
                                                <p id="fileError<?= $i ?>" style="color: red;"></p>
                                            </div>
                                            <div class="" style="display:none">
                                                <a href="" class="">View</a>
                                            </div>

                                        </td>
                                        <td>
                                            <a href="javascript:void(0);" data-placement="top" title="Delete" class="removeButton tooltipLink view_text1">
                                                <i class="fa fa-minus-circle"></i>
                                            </a>
                                        </td>
                                    </tr>
                            <?php
                                    $i++;
                                }
                            } ?>
                        </tbody>
                    </table>
                    <div class="col-md-12" style="text-align:right;margin-bottom: 19px;margin-top: -14px;">
                        <a title="Add" class="tooltipLink" href="#" id="addButton"><i class="fa fa-plus"></i> add more doc</a>
                    </div>
                    <div class="col-md-12" style="text-align:right;padding-top: 5px;">
                        <button type="button" class="btn btn-primarygray btn-sm pull-left" data-dismiss="modal" id="cancelButton">Cancel</button>
                        <span id="showMsg"></span>
                        <button type="button" class="btn btn-primarygray" id="shareButton" >Share <i class="fa fa-share-alt"></i></button>
                        <button type="submit" class="btn btn-primary save-flight-btn">Submit</a>
                    </div>
                </form>
            </div>
        </div>
    </div>


    <!-- modal -->
    
    <div id="myModal" class="modal"> 
  <div class="modal-content">
    <!-- Modal content goes here -->
    <div class="modal-header">
        <button  id="closeModal2Button" class="close">&times;</button>
        <h4 class="modal-title" id="myModalLabel">Share Docs</h4>
    </div>
    <div class="modal-body">
                <form id="sharedocform" name="sharedocform" method="POST" enctype="multipart/form-data">
                <div class="row">
                <div class="col-md-12" style="margin-top:10px;">
                <input type="hidden" name="MembersDocumentSysId" id="selectedDocumentIds">
                <div class="col-md-4">
                <label for="Email">Email </label>
                <input type="email" name="recipientEmail" id="recipientEmail" value="" class="form-control">
                <span id="recipientEmailError" style="color:red"></span>
                </div>
                <div class="col-md-4">
                <label for="Customername">Name </label>
                <input type="text" name="recipientName" id="recipientName" value="" class="form-control">
                <span id="recipientNameError" style="color:red"></span>
                </div>
                <div class="col-md-4">
                <label >Mobile </label>
                <div class="txtfieldMain textfieldMain_mobile2 form-group" style="border: #0069ff 0px solid;">
                                           
                                            <div class="country_details2 country_box_wrap1">
                                                <div id="iti-flag_2" class="iti-flag <?php echo (isset($DefaultCountryCode) && $DefaultCountryCode == '+91') ? 'in' : ''; ?>"></div>
                                                <div class="iti-arrow"></div>
                                            </div>
                                            <div class="country_dropdown2">
                                                <div class="search_country">
                                                    <input type="text" name="" class="txtfield form-control countries_list2" placeholder="Search countries" id="countries_list2">
                                                    <div class="search_icon"></div>
                                                </div>
                                                <ul class="allcountries2"></ul>
                                            </div>
                                            <input type="text" class="txtfield country_code2 stdcode_padding country_box_wrap2" readonly="readonly" id="CountryCode1" name="countrycode" value="<?php echo (isset($DefaultCountryCode) && $DefaultCountryCode != '') ? trim($DefaultCountryCode) : ''; ?>">
                                            <input type="text" name="recipientMobile" id="recipientMobile" maxlength="15" value="" class="form-control" style="width: 165px !important; float: right; border-bottom:#0069ff 1px solid !important; ">
                                            <span id="recipientMobileError" style="color:red"></span>
                                        </div>
                </div>
</div>
<div class="col-md-12" style="text-align:right;padding-top: 35px;">
    <span id="shareStatusMessage"></span>
    <button type="button" class="btn btn-primary" id="shareEmailButton">Send Email</button>
    <button type="button" class="btn btn-success" id="shareWhatsappButton"><i class="fa fa-whatsapp"></i> Share on Whatsapp</button>
</div>
                        </div>
                </form>
</div>
  </div>
</div>
    <!-- end -->

    <script type="text/javascript">
        $(document).ready(function() {
            // add new row
            var counter = $('#counter').val();
            $("#addButton").click(function() {
                var newTextBoxTr = $('<tr>').attr("id", 'Row' + counter);
                newTextBoxTr.append(
                    <?php if (isset($memdocarray) && (count($memdocarray) > 0)) { ?>'<td ></td>'+  <?php } ?>
                    '<td style="width:200px;"><select name="documenttype[]" id="documenttype' + counter + '" index="' + counter + '" class="form-control" onchange="changeDocType(this)" required>' +
                    ' <option value="">Select Document Type</option>' +
                    '<?php foreach ($docarr1 as $k => $v) { ?>' +
                    '<option value="<?= $k ?>" ><?= $v ?> </option>' +
                    '<?php } ?>' +
                    '</select></td>' +
                    '<td style="width:200px;"><div class="docnameinput' + counter + '" style="display:none"><input type="hidden" name="titletype[]" id="titletype' + counter + '" value=""><input type="text" name="docname[]" id="docname' + counter + '" class="form-control" required></div><div class="docnametext' + counter + '"><span>------</span></div></td>' +
                    '<td style="width:200px;"><div class="" style="width:170px;"><input type="file" name="docfile[]" id="docfile' + counter + '" index="' + counter + '" class="form-control" onchange="validateFileExtension(this,\'fileError' + counter + '\');" required><p id="fileError' + counter + '" style="color: red;"></p></div></td>' +
                    '<td>' +
                    '<a href="javascript:void(0);" data-placement="top" title="Delete" index="' + counter + '" class="removeButton tooltipLink view_text1"><i class="fa fa-minus-circle"></i></a>' +
                    '</td>');
                newTextBoxTr.appendTo(".RowsGroup");
                counter++;
            });


            // remove row
            $(".RowsGroup").on('click', '.removeButton', function() {
                $(this).parent().parent().remove();
            });

            // submit form
            $('#memberdocform').submit(function(e) {
                e.preventDefault();
                var formArray = $(this).serializeArray();

                var docNameArray = formArray.filter(function(input) {
                    return input.name === 'documenttype[]';
                }).map(function(input) {
                    return input.value;
                });

                if (docNameArray.length === 0) {
                    // form is empty
                    alert("Please Add Document");
                    return false;
                }
                var valueToRemove = "7";
                for (var i = docNameArray.length - 1; i >= 0; i--) {
                    if (docNameArray[i] === valueToRemove) {
                        docNameArray.splice(i, 1);
                    }
                }
                if (hasDuplicates(docNameArray)) {
                    alert("Duplicate Document Not Allow");
                    return false;
                }
                var formData = new FormData(this);
                $.ajax({
                    type: 'POST',
                    url: '/customer/save-member-document-data',
                    data: formData,
                    processData: false,
                    contentType: false,
                    success: function(result) {
                        var data = JSON.parse(result);
                        if (data.status == true) {
                            $('#showMsg').html('File Uploaded Successfully').css({
                                'color': 'green'
                            });
                            window.location.reload();
                        } else {
                            $('#showMsg').html(data.msg).css({
                                'color': 'red'
                            });
                            return false;
                        }
                    },
                    error: function(xhr, status, error) {}
                });
            });
        });

        // duplicate check function
        function hasDuplicates(array) {
            const seen = {};
            for (let i = 0; i < array.length; i++) {
                const item = array[i];
                if (seen[item]) {
                    return true; 
                } else {
                    seen[item] = true;
                }
            }
            return false; 
        }

        function changeDocType(that) {
            var DocumentType = $(that).val();
            var index = $(that).attr('index');
            var documentselect = document.getElementById("documenttype" + index);
            var selectedOption = documentselect.options[documentselect.selectedIndex];
            var optionText = selectedOption.textContent;
            if (DocumentType == '7') {
                $('.docnameinput' + index).show();
                $('.docnametext' + index).hide();
                $('#titletype' + index).val(optionText);
                document.getElementById("docname" + index).required = true;
            } else {
                if (DocumentType) {
                    $('#docname' + index).val(optionText);
                    $('.docnameinput' + index).hide();
                    $('#titletype' + index).val(optionText);
                    $('.docnametext' + index).html(optionText).show();
                } else {
                    $('.docnametext' + index).html('---------').show();
                }
            }
        }

        function removeDocFile(index) {
            var confirmation = confirm("Are you sure you want to Update this item?");
            if (confirmation) {
            document.querySelector('.docfileview' + index).style.display = 'none';
            document.querySelector('.docfileinput' + index).style.display = 'block';
            document.getElementById('docfile' + index).value = '';
            document.getElementById('docfile' + index).required = true;
            document.getElementById('remove' + index).style.display = 'none';
            }
        }

        function deleteItem(documentId) {
            var confirmation = confirm("Are you sure you want to delete this item?");
            if (confirmation) {
                $.ajax({
                    type: 'POST',
                    url: '/customer/delete-member-document',
                    data: {
                        documentId: documentId
                    },
                    success: function(result) {
                        var data = JSON.parse(result);
                        if (data.status === true) {
                            alert(data.msg);
                            window.location.reload();
                        } else {
                            alert('Document deletion failed: ' + data.msg);
                        }
                    },
                    error: function(xhr, status, error) {
                        alert('An error occurred while deleting the document.');
                    }
                });
            }
        }

        function validateFileExtension(inputElement, errorId) {
            var allowedExtensions = ['.pdf', '.jpg', '.jpeg']; // Define the allowed file extensions
            var maxFileSize = 2 * 1024 * 1024; // 2MB in bytes

            var fileInput = inputElement;
            var fileError = document.getElementById(errorId);

            if (fileInput.files.length > 0) {
                var fileName = fileInput.files[0].name;
                var fileExtension = fileName.slice(((fileName.lastIndexOf(".") - 1) >>> 0) + 2);
                var fileSize = fileInput.files[0].size;

                if (allowedExtensions.indexOf('.' + fileExtension.toLowerCase()) === -1) {
                    fileInput.value = '';
                    fileError.textContent = 'Invalid file type. Allowed extensions are: ' + allowedExtensions.join(', ');
                    return;
                } else if (fileSize > maxFileSize) {
                    fileInput.value = '';
                    fileError.textContent = 'File size exceeds the maximum allowed size of 2MB.';
                    return;
                } else {
                    fileError.textContent = '';
                }
            }
        }

  $(document).ready(function () {
    updateShareButtonState();
    $('.share-checkbox').change(function () {
      updateShareButtonState();
    });
    function updateShareButtonState() {
      var anyChecked = $('.share-checkbox:checked').length > 0;
      if (anyChecked) {
        $('#shareButton').show();
      } else {
        $('#shareButton').hide();
      }
    }


    $("#shareButton").on("click", function () {
      var selectedIds = [];
      $("input.share-checkbox:checked").each(function () {
        var checkboxId = $(this).attr("id");
        var memberId = checkboxId.substring(8);
        var hiddenInputValue = $("#MembersDocumentSysId" + memberId).val();
        selectedIds.push(hiddenInputValue);
      });
      if (selectedIds.length === 0) {
        alert("Please select at least one document.");
      } else {
        $("#selectedDocumentIds").val(selectedIds.join(", "));
        openModal();
      }
    });
// share doc on Email
    $("#shareEmailButton").on("click", function () {
      var recipientEmail = $("#recipientEmail").val();
      var recipientName = $("#recipientName").val();
      var memberCustSysId = $("#memberCustSysId").val();
      var CustomerSysId = $("#CustomerSysId").val();
      var selectedDocumentIds = $("#selectedDocumentIds").val();
    if (!validateEmail(recipientEmail)) {
        $("#recipientEmailError").text("Please enter a valid recipient's email address.");
        return;
      }
      if (!recipientName) {
        $("#recipientNameError").text("Please enter Name.");
         return; 
    }
    $("#recipientEmailError").text("");
      $.ajax({
        url: '/customer/share-doc-by-email',
        method: "POST",
        data: {
          recipientEmail: recipientEmail,
          recipientName: recipientName,
          memberCustSysId: memberCustSysId,
          CustomerSysId: CustomerSysId,
          selectedDocumentIds: selectedDocumentIds,
        },
        success: function (response) {
            var data = JSON.parse(response);
           if (data.status === true) {
             $("#shareStatusMessage").text(data.msg).css("color", "green");
           } else{
            $("#shareStatusMessage").text(data.msg).css("color", "red");
           }
        },
        error: function () {
          alert("An error occurred while sharing the document via email.");
        }
      });
    });

    // share doc on whatsapp
    $("#shareWhatsappButton").on("click", function () {
      var recipientName = $("#recipientName").val();
      var countrycode = $("#CountryCode1").val();
    var recipientMobile = $("#recipientMobile").val();
      var memberCustSysId = $("#memberCustSysId").val();
      var CustomerSysId = $("#CustomerSysId").val();
      var selectedDocumentIds = $("#selectedDocumentIds").val();
      if (!recipientName) {
        $("#recipientNameError").text("Please enter Name.");
         return; 
    }
      if (!recipientMobile) {
        $("#recipientMobileError").text("Please enter Mobile Number.");
         return; 
    }

    $.ajax({
    url: '/customer/share-doc-by-whatsapp',
    method: "POST",
    data: {
        recipientName: recipientName,
        countrycode: countrycode,
        recipientMobile: recipientMobile,
        memberCustSysId: memberCustSysId,
        CustomerSysId: CustomerSysId,
        selectedDocumentIds: selectedDocumentIds,
    },
    success: function (response) {
        var data = JSON.parse(response);
        if (data.status === true) {
            $("#shareStatusMessage").text(data.msg).css("color", "green");
            window.open('https://api.whatsapp.com/send?phone=' + data.contactno + '&text=' + encodeURIComponent(data.whatsapp), '_blank');
        } else {
            $("#shareStatusMessage").text(data.msg).css("color", "red");
        }
    },
    error: function () {
        alert("An error occurred while sharing the document via email.");
    }
});
    });

    $('#closeModal2Button').click(function () {
        closeModal()
    });

  });

  function openModal() {
      $("#myModal").css("display", "block");
    }

    function closeModal() {
      $("#myModal").css("display", "mone");
    }

    function validateEmail(email) {
    var emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
    return emailPattern.test(email);
  }

</script>
</div>

Youez - 2016 - github.com/yon3zu
LinuXploit