<?php
session_start();
//error_reporting(0);
include("users/includes/config.php");
if(isset($_POST['change']))
{
	$email=$_GET['email'];
  	$contact=$_GET['contact'];
   	$password=md5($_POST['password']);
$query=mysqli_query($conn,"SELECT * FROM users WHERE userEmail='$email' and contactNo='$contact'");
$num=mysqli_fetch_array($query);
if($num>0)
{
mysqli_query($conn,"update users set password='$password' WHERE userEmail='$email' and contactNo='$contact' ");
$msg="Password Changed Successfully";
}
else
{
$errormsg="Invalid email id or Contact no";
}
}
?>

<!DOCTYPE>
<html xmlns="#">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>AVIT Forgot Password</title>
<link rel="icon" type="image/x-icon" href="../assets/images//favicon.png" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
        
    <!-- Custom styles for this template -->
<!--    <link href="assets/css/style.css" rel="stylesheet">-->
<!--    <link href="assets/css/style-responsive.css" rel="stylesheet">-->
     	<style>
	.login-container{
}
.login-logo{
    position: relative;
    margin-left: -24.5%;
}
.login-logo img{
    position: absolute;
    width: 15%;
    margin-top: 25%;
    background: #f05837;
    border-radius: 4.5rem;
    padding: 2%;
}
.login-form-1 {
    padding: 10%;
    background: #52525a;
    box-shadow: 0 5px 8px 0 rgb(0 0 0 / 20%), 0 9px 26px 0 rgb(0 0 0 / 19%);
    border-radius: 30px;
    margin-top: 20px;
    margin-bottom: 40px;
}
.login-form-1 h3{
    text-align: center;
    margin-bottom:12%;
    color:#fff;
}
.login-form-2{
    padding: 5%;
    background: #f05837;
    box-shadow: 0 5px 8px 0 rgba(0, 0, 0, 0.2), 0 9px 26px 0 rgba(0, 0, 0, 0.19);
}
.login-form-2 h3{
    text-align: center;
    margin-bottom:12%;
    color: #fff;
}
.btnSubmit{
    font-weight: 600;
    width: 50%;
    color: #282726;
    background-color: #fff;
    border: none;
    border-radius: 1.5rem;
    padding:2%;
}
.btnForgetPwd{
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}
.btnForgetPwd:hover{
    text-decoration:none;
    color:#fff;
}
			img{
/*				max-height: 100%;*/
				max-width: 100%;
			}
			
	</style>
	<style>
@import url('https://fonts.googleapis.com/css?family=Montserrat');
		body{
			font-family: 'Montserrat', sans-serif;
		}
</style>
<script type="text/javascript">
function valid()
{
 if(document.forgot.password.value!= document.forgot.confirmpassword.value)
{
alert("Password and Confirm Password Field do not match  !!");
document.forgot.confirmpassword.focus();
return false;
}
return true;
}
</script>
	<style>
		body{
			background: #f9f9f9;
		}
	</style>
  </head>

  <body>

      <!-- **********************************************************************************************************************************************************
      MAIN CONTENT
      *********************************************************************************************************************************************************** -->
<div class="container login-container">
	<div class="col-sm-12">
		<center><img class="imgs" src="img/headerlogo.png" style="width:300px;"></center>
          </div>
           
            <div class="row">
				<div class="col-md-3"></div>
                <div class="col-md-6 login-form-1">
	  		 <div class="col-md-12">
	      		        <h3 class="form-login-heading" style="color: white;">Forgot Password ?</h3>
                          <p style="padding-left:4%; padding-top:1%;  color:#00ff14; font-weight: bold;">
		        	<?php if($msg){
echo htmlentities($msg)."<a href='https://vinayakamissions.com/vmcc-ticket/index.php' style='color:white; text-decoration:none;'> Login here</a> ";
		        		}?></p>
	                          <form class="form-login" name="forgot" method="post">
<!--
		                          <div class="input-group">
                           <span style="color: #094665;" class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
<input type="email" name="email" placeholder="Email" autocomplete="off" class="form-control" required>
								  </div><br>
	<div class="input-group">
                           <span style="color: #094665;" class="input-group-addon"><i class="glyphicon glyphicon-phone"></i></span>							  
<input type="tel" name="contact" pattern="\d{3}\d{3}\d{4}" maxlength="10" title="Mobile No in 10 Digit Ex. 9999999999" placeholder="Enter Your Mobile No" autocomplete="off" class="form-control" required>
								  </div>
<br>
-->
								  <label style="color: white;">New Password</label>
<div class="input-group">
                           <span style="color: #094665;" class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
 <input type="password" class="form-control" placeholder="New Password" id="password" name="password"  required >
								  </div>
 <br />
 <label style="color: white;">Confirm New Password</label>
 <div class="input-group">
                           <span style="color: #094665;" class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
<input type="password" class="form-control unicase-form-control text-input" placeholder="Confirm Password" id="confirmpassword" name="confirmpassword" required >
								  </div><br/>
								  <center> <button class="btn btn-warning" type="submit" name="change" onclick="return valid();">Submit</button></center>
				 </form>
		
					</div>

				</div>
	  	</div>
	  </div>
       <div class="clear" style="clear: both;"></div>  
<div class="footer">
<p style="font-weight:bold; text-align:center; padding:8px; font-size: 16px; color:#094665;">Digital Marketing Team - Copyright © 2023 AVIT All rights reserved</p>
</div>
        <script type="text/javascript" src="users/assets/js/jquery.backstretch.min.js"></script>
	      <script src="users/assets/js/jquery.js"></script>
    <script src="users/assets/js/bootstrap.min.js"></script>
  </body>
</html>
