<?php
include('connection.php');
//include('lock.php');
include ('session.php');
	$myusername=htmlentities($_SESSION['login_user']);


?><!DOCTYPE html>
<html 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">
    <meta name="description" content="">
    <meta name="author" content="samarth10" >

    <title>SB Admin 2 - Bootstrap Admin Theme</title>
 
    <!-- Bootstrap Core CSS -->
            
    <link href="bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    
    <!-- MetisMenu CSS -->
    <link href="bower_components/metisMenu/dist/metisMenu.min.css" rel="stylesheet">
 
    <!-- Custom CSS -->
     <link href="dist/css/sb-admin-2.css" rel="stylesheet">
 
    <!-- Custom Fonts -->
    <link href="bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"> 
<!--    <link rel="stylesheet" href="/resources/demos/style.css"> -->
<link rel="stylesheet" href="dist/css/bootstrap-datepicker.css">

<link rel="stylesheet" href="tinybox/style_tiny.css" />

 
<!--  <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> -->
 
<!-- <script src="dist/js/jquery-1.7.1.min.js"></script> -->
<script src="dist/js/jquery-2.0.3.min.js"></script>
 
<!-- <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script> -->
<script src="dist/js/jquery-ui.js"></script>
<script type="text/javascript" src="tinybox/tinybox.js"></script>

<script src="dist/js/bootstrap-datepicker.js"></script>
<script src="dist/js/bootstrap-datepicker.min.js"></script>

        <script type="text/javascript" >

$(function()
{
$('#date').datepicker();	
	
	});
</script>


        <script type="text/javascript" >

$(function()
{
$('#date').datepicker();	
	
	});
	
	

	     function submit()
	      {
     // alert('hgfh');
       var old_password = document.getElementById('old_password').value;
       var new_pass = document.getElementById('new_pass').value;
       //alert(srno_mar);
     	 var new_pass1 = document.getElementById('new_pass1').value;
     	 var login = document.getElementById('login').value;

     	 
if(old_password=='')
{
alert('Please enter all details..?');
	}
	else
	{  	
  	if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
	xmlhttp.onreadystatechange=function()
	{

    if (xmlhttp.readyState==4) 
	{
    //alert(xmlhttp.responseText);
      if(xmlhttp.responseText==1)	   {

	   alert("Your password has been Changed");
       //window.location.reload();
        window.location="home.php";
		
  }
 else 
  {
  	 alert("Passwords Do Not Match");
      
  	}
 // 	else
  //	{}
  	  
  }
  }

  var res ="&old_password="+old_password+"&new_pass="+new_pass+"&new_pass1="+new_pass1+"&login="+login;
//alert(res);
		xmlhttp.open("POST", "pass_change.php?"+res , true); 
		xmlhttp.send(null);
      }
}

/*
function submit()
{
//alert(n);
	 var old_password = document.getElementById('old_password').value;
       var new_pass = document.getElementById('new_pass').value;
       //alert(srno_mar);
     	 var new_pass1 = document.getElementById('new_pass1').value;

     	 
  var res ="&old_password="+old_password+"&new_pass="+new_pass+"&new_pass1="+new_pass1;
//alert(res);

				$.ajax({
				 type: "POST",
				 url:"pass_change.php",
				 data:res,
				 success: function(msg){
				alert(msg);
			{				
						$('#success0').fadeIn(1000);
							document.getElementById('new_pass1'+res).innerHTML=msg; 
							$('#success0').fadeOut(3500);
//							$("#search_res").load(location.href + " #search_res  > *");
								
					}
				 }
				});
			
		}*/
	</script>
</head>

<body>

    <div id="wrapper">

                <?php include("menu22.php"); ?>
      								 <?php include("header.php"); ?> 


        <div id="page-wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header">Change Password</h1>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                        Admin
                        </div>
                        <div class="panel-body">
                            <div class="row">
                          		<div class="col-lg-6">
<!--                         <form role="form"  method="post" action="<?php $_SERVER['PHP_SELF'];?>" enctype="multipart/form-data"> -->
						                        <form role="form"  method="post" action="pass_change.php" >
					
						                                    <input class="form-control" placeholder="Password" name="login" id="login" type="hidden" value="<?php echo $myusername;?>">
						                                <div class="form-group">
						                                      <label> <font class="colourclasss">Old Password :</font><font color="red">*</font></label>
						                                    <input class="form-control" placeholder="Password" name="old_password" id="old_password" type="password" value="" AUTOCOMPLETE="off">
						                                </div>
						                                <div class="form-group">
						                                      <label><font class="colourclasss">New Password:</font> <font color="red">*</font></label>
						                                    <input class="form-control" placeholder="Password" name="new_pass" id="new_pass" type="password" value="" AUTOCOMPLETE="off">
						                                </div>
						                                <div class="form-group">
						                                      <label> <font class="colourclasss">Confirm Password:</font> <font color="red">*</font></label>
						                                    <input class="form-control" placeholder="Password" name="new_pass1" id="new_pass1" type="password" value="" AUTOCOMPLETE="off">
						                                </div>
						
						                        </form>
                                    <input class="btn btn-default" type="submit" onclick="submit();" value="Change" name="submit" style="margin-left:38%">
                    							</div>
                                
<samp id="error1" style="font:1em Lucida Grande, sans-serif; font-size:13px; color:#F03; text-shadow:#50 0 1px 0;  float:right" ></samp>
<samp id="success0" style="font: 1em Lucida Grande, sans-serif; font-size:13px; color:#0C0; text-shadow:#50 0 1px 0; float:right"> </samp>
                                
                                
                                
                                
                                <!-- /.col-lg-6 (nested) -->
                            </div>
                            <!-- /.row (nested) -->
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                      <div id="search_res" style="width:100%;" >                    
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->
</div>

    <!-- jQuery -->
    <script src="../bower_components/jquery/dist/jquery.min.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="bower_components/metisMenu/dist/metisMenu.min.js"></script>

    <!-- Custom Theme JavaScript -->
    <script src="dist/js/sb-admin-2.js"></script>

</body>

</html>
