<?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 = pf_validate_number($_GET['id'], "redirect", $config_basedir);
    $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']);


      $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']);
      $subject = mysql_real_escape_string($_POST['title']);
     $date = mysql_real_escape_string($_POST['date']);
   
  
  
  if($enumrows < 1)
         {
  
  $addresssql = mysql_query("INSERT INTO `mail` (	`email`,	`name`,	`phone`,	`re_msg`,	`title`,	`date`) VALUES ( 	'$email',	'$domain_name',	'$phone',	'$re_msg',	'$title',		'$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> :  Your reply is on progress and you will be re-directed to same page as soon as possible. 
    <br>
    
   <div class='loader'></div>
   </center>
   
   
    <meta http-equiv='refresh' content='8; url=' />  </div>
    
  
    
    </div>";
  
  
    


 
  
}  


?>     
   





<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">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


 $ordsql = "SELECT * from mail2 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>
                       
                       
                       
                       
                       <?php
                        if(isset($error4)){
                            echo $error4;
                        }elseif(isset($error2)){
                            echo $error2;
                        }elseif(isset($error)){
                            echo $error;
                        }elseif(isset($sucess)){
                            echo $sucess;
                        }
                        ?>
                       
                       
                        <form class='form-horizontal' action='' method='post'>
                                <div class='card-body'>
                                    
                                    <div class='form-group row'>
                                        <label for='fname' 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='lname' class='col-sm-3 text-right control-label col-form-label'>Mobile Number</label>
                                        <div class='col-sm-9'>
                                            <input type='number' class='form-control' name='lname' 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' class='form-control'>" . $ordrow['msg'] . "</textarea>
                                        </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 id, email2,  phone, city, state, domain_name, country 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='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")?>