PK

ADDRLIN : /home/questend/public_html/domains/rwa40.com/admin/email/
FLL :
Current File : /home/questend/public_html/domains/rwa40.com/admin/email/index.php

<?php
   ob_start();
   //error_reporting(E_ALL ^ E_NOTICE);
   @session_start();
   ini_set('allow_url_include',1);    
   date_default_timezone_set("Asia/Kolkata");
   set_time_limit(600);
   ini_set('max_execution_time',600);
   include '../includes/settings/constant.php';
   require_once '../includes/settings/PDODB.php';
   include '../includes/modules/functions.php';

   // Include PHPMailer files (adjust path as needed)
    require_once '../includes/modules/src/Exception.php';
    require_once '../includes/modules/src/PHPMailer.php';
    require_once '../includes/modules/src/SMTP.php';

    use PHPMailer\PHPMailer\PHPMailer;
    use PHPMailer\PHPMailer\Exception;

   $function = new FUNCTIONS();

   if (!empty($_SESSION['adminId']) && !empty($_SESSION['admin_role_id'])) {
     if($_SESSION['admin_role_id']==1){
      //header("Location: index.php");
    }elseif($_SESSION['admin_role_id']==2){
      header("Location: ../dashboard/index.php");
    }
   }else{
    header("Location: ../index.php");
    exit();
   }
      
  if(isset($_POST['btnSendmail']) && !empty($_POST)){
      $send_to = !empty($_POST['send_to']) ? trim($_POST['send_to']) : "";

      // Get recipient emails
      $addresses = [];
      if ($send_to == 1) {
          $AllOfficeBearers = $function->getOfficeBearers($id=NULL, $isactive=1, $office_past_current=1, $orderBy='ASC');
          foreach($AllOfficeBearers as $row) {
              if (!empty($row['email'])) {
                  $addresses[] = $row['email'];
              }
          }
      } else {
          $result = $function->getUsers(NULL, NULL, NULL, 1);
          foreach($result as $row) {
              if (!empty($row['email'])) {
                  $addresses[] = $row['email'];
              }
          }
      }
      
      $subject = !empty($_POST['subject']) ? trim($_POST['subject']) : "";
      $message = !empty($_POST['message']) ? trim($_POST['message']) : "";
      
      $mail = new PHPMailer(true);
      
      try {
          // Server settings
          $mail->isSMTP();
          $mail->Host       = 'smtp.gmail.com';
          $mail->SMTPAuth   = true;
          $mail->Username   = "indusinfotek.vinay@gmail.com";       //SMTP username
          $mail->Password   = "pojdvqsuozvohirf";
          $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
          $mail->Port       = 587;
          
          // Recipients
          $mail->setFrom('rwasector@gmail.com', 'RWA Sector 40');
          foreach ($addresses as $address) {
              $mail->addAddress($address);
          }
          
          // Attachments
          if(isset($_FILES["file"]) && $_FILES["file"]["name"] != "") {
              $mail->addAttachment(
                  $_FILES["file"]["tmp_name"],
                  $_FILES["file"]["name"]
              );
          }
          
          // Content
          $mail->isHTML(true);
          $mail->Subject = $subject;
          $mail->Body    = $message;
          
          $mail->send();
          $statusMsg = "Email sent successfully";
      } catch (Exception $e) {
          $statusMsg = "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
      }
  }
?>
<!DOCTYPE html>
<html>
   <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>RWA | Sector 40</title>
      <?php include_once '../layout/style.php'; ?>
   </head>
   <body>
      <div id="wrapper">
        <?php $currentPage = 'email'; include_once '../layout/side-bar.php'; ?>
         <div id="page-wrapper" class="gray-bg">
            <?php include_once '../layout/header.php'; ?>
            <div class="row wrapper border-bottom white-bg page-heading">
               <div class="col-sm-6">
                  <h2>Email</h2>                
               </div>
            </div>
            <div class="row">
               <div class="col-lg-12">
                  <div class="ibox float-e-margins">
                    <div class="ibox-title  back-change">
                        <?php if (!empty($statusMsg)) { ?>
                          <div class="alert alert-success" id="alert-success">
                            <a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">×</a>
                            <strong><?=$statusMsg;?></strong>
                          </div>
                        <?php } ?>
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                          <form method="POST" action="" enctype="multipart/form-data" id="sendMail">
                            <div class="col-sm-6 b-r">
                              <div class="form-group"><label>Send to</label> 
                                <select class="form-control" id="send_to" name="send_to">
                                  <option value="">--Select--</option>
                                  <option value="2">All member</option>                          
                                  <option value="1">Current Office member</option>
                                </select>
                              </div>
                              <div class="form-group"><label>Mail Subject</label> <input type="text" name="subject" id="subject" class="form-control">
                              </div>
                              <div class="form-group"><label>Description</label> <textarea class="form-control" rows="5" id="message" name="message"></textarea>
                              </div>                              
                              <div>
                                <button class="btn btn-sm btn-primary pull-right m-t-n-xs" name="btnSendmail" id="btnSendmail" type="submit"><strong>Submit</strong></button>
                              </div>
                            </div>
                            <div class="col-sm-6">
                              <label for="basic-url">Attach you file</label>
                              <div class="input-group">                                
                                <input type="file" class="form-control custom-file-input" id="file" name="file" aria-describedby="basic-addon3">
                              </div>
                            </div>                           
                          </form>
                        </div>
                    </div>
                </div>
               </div>
            </div>
         </div>         
      </div>
      <?php include_once '../layout/script.php'; ?>
      <script type="text/javascript">
        $('#data_5 .input-daterange').datepicker({
            keyboardNavigation: false,
            forceParse: false,
            autoclose: true
        });
      </script>
      <script>
         function tossterMsgAlert(msg='Welcome',title='') {
             toastr.options = {
                 closeButton: true,
                 //debug: false,
                 newestOnTop: false,
                 //progressBar: false,
                 positionClass: 'toast-top-center',
                 preventDuplicates: true,
                 //onclick: null,
                 //showDuration: 300,
                 //hideDuration: 1000,
                 timeOut: 2000,
                 //extendedTimeOut: 1000,
                 //showEasing: 'swing',
                 //hideEasing: 'linear',
                 //showMethod: 'fadeIn',
                 hideMethod: 'fadeOut'
             };
             toastr.warning(title,msg);
         }
      </script>
      <!-- Page-Level Scripts -->      
      <script type="text/javascript">     
        $("#sendMail").validate({
          rules: {              
              subject: {
                  required: true
              },
              message: {
                required: true
              },
              send_to: {
                required: true
              }
          },
          messages: {              
              subject: {
                  required: "Email subject"
              },
              message: {
                  required: "Please enter the Description"
              },
              send_to: {
                  required: "Please select"
              } 
          },
          submitHandler: function(form) { 
            form.submit();
          }
        });
      </script>
      <script>
         // Add the following code if you want the name of the file appear on select
         $(".custom-file-input").on("change", function() {
           var fileName = $(this).val().split("\\").pop();
           $(this).siblings(".custom-file-label").addClass("selected").html(fileName);
         });
      </script>
      <script type="text/javascript"> 
          setTimeout(function () { 
    
              // Closing the alert 
              $('#alert-success').alert('close'); 
          }, 5000); 
      </script>
   </body>
</html>


PK 99
E-SHOP || DASHBOARD
404

Page Not Found

It looks like you found a glitch in the matrix...

← Back to Home