<? include("../settings.php"); ?>
<? include("session.php"); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Abstract Submission Portal</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Include all CSS/JS -->
        <!-- Bootstrap -->
    <link href="css/bootstrap.css" rel="stylesheet">
    <link href="css/jquery.dataTables.css" rel="stylesheet">
    <link href="http://cdn.datatables.net/responsive/1.0.1/css/dataTables.responsive.css" rel="stylesheet">
    

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="js/jquery-2.1.1.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
    <script src="js/jquery.dataTables.min.js"></script>
    <script src="http://cdn.datatables.net/responsive/1.0.1/js/dataTables.responsive.js"></script>
   
    <!-- End of all CSS/JS -->
	<script>
		function frmsubmit(){
			if ($("#new_password1").val() != $("#new_password2").val()){
				alert("Please enter the same password in both fields.");
				return false;
			}else
				return true;
		}
	</script>
   </head>
<body>
<?
	if (isset($_REQUEST['confirm']) && $_REQUEST['confirm']!=""){
		$bind = array(":search1" => $_SESSION['user_id']);
		$update = array("user_password" => $_REQUEST['new_password1']);
		$db->update("tbl_user",$update,"user_id = :search1",$bind);
		//print_r($bind);
		//print_r($update);
		echo "<script>alert('Password changed.');window.location='main.php';</script>";
	}
?>

<? include("nav_menu.php"); ?>
<div class="well">
<div class="content" bgcolor="#FFFFD0">
<div class="col-12 feature">
    <div class="panelCheck">
    <div class="panel-heading">
		<h3 class 'panel-title'>Change Password</h3>
       
    </div>
		
	  

    <form name="camps" method='POST' action="password.php" enctype="multipart/form-data" class="form-horizontal" role="form">
	
	<div class="panel panel-primary" id="child">
        
		
		<div class="panel panel-primary">
			
			<div class="panel-body">    
				<div class="form-group">
					<label for="new_password1" class="col-lg-4 control-label">New Password</label>
					<div class="col-lg-6">
						<input type="password" name="new_password1" id="new_password1" class="form-control">
					</div>
				</div>
				<div class="form-group">
					<label for="new_password2" class="col-lg-4 control-label">New Password Again</label>
					<div class="col-lg-6">
						<input type="password" name="new_password2" id="new_password2" class="form-control">
					</div>
				</div>
				<center>
					<input type="submit" name="confirm" value="Update" class="btn btn-success" onclick="return frmsubmit();">
				</center>
			</div>
		</div>
		
		
    </form>
	
</div>
    </div>
<script>
	selectrelation();
	selecterelation();
	chkTransport();
</script>
</div>
</div>
</body>
</html>