<?php 
include("db_connection.php");

$msg="";
if(isset($_POST['submit']))
{
	$update=mysql_query("update admin_login set apassword='".md5($_POST['password'])."' where aemail='".$_POST['email']."' and aid='".$_POST['id']."'");
	
	$msg="Password Changed Successfully";
	
	unset($_COOKIE['Log_username']);
	unset($_COOKIE['Log_password']);
	unset($_COOKIE['Log_check']);
	
	//echo'<pre>';print_r($_COOKIE);exit;
	?>
	<script>
		setTimeout(function(){
			window.location="index.php";
		},2000);
	</script>
	<?php
}

if(isset($_GET['email']) && isset($_GET['id']))
{
	$email=$_GET['email'];
	
	$id=$_GET['id'];
	
	
	$sql=mysql_query("select * from admin_login where aemail='$email' and aid='".$id."'");
	
	$res=mysql_fetch_assoc($sql);
	
	if(isset($res['aname']))
	{
	
		
		?>
			<!DOCTYPE html>
<html class="no-js before-run" lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
  <meta name="description" content="bootstrap admin template">
  <meta name="author" content="">

  <title>Login | Remark Admin Template</title>

  <link rel="apple-touch-icon" href="assets/images/apple-touch-icon.png">
  <link rel="shortcut icon" href="assets/images/favicon.ico">

  <!-- Stylesheets -->
  <link rel="stylesheet" href="assets/css/bootstrap.min.css">
  <link rel="stylesheet" href="assets/css/bootstrap-extend.min.css">
  <link rel="stylesheet" href="assets/css/site.min.css">

  <link rel="stylesheet" href="assets/vendor/animsition/animsition.css">
  <link rel="stylesheet" href="assets/vendor/asscrollable/asScrollable.css">
  <link rel="stylesheet" href="assets/vendor/switchery/switchery.css">
  <link rel="stylesheet" href="assets/vendor/intro-js/introjs.css">
  <link rel="stylesheet" href="assets/vendor/slidepanel/slidePanel.css">
  <link rel="stylesheet" href="assets/vendor/flag-icon-css/flag-icon.css">


  <!-- Page -->
  <link rel="stylesheet" href="assets/css/pages/login.css">

  <!-- Fonts -->
  <link rel="stylesheet" href="assets/fonts/web-icons/web-icons.min.css">
  <link rel="stylesheet" href="assets/fonts/brand-icons/brand-icons.min.css">
  <link rel='stylesheet' href='http://fonts.googleapis.com/css?family=Roboto:300,400,500,300italic'>


  <!--[if lt IE 9]>
    <script src="assets/vendor/html5shiv/html5shiv.min.js"></script>
    <![endif]-->

  <!--[if lt IE 10]>
    <script src="assets/vendor/media-match/media.match.min.js"></script>
    <script src="assets/vendor/respond/respond.min.js"></script>
    <![endif]-->

  <!-- Scripts -->
  <script src="assets/vendor/modernizr/modernizr.js"></script>
  <script src="assets/vendor/breakpoints/breakpoints.js"></script>
  <script>
    Breakpoints();
  </script>
</head>
<body class="page-login layout-full">
  <!--[if lt IE 8]>
        <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
    <![endif]-->


  <!-- Page -->
  <div class="page animsition vertical-align text-center" data-animsition-in="fade-in"
  data-animsition-out="fade-out">>
    <div class="page-content vertical-align-middle">
      <div class="brand">
        <img class="brand-img" src="assets/images/logo.png" alt="...">
        <h2 class="brand-text">Exchage Kar DE</h2>
      </div>
      <p>Change your account password</p>
      <?php 
	  if($msg==!"")
	  {
		  ?>
		  	<div class="alert alert-success alert-dismissible" role="alert">
                  <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                  </button>
                 <?php echo $msg;?>
                </div>
		  <?php
	  }
	  ?>
      <form method="post">
       <!-- <div class="form-group">
          <label class="sr-only" for="inputName">Name</label>
          <input type="text" class="form-control" id="inputName" placeholder="Name">
        </div>-->
        <div class="form-group">
          <label class="sr-only" for="inputEmail">Email</label>
          <input type="email" class="form-control" id="inputEmail" name="email" placeholder="Email" value="<?php echo $email;?>">
          <input type="hidden" name="id" value="<?php echo $id?>">
        </div>
        <div class="form-group">
          <label class="sr-only" for="inputPassword">New Password</label>
          <input type="password" class="form-control" id="inputPassword" name="password"
          placeholder="Password" value="">
        </div>
        
        <div class="form-group">
          <label class="sr-only" for="inputPassword">Confirm Password</label>
          <input type="password" class="form-control" id="inputPassword" name="confirm_password"
          placeholder="Confirm Password" value="">
        </div>
        <div class="form-group">
        <h5 style="color:#fff;"></h5>
        </div>
        
        
        <button type="submit" name="submit" class="btn btn-primary btn-block">Save</button>
      </form>
      <!--<p>Still no account? Please go to <a href="register.html">Register</a></p>-->

      <footer class="page-copyright">
        <p>WEBSITE BY Pi Technologies</p>
        <p>© 2015. All RIGHT RESERVED.</p>
        <div class="social">
          <a href="javascript:void(0)">
            <i class="icon bd-twitter" aria-hidden="true"></i>
          </a>
          <a href="javascript:void(0)">
            <i class="icon bd-facebook" aria-hidden="true"></i>
          </a>
          <a href="javascript:void(0)">
            <i class="icon bd-dribbble" aria-hidden="true"></i>
          </a>
        </div>
      </footer>
    </div>
  </div>
  <!-- End Page -->


  <!-- Core  -->
  <script src="assets/vendor/jquery/jquery.js"></script>
  <script src="assets/vendor/bootstrap/bootstrap.js"></script>
  <script src="assets/vendor/animsition/jquery.animsition.js"></script>
  <script src="assets/vendor/asscroll/jquery-asScroll.js"></script>
  <script src="assets/vendor/mousewheel/jquery.mousewheel.js"></script>
  <script src="assets/vendor/asscrollable/jquery.asScrollable.all.js"></script>
  <script src="assets/vendor/ashoverscroll/jquery-asHoverScroll.js"></script>

  <!-- Plugins -->
  <script src="assets/vendor/switchery/switchery.min.js"></script>
  <script src="assets/vendor/intro-js/intro.js"></script>
  <script src="assets/vendor/screenfull/screenfull.js"></script>
  <script src="assets/vendor/slidepanel/jquery-slidePanel.js"></script>

  <script src="assets/vendor/jquery-placeholder/jquery.placeholder.js"></script>

  <!-- Scripts -->
  <script src="assets/js/core.js"></script>
  <script src="assets/js/site.js"></script>

  <script src="assets/js/sections/menu.js"></script>
  <script src="assets/js/sections/menubar.js"></script>
  <script src="assets/js/sections/sidebar.js"></script>

  <script src="assets/js/configs/config-colors.js"></script>
  <script src="assets/js/configs/config-tour.js"></script>

  <script src="assets/js/components/asscrollable.js"></script>
  <script src="assets/js/components/animsition.js"></script>
  <script src="assets/js/components/slidepanel.js"></script>
  <script src="assets/js/components/switchery.js"></script>
  <script src="assets/js/components/jquery-placeholder.js"></script>

  <script>
    (function(document, window, $) {
      'use strict';

      var Site = window.Site;
      $(document).ready(function() {
        Site.run();
      });
    })(document, window, jQuery);
  </script>
  
  <script>
$("input[name='confirm_password']").focusout(function(){

if($("input[name='confirm_password']").val()==$("input[name='password']").val())
{
	$("h5").html("Password Match");
	$("button[type='submit']").attr("disabled",false);
}
else
{
	$("h5").html("Password Does Not Match");
	$("button[type='submit']").attr("disabled",true);
	
}


});
</script>

</body>

</html>
		
		<?php
		
	}
	else
	{
		?>
		<script>
		alert('request not match');
        window.location="index.php";
        </script>
		<?php
	}
	
	
}

//echo'<pre>';print_r($_POST);

?>



