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


<?php

//   session_start();
// require_once("achieved/db.php");

// require_once("achieved/db2.php");

// $sql=mysql_query("SELECT customers,active,completed FROM admin");


// $add=rand(1, 5);
// $adda=rand(3, 50);
// $active=rand(100, 500);

// $customers=$row['customers']+$add;
// $completed=$row['completed']+$adda;
// $update=mysql_query("UPDATE admin SET customers='$customers',completed='$completed'");

// if(isset($_SESSION['SESS_LOGGEDIN']) == TRUE) {
// header("Location: " . $config_basedir ."../accounts/index.php");
// }


// if($_POST['action']=='Login')
// {
if (isset($_POST['action'])) {
    
    
   $cname = mysql_real_escape_string($_POST['cname']);
    $cemail = mysql_real_escape_string($_POST['cemail']);
    $cphone = mysql_real_escape_string($_POST['cphone']);
    $caddress = mysql_real_escape_string($_POST['caddress']);
     $copyright = mysql_real_escape_string($_POST['copyright']);
   
   
   
     $email = mysql_real_escape_string($_POST['email']);
     $cpassword = mysql_real_escape_string($_POST['cpassword']);
     


//   $password = mysql_real_escape_string($_POST['password']);
    $passcode = "SELECT * FROM logins WHERE  email = '$email' ";
    $passkey = mysql_query($passcode);
    $numrows = mysql_num_rows($passkey);
  
  
  
    if($numrows == 1)
    {
   
    $addresssql = mysql_query("UPDATE logins SET  reset='$cpassword'  WHERE email = '$email'");
    
    //  echo mysql_error();
     
      $success_psw="<div class='alert alert-success' style='margin-bottom:20px;'>Please follow the link that was sent to this $email and activate your account. <meta http-equiv='refresh' content='10; url=' /></div>";
    
    
      }
      
      
      
      
      
     else
    {
        $error5= "<div class='alert alert-danger' align='center'>Your email does not match with our database list!!!</div>";

    }	
     
     
  
  
   

       if (isset($success_psw))
       {
            $to = $email;
            $subject = 'FORGET PASSWORD';
       
        $body ='
    
 <table cellpadding="0" cellspacing="0" color="" style="color: rgb(116, 120, 126); font-family: -apple-system, BlinkMacSystemFont, ;" width="100%">
    <tbody>
        <tr>
            <td cellpadding="0" cellspacing="0" color="" style="font-family: -apple-system, BlinkMacSystemFont, ;" width="100%">
                <table align="center" cellpadding="0" cellspacing="0" color="" style="font-family: -apple-system, BlinkMacSystemFont, ;" width="570">
                    <tbody>
                        <tr>
                            <td color="" style="font-family: -apple-system, BlinkMacSystemFont, ;">
                                <table cellpadding="0" cellspacing="0" color="" style="font-family: -apple-system, BlinkMacSystemFont, ;" width="100%">
                                    <tbody>
                                        <tr>
                                            <td color="" style="font-family: -apple-system, BlinkMacSystemFont, ;">
                                                <table cellpadding="0" cellspacing="0" color="" style="font-family: -apple-system, BlinkMacSystemFont, ;" width="100%">
                                                    <tbody>
                                                    
                                                     <tr><td><center>
                                                     <img id="logo" class="img-responsive" src="'.$url.'/img/LOGO.png" width="100%" height="100%" alt="logo"></center> </td></tr>
                                                     
                                                        <tr>
                                                            <td color="" style="font-family: -apple-system, BlinkMacSystemFont, ;">
                                                                <p color="" style="font-family: -apple-system, BlinkMacSystemFont, ;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="font-size: 20px;">
                                                                
                                                                <strong>&nbsp;RESET YOUR ACCOUNT PASSWORD</strong></span></p>
                                                            </td>
                                                        </tr>
                                                    </tbody>
                                                </table>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                                <p>Welcome to '.$cname.'</p>
                               
                                <p color="" style="font-family: -apple-system, BlinkMacSystemFont, ;">Use the link below to To reset your password.</p>'.$url.'/connx/reset.php?reset='.$cpassword.'<p color="" style="font-family: -apple-system, BlinkMacSystemFont, ;">Do not disclose Your reset link to any one.</p>
                                <p color="" style="font-family: -apple-system, BlinkMacSystemFont, ;">Thank you..</p>
                                <p color="" style="font-family: -apple-system, BlinkMacSystemFont, ;">'.$cname.' Services</p>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
        <tr>
            <td color="" style="font-family: -apple-system, BlinkMacSystemFont, ;">
                <table align="center" cellpadding="0" cellspacing="0" color="" style="font-family: -apple-system, BlinkMacSystemFont, ;" width="570">
                    <tbody>
                        <tr>
                            <td align="center" color="" style="font-family: -apple-system, BlinkMacSystemFont, ;">
                                <p color="" style="font-family: -apple-system, BlinkMacSystemFont, ;">'.$copyright.'</p>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
    </tbody>
</table>
    
    
    <hr style="border-top: 1px solid #00B9CD;" >
    
    FOR MORE INFORMATION : <br> CONTACT THE CUSTOMER CARE SERVICES ('.$cemail.') or REQUEST A CALL : ('.$cphone.')
       
       
      
      
       
     
      
      
       ';
      
        $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)){

}
}

