<?php
if(!empty($_POST['email']))
{
    $reseta = mysql_real_escape_string($_POST['email']); 
    $lenght=20;
    $key=substr(str_shuffle(md5(time())),0,$lenght);
    //check data
    $sql = mysql_query("SELECT * FROM logins WHERE email='$reseta'");
    $result =mysql_num_rows($sql);
    if ($result > 0){
        while($row = mysql_fetch_assoc($sql)) {
            $email = $row['email'];
        }

        //if username matches create key using php date
        $sql = mysql_query("UPDATE logins SET reset='$key' WHERE email ='$email'");
        $result =mysql_num_rows($sql);
        if ($result > 0){
            echo "Error:  <br>";
        } else {

            $message = 'Click or copy paste the following link on your URL bar to reset your password '.$config_basedir.'new-password.php?user='.$email.'&reset='.$key.'';
            $header = "From: $adminemail";
            mail($email,'Password Reset Request',$message,$header);
            echo 'An email has been sent to you';


        }
    }
    else {
        echo "Email wasn't found in our database";
    }
    mysqli_close($db);
}
?>


<!DOCTYPE html>
<html lang="en">
 


<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Alpha Chequers™ - Reset Password </title>
    <!-- Favicon icon -->
    <link rel="shortcut icon" href="../Signin/assets/img/myfavicon.png" type="image/x-icon">
    <!-- Custom Stylesheet -->
    <link rel="stylesheet" href="../vendor/waves/waves.min.css">
    <link rel="stylesheet" href="../css/style.css">
      <style>
      .float{
    position:fixed;
    width:60px;
    height:60px;
    bottom:40px;
    right:40px;
    background-color:#25d366;
    color:#FFF;
    border-radius:50px;
    text-align:center;
  font-size:30px;
    box-shadow: 2px 2px 3px #999;
  z-index:100;
}

.my-float{
    margin-top:16px;
}
        .goog-te-combo{
        	height: 30px !important;
        	padding: 0px !important;
        }
        .goog-logo-link {
           display:none !important;
        }
        
        .goog-te-gadget {
           color: transparent !important;
           height: 35px !important;
           margin: 0px !important;
        }
        
        .goog-te-gadget .goog-te-combo {
           color: #000000 !important;
}
.logo-title{
    height:30px; 
    padding-top: 3px !important; 
    border: 1px solid #; 
    width: 130px;
    margin-left: 30px

}
.small-logo{
    height:30px; 
    width: 30px; 
    border: 1px solid #; 
    float: left;
}
.mini-logo{
    border: 1px solid # !important;
     margin: 0px auto !important;
      height: 34px !important; 
      width: 180px;
}
    </style>
</head>

<body>

    <div id="preloader">
        <div class="sk-three-bounce">
            <div class="sk-child sk-bounce1"></div>
            <div class="sk-child sk-bounce2"></div>
            <div class="sk-child sk-bounce3"></div>
        </div>
    </div>

    <div id="main-wrapper" style="margin-top: 0px !important">
       
        <div class="authincation section-padding" style="margin-top: 0px !important; padding-top: 0px !important; padding-bottom: 10px !important">
            <div class="container h-100">
                <div class="row justify-content-center h-100 align-items-center">
                    <div class="col-xl-5 col-md-6" style="border: 1px solid #; margin-top: 30px !important">
                        
                    <div class="mini-logo text-center my-5">
                    <div class="small-logo"><img src="../Signin/assets/img/small-logo.png" height="30" width="30" alt=""></div>                               
                     <div  class="logo-title"><span style="font-weight: bold; font-family: 'Trebuchet MS', sans-serif; color: #007bff">ALPHA <span style="color: orange">CHEQUERS<span style="color: #fff">™</span></span></span></div>
                     </div>
                   <br/>





                        <div class="auth-form card">
                            <div class="card-header justify-content-center">
                                <h4 class="card-title">Reset password</h4>
                            </div>
                                                        
                            
                                            <div class="card-body">
                                <form action="https://topnotchpips.com/Account/Forget_Password/password-reset-token.php" method="post">
                                    <div class="form-group">
                                        <label>Email</label>
                                        <input type="email" name="email" class="form-control"placeholder="Enter your email">
                                        <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
                                    </div>
                                    <div class="text-center">
                                        <button name="password-reset-token" type="submit" class="btn btn-success btn-block" style="background: #007bff !important; border: 2px solid #007bff; width: 160px !important">Reset</button>
                                    </div>
                                    
                                </form>
                                <div class="new-account mt-3">
                                    <p>Don't have an account? <a class="text-primary" href="../Signup/index.html">Sign
                                            up</a></p>
                                          	<div id="google_translate_element"></div>

<script type="text/javascript"> function googleTranslateElementInit() { new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element'); } </script> <script type="text/javascript" src="../../../translate.google.com/translate_a/elementa0d8.js?cb=googleTranslateElementInit"></script>
                                    <script>
    function googleTranslateElementInit() {
     new google.translate.TranslateElement(
                {pageLanguage: 'en'},
                'google_translate_element'
            );
        /*
        To remove the "powered by google",
        uncomment one of the following code blocks.
        NB: This breaks Google's Attribution Requirements:
        https://developers.google.com/translate/v2/attribution#attribution-and-logos
    */

    // Native (but only works in browsers that support query selector)
    if(typeof(document.querySelector) == 'function') {
        document.querySelector('.goog-logo-link').setAttribute('style', 'display: none');
        document.querySelector('.goog-te-gadget').setAttribute('style', 'font-size: 0');
    }

    // If you have jQuery - works cross-browser - uncomment this
    jQuery('.goog-logo-link').css('display', 'none');
    jQuery('.goog-te-gadget').css('font-size', '0');
    }
    </script>
    <script src="../../../translate.google.com/translate_a/elementa0d8.js?cb=googleTranslateElementInit"></script>
   
                                            	
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>




    </div>





    <script src="../js/global.js"></script>
    
    <script src="../vendor/waves/waves.min.js"></script>
    <script src="../js/scripts.js"></script>


</body> 
</html>