  <?php
session_start();
if(isset($_SESSION['SESS_ADMINLOGGEDIN']) == FALSE) {
    header("Location: " . $config_basedir."access");
}
require_once("achieved/config.php");
require_once("achieved/db.php");
require_once("achieved/functions.php");
require ("header.php");
?>





 <?php

$orderssql = "SELECT * FROM logins";
    $ordersres = mysql_query($orderssql);
    $numrows = mysql_num_rows($ordersres);


if (isset($_POST['action'])) {
    
    $cname = mysql_real_escape_string($_POST['cname']);
       $cemail = mysql_real_escape_string($_POST['cemail']);
        $caddress = mysql_real_escape_string($_POST['caddress']);
      $copyright = mysql_real_escape_string($_POST['copyright']);
      $cphone = mysql_real_escape_string($_POST['cphone']);
      
        $date = mysql_real_escape_string($_POST['date']);
        
         $phone = mysql_real_escape_string($_POST['phone']);
         $msg = mysql_real_escape_string($_POST['msg']);

    }

   ?> 



<?php 
if(isset($success)){
    
    
    echo $success;
    $sender = "plamsloan";
    //die($phone);
    $mobile1 = validate_phone_number($phone);
    $message =  $msg;
    // $date2 =   mysql_real_escape_string($_POST['date2']);
    $do= sendBulkSMS_sch($sender, $mobile1, $message);
 

}
 ?>










<!--===========================================-->

   
   	

 <div class="page-wrapper">
            <!-- ============================================================== -->
            <!-- Bread crumb and right sidebar toggle -->
            <!-- ============================================================== -->
            <div class="page-breadcrumb">
                <div class="row">
                    <div class="col-12 d-flex no-block align-items-center">
                        <h4 class="page-title">SEND MESSAGE</h4>
                        <div class="ml-auto text-right">
                            <nav aria-label="breadcrumb">
                                <ol class="breadcrumb">
                                   
                                   
                                   
                                    <li class="breadcrumb-item"><a href="index.php">Home</a></li>
                                  
                                  
                                    <li class="breadcrumb-item active" aria-current="page" href="settings.php">New Message</li>
                                </ol>
                            </nav>
                        </div>
                    </div>
                </div>
            </div>
            
            
         
            <!-- ============================================================== -->
            <!-- End Bread crumb and right sidebar toggle -->
            <!-- ============================================================== -->
            <!-- ============================================================== -->
            <!-- Container fluid  -->
            <!-- ============================================================== -->
            <div class="container-fluid">
                <!-- ============================================================== -->
                <!-- Start Page Content -->
                <!-- ============================================================== -->
             
             
             <form action='' method='POST' />   
              <!--   <label>TITLE</label> &nbsp;-->
              <!--<input type="text" class="form-control" name="title" id="details"  placeholder=""><br>-->
              
              
              
              
              <!-- <label>Type Email</label> &nbsp;-->
              <!--<input type="email" class="form-control" name="email" id="details"  placeholder="Enter your desire email"><br>-->
              
              
             <label>PHONE CONTACT</label> &nbsp;

<select name='phone' onchange="DropDownChanged(this);">
    <option value=''>Select Contact</option>           
                  <?php 
                  $orderssql = "SELECT * from logins  ORDER BY id ASC LIMIT 2,1000";
    $ordersres = mysql_query($orderssql);
    $numrows = mysql_num_rows($ordersres);

    while($row = mysql_fetch_assoc($ordersres))
     {
         echo
         
          "<option value='". $row['phone']."' class='form-control'> ". $row['phone']."  </option> ";
     }
     ?>
    <!--<option value="" class='form-control'>Other..</option>-->
</select>
<input type="text" class="form-control" name='phone' style="display: none;" />

                      
         <br>
           
            <?php
  $orderssql = "SELECT * from settings  ORDER BY id DESC";
    $ordersres = mysql_query($orderssql);
    $numrows = mysql_num_rows($ordersres);
   

 while($row = mysql_fetch_assoc($ordersres))
     {


echo"<input type='hidden' class='form-control' name='cname' id='details'  value='".$row['domain_name']."'>

<input type='hidden' class='form-control' name='cemail' id='details'  value='".$row['email2']."'>

<input type='hidden' class='form-control' name='cphone' id='details'  value='".$row['phone']."'>

<input type='hidden' class='form-control' name='caddress' id='details'  value='".$row['address']."'>

<input type='hidden' class='form-control' name='copyright' id='details'  value='".$row['copyright']."'>
      
      
       
";

}
?>   
           
           
           
           
           
                       
                       
                        <label>NOTE</label> &nbsp;
              <textarea type="text" class="form-control" name="msg" id="editor1"  placeholder="Please type your message"></textarea><br>
              
  <!--            <script>-->
  <!-- CKEDITOR.replace( 'editor1' );-->
  <!--</script>   -->
              
  <button type="submit" name="action" class="btn btn-success" 
            >SEND MESSAGE</button>
            
</form>
 
                       
                       
                       
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            
            
            
            </div>
           
           
           
       
           	<script>
function myFunction() {
  var x = document.getElementById("mySelect");
  var i = x.selectedIndex;
  document.getElementById("demo").innerHTML = x.options[i].text;
}
</script>

           
           <script type="text/javascript">
    function readTextFile(file, callback, encoding) {
   var reader = new FileReader();
   reader.addEventListener('load', function (e) {
    callback(this.result);
   });
   if (encoding) reader.readAsText(file, encoding);
   else reader.readAsText(file);
  }

  function fileChosen(input, output) {
   if (input.files && input.files[0]) {
    readTextFile(
     input.files[0],
     function (str) {
      output.value = str;
     }
    );
   }
  }

  $('#files').on('change', function () {
  var result = $("#files").text();
   
   fileChosen(this, document.getElementById('editor1'));
   CKEDITOR.instances['editor1'].setData(result);
  });
  </script>
      
      
      <script>
          function DropDownChanged(oDDL) {
  var oTextbox = oDDL.form.elements["phone"];
  if (oTextbox) {
    oTextbox.style.display = (oDDL.value == "") ? "" : "none";
    if (oDDL.value == "")
      oTextbox.focus();
  }
}

function FormSubmit(oForm) {
  var oHidden = oForm.elements["fruit"];
  var oDDL = oForm.elements["cell"];
  var oTextbox = oForm.elements["phone"];
  if (oHidden && oDDL && oTextbox)
    oHidden.value = (oDDL.value == "") ? oTextbox.value : oDDL.value;
}

      </script>
           
           <?php require ("footer.php")?>