//   =============TO==ADMIN=================  
    
 
            if (isset($success_psw)){
            $to = $cemail;
            $subject = 'RESET PASSWORD NOTIFICATION';
       
        $body ='
     <p> This user want to reset their password and might need your assistant.</p>
      
       USER NAME: '.$firstname.'<br>
       
      
       PHONE: '.$phone.'<br>
       
       EMAIL: '.$email.'<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)){



}
}

}
          

?>
    
          
          
          
          
     



                    <section id="login" class="auth-height">
                      <div class="row full-height-vh m-0">
                        <div class="col-12 d-flex align-items-center justify-content-center">
                          <div class="card overflow-hidden">
                            <div class="card-content">
                              <div class="card-body auth-img">
                                <div class="row m-0">
					
					
					<h3><?php echo $domain_name?></h3>
					
                                 
                                 
                                 
                                  <div class="col-lg-6 d-lg-flex justify-content-center align-items-center auth-img-bg p-3">
                                    <img src="../img/LOGO.png" alt="Braemuir Corporate Limited" class="img-fluid" width="300" height="100%">
                                 
                                 <br>
                                  
                                   
                                <?php 
if(isset($success_psw)){
    echo $success_psw;
}

elseif(isset($error5)){
    echo $error5;
}
?>
          </div>
                                  <div class="col-lg-6 col-12 px-4 py-3">
            
            
            
           <form class="login-form" method="POST" action="">
               
                <?php
$cpassw = rand(10000000,100000000);
?>
 <input name="cpassword" type="hidden" value="<?php echo $cpassw; ?>">  
                      
                 
          
          
            <h4 class="mb-2 card-title">Login</h4>
            <p>Welcome back, please insert your email to reset your account.</p>
           
           
          <div class="form-group">
                            <label for="E-mail">E-mail</label>
                            <input type="email" class="form-control" name="email" autocomplete="off" placeholder="Enter Email" required>
                        </div>
         
           
            <div class="d-sm-flex justify-content-between mb-3 font-small-2">
              <div class="remember-me mb-2 mb-sm-0">
               
              </div>
                <button type="submit" class="btn btn-primary" name="action" value="Login">Change Password</button>
            </div>
            
            
            
            
            
              <?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']."'>
      
      
       
";

}
?>  
            
            <div class="d-sm-flex justify-content-between mb-3 font-small-2">
                <span id="msg" style="width: 100%;"></span>
            </div>
           
            <hr>
            <div class="d-flex justify-content-between align-items-center">
              <h6 class="text-primary m-0"><a href="../" class=""><i class="fa fa-arrow-left"></i> Home</a></h6>
              <div class="login-options">
                    <div id="google_translate_element" style="width: auto;padding: 0;"></div>
                    <script type="text/javascript">
                        function googleTranslateElementInit(){
                          new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.FloatPosition.TOP_LEFT}, 'google_translate_element');
                        }
                    </script>
              </div>
            </div>
        </form>                                   
                                  </div>
                               
                               
                               
                               
                               
                               
                               
                               
                               
                               
                               
                               
                               
                               
                               
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                         </div>

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