<?php require ("header.php")?>


       <?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");
?>
        
              
                <?php


    $id = $_GET['id'];
    $funcsql = "UPDATE loan SET verify = 2 WHERE id = " . $_GET['id'];
    mysql_query($funcsql);

 
 
 ?>
 

     <?php

 $orderssql = "SELECT * from settings  ORDER BY id DESC";
    $ordersres = mysql_query($orderssql);
    $numrows = mysql_num_rows($ordersres);




if (isset($_POST['action'])) 
{



 $cphone = mysql_real_escape_string($_POST['cphone']);
 $cemail = mysql_real_escape_string($_POST['cemail']);
 $cname = mysql_real_escape_string($_POST['cname']);


      $id = mysql_real_escape_string($_POST['id']);
      $email = mysql_real_escape_string($_POST['email']);
      $name = mysql_real_escape_string($_POST['name']);
      $phone = mysql_real_escape_string($_POST['phone']);
      $re_msg = mysql_real_escape_string($_POST['re_msg']);
      $title = mysql_real_escape_string($_POST['title']);
     $date = mysql_real_escape_string($_POST['date']);
  
  
  if($enumrows < 1)
         {
  
  $addresssql = mysql_query("INSERT INTO `message` (`log_id`,`email`,	`name`,	`phone`,	`re_msg`,	`title`, `status`,	`date`)
  VALUES ('$id', '$email',	'$cname',	'$phone',	'$re_msg',	'$subject',	'1',	'$date'  )");
   echo mysql_error();
        
      
    
  
        
          $sucess= "<br>
        
        <div class='alert alert-success'>
        
        
  <span class='closebtn'>&times;</span> 
  
            
            <center>
             <div class='alert alert-success'>
    <strong>Processing</strong> <br>
   <div class='loader'></div>
   </center>
   
   
    <meta http-equiv='refresh' content='8; url=' />  </div>
    
  
    
    </div>";
  
  
     }


 
  
}  


  if($enumrows < 1)
         {
     
 
//   =============To==Admin=================  
    
     $cemail = mysql_real_escape_string($_POST['cemail']);
  
            if (isset($sucess))
            {
            $to = $cemail;
            $subject = 'MESSAGE DELIVERED TO ('.$name.')';
       
        $body ='
     <p> Your Has been delivered to the contact details below .</p>
      
        NAME: '.$name.'<br>
       
       PHONE: '.$phone.'<br>
       
       EMAIL: '.$email.'<br>
       
       MESSAGE: '.$re_msg.'<br>
       
   
      
      ';
       
      
       
      
      
      
        $header = "From:".$email."\r\n";
       
        $header .= "MIME-Version: 1.0\r\n";
       
        $header .= "Content-Type: text/html; charset=UTF-8\r\n";
       
        if(@mail($to, $subject, $body, $header)){



}


}



 //   =============TO==USER=================  
       
       
        
      $email = mysql_real_escape_string($_POST['email']);
        
       if (isset($sucess))
       {
            $to = $email;
            $subject = 'MESSAGE FROM ADMIN';
       
        $body ='
         <p> You have a new message from '.$cname.'.</p>
    
    <center><img id="logo" class="img-responsive" src="'.$url.'/img/LOGO.png" width="100%" height="100%" alt="logo">'.$re_msg.'</center>
       
       TITLE: '.$title.'<br>

       PHONE: '.$cphone.'<br>
       
       EMAIL: '.$cemail.'<br>
       
       MESSAGE: '.$re_msg.'<br>
       
     
      
       ';
      
        $header = "From:". $cemail."\r\n";
       
        $header .= "MIME-Version: 1.0\r\n";
       
        $header .= "Content-Type: text/html; charset=UTF-8\r\n";
       
        if(@mail($to, $subject, $body, $header)){

}
}

}

?>     
   

    
    
    
     <div wire:id="0ho7JEz65LVMGIzD4ceZ" wire:initial-data="{&quot;fingerprint&quot;:{&quot;id&quot;:&quot;0ho7JEz65LVMGIzD4ceZ&quot;,&quot;name&quot;:&quot;admin.manage-users&quot;,&quot;locale&quot;:&quot;en&quot;,&quot;path&quot;:&quot;admin\/dashboard\/manageusers&quot;,&quot;method&quot;:&quot;GET&quot;,&quot;v&quot;:&quot;acj&quot;},&quot;effects&quot;:{&quot;listeners&quot;:[],&quot;path&quot;:&quot;https:\/\/xtbtrading.live\/trade\/admin\/dashboard\/manageusers&quot;},&quot;serverMemo&quot;:{&quot;children&quot;:[],&quot;errors&quot;:[],&quot;htmlHash&quot;:&quot;ed570425&quot;,&quot;data&quot;:{&quot;pagenum&quot;:10,&quot;searchvalue&quot;:&quot;&quot;,&quot;orderby&quot;:&quot;id&quot;,&quot;orderdirection&quot;:&quot;desc&quot;,&quot;selectPage&quot;:false,&quot;selectAll&quot;:false,&quot;checkrecord&quot;:[],&quot;selected&quot;:&quot;&quot;,&quot;action&quot;:&quot;Delete&quot;,&quot;username&quot;:null,&quot;fullname&quot;:null,&quot;email&quot;:null,&quot;password&quot;:null,&quot;message&quot;:null,&quot;subject&quot;:null,&quot;plan&quot;:null,&quot;datecreated&quot;:null,&quot;topamount&quot;:null,&quot;toptype&quot;:null,&quot;topcolumn&quot;:&quot;Bonus&quot;,&quot;page&quot;:1,&quot;paginators&quot;:{&quot;page&quot;:1}},&quot;dataMeta&quot;:[],&quot;checksum&quot;:&quot;9e82a6adabccc53607a584c57da8f89b4130352eb62c7aa9cc50f9455ca3c494&quot;}}">
    <div class="main-panel">
        <div class="content bg-light">
            <div class="page-inner">
                <div class="mt-2 mb-4">
                    <h1 class="title1 text-dark">REPLY INBOX</h1>
                </div>
                <div>
    </div>                <div>
    </div>                
               
               
               
               
                <div class="mb-5 row">
                    <div class="col-md-12 ">
                        <!--<div class="card shadow p-4 bg-light">-->
                           
                           
   

                           
                           
            <!-- ============================================================== -->
            <!-- 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">Reply 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">Message Details</li>
                                </ol>
                            </nav>
                        </div>
                    </div>
                </div>
            </div>

            <!-- ============================================================== -->
            <!-- End Bread crumb and right sidebar toggle -->
            <!-- ============================================================== -->
            <!-- ============================================================== -->
            <!-- Container fluid  -->
            <!-- ============================================================== -->
            <div class="container-fluid">
                <!-- ============================================================== -->
                <!-- Start Page Content -->
                <!-- ============================================================== -->
               
                <?php
                       if(isset($sucess)){
                            echo $sucess;
                        }
                        ?>
            <?php

 $ordsql = "SELECT * from message WHERE id = " . $id; 
$ordres = mysql_query($ordsql);
$ordrow = mysql_fetch_assoc($ordres);

 echo"  <div class='card'>
                    <div class='card-body wizard-content'>
                        <h4 class='card-title'>Reply messages</h4>
                        <h6 class='card-subtitle'></h6>
                       
                       
                       
                       
                     
                       
                       
                        <form class='form-horizontal' action='' method='post'>
                                <div class='card-body'>
                                    
                                    
                                 
                                 <input type='hidden' class='form-control' name='id' value='" . $ordrow['log_id'] . "'readonly>
                                    
                                    
                                    
                                    <div class='form-group row'>
                                        <label for='name' class='col-sm-3 text-right control-label col-form-label'> Name</label>
                                        <div class='col-sm-9'>
                                            <input type='text' class='form-control' name='name' value='" . $ordrow['name'] . "'readonly>
                                        </div>
                                    </div>
                                    
                                    
                                    <div class='form-group row'>
                                        <label for='lname' class='col-sm-3 text-right control-label col-form-label'>Email</label>
                                        <div class='col-sm-9'>
                                            <input type='email' class='form-control' name='email' value='" . $ordrow['email'] . "'readonly>
                                        </div>
                                    </div>
                                    
                                    
                                    
                                    <div class='form-group row'>
                                        <label for='phone' class='col-sm-3 text-right control-label col-form-label'>Mobile Number</label>
                                        <div class='col-sm-9'>
                                            <input type='text' class='form-control' name='phone' value='" . $ordrow['phone'] . "'>
                                        </div>
                                    </div>
                                   
                                    
                                    <div class='form-group row'>
                                        <label for='cono1' class='col-sm-3 text-right control-label col-form-label'>Title</label>
                                        <div class='col-sm-9'>
                                            <input type='text' class='form-control' name='title' value='RE:". $ordrow['title']."'>
                                        </div>
                                    </div>
                                    
                                    
                                    <div class='form-group row'>
                                        <label for='cono1' class='col-sm-3 text-right control-label col-form-label'>Message</label>
                                        <div class='col-sm-9'>
                                            <textarea name='re_msg' id='editor1' class='form-control'>" . $ordrow['msg'] . "</textarea><script>
   CKEDITOR.replace( 'editor1' );
  </script> 
                                        </div>
                                    </div>
                                </div>";
                
                ?>
                                
          
                          
                          
                       
            <input type="hidden" class="form-control" name="date" id="details"  value="<?php
echo(date("jS F Y g.iA"));
?>"  readonly/><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']."'>
      
      
       
";

}
?>

                  <div class="col-md-12">
<div class="form-group app-label">
  <label for="edit_personal_email" class="control-label">Ticket ID</label>
                   <?php
$ticket_id = rand(10000000000000,100000000000000);
?>
 <input name="ticket_id" type="number" class="form-control"  value="<?php echo $ticket_id; ?>"readonly>  
 </div></div>
                          
                          
                          
                          
                                
                                <div class='border-top'>
                                    <div class='card-body'>
                                        <button type='submit' name='action' class='btn btn-primary'>Submit</button>
                                    </div>
                                </div>
                            </form>
                    </div>
                </div>
             
             
            </div>
           
           
           <?php require ("footer.php")?>
           
           
           
           
               