Current File : /home/inlingua/public_html/sensoriumpsychologists.com/backup/franchise/change_password.php
<?php
include_once('common/session.php');
include_once('../classes/config.php');?>
<?php
 $session_id=$_SESSION['shristi_franchise'];
		extract($_REQUEST);
		if(isset($sub))
		{
		  if(!empty($op) && !empty($np) && !empty($cp))
		  {		
		  	  
			  $select="SELECT * FROM shristi_franchise  where email='$session_id'";
			  $change_result = $conn->query($select);
			  $arr = $change_result->fetch_assoc();
			  
			 // print_r($arr);die;
			  $op=$op;
			  $np=$np;
			  $cp=$cp;
			  if($op==$arr['password']){
				  if($np==$cp){	
				  	$np1=$np;
				  	$update="update shristi_franchise SET password ='$np1' where email='$session_id'";
					$update_result = $conn->query($update);
					
					$msg1='<div class="alert alert-success">
                         <a class="close" data-dismiss="alert" href="#">&times;</a>
                         <strong>Successfully!</strong>Password Change.</div>';
					//$msg1="Password changed";
				  
				  }else{
					  $msg= ' <div class="alert alert-danger">
                           <a class="close" data-dismiss="alert" href="#">&times;</a>
                           <strong>Warning!</strong>New password and conform password is not match.
                           </div>';
					;
					//$msg="New password and conform password is not match";  
				  }
			  
			  }else{
				  $msg= ' <div class="alert alert-danger">
                           <a class="close" data-dismiss="alert" href="#">&times;</a>
                           <strong>Warning!</strong>Old password is not correct.
                           </div>';
					;
				//$msg="Old password is not correct";  
			  }
		  }else{
			 $msg= ' <div class="alert alert-danger">
                           <a class="close" data-dismiss="alert" href="#">&times;</a>
                           <strong>Warning!</strong>Please fill the blank fields.
                           </div>';
					;
			// $msg="Please fill the blank fields";   
		  }
		} 
?>

<!DOCTYPE html>
<html>
  <head>
    <title>Shristi</title>
    <?php require("common/head_links.php");?>

    </head>
<body class="hold-transition skin-blue sidebar-mini">
    <div class="wrapper">
          <?php require("common/header.php");?>
  <?php require("common/left_side_bar.php");?>
      <div class="content-wrapper"> 
            <!-- Content Header (Page header) -->
            <section class="content-header">
              <h1> Change Password </h1>
              
            </section>
          <!-- Main content -->
            <section class="content">
              <div class="row">
                <div class="col-xs-12">
                  <div class="box">
                    <div class="box-body" style="padding:50px 15px;">
                           	<?php
      if(isset($msg)){
		echo "<span style='color:red'><strong>$msg</strong></span>";  
	  }
	  if(isset($msg1)){
		echo "<span style='color:green'><strong>$msg1</strong></span>";  
	  }
	  ?>
<form class="form-horizontal" name="frmChange" role="form" method="post" enctype="multipart/form-data">
<div class="col-md-2"></div>
<div class="col-md-8">
  <div class="form-group">
    <label class="control-label col-md-4" for="pwd">Current Password:</label>
    <div class="col-md-6"> 
	<input type="password" class="form-control" name="op" id="currentPassword"><span id="currentPassword"  class="required"></span>

    </div>

  </div>

  <div class="form-group">

    <label class="control-label col-md-4" for="pwd">New Password:</label>

    <div class="col-md-6"> 

      <input type="password" class="form-control" name="np" id="newPassword"><span id="newPassword" class="required"></span>

    </div>

  </div>

  <div class="form-group">

    <label class="control-label col-md-4" for="pwd">Confirm New Password:</label>

    <div class="col-md-6"> 

      <input type="password" class="form-control" name="cp" id="confirmPassword"><span id="confirmPassword" class="required">

    </div>

  </div>

  <div class="form-group"> 

    <div class="col-sm-offset-5 col-sm-10">

      <button type="submit" class="btn btn-success"  name="sub">Change Password</button>

    </div>

  </div>

  

</form>



                      

                    </div>

                    <!-- /.box-body --> 

                  </div>

                  <!-- /.box --> 

                </div>

                <!-- /.col --> 

              </div>

              <!-- /.row --> 

            </section>

            <!-- /.content --> 

          </div>

          <!-- /.content-wrapper -->



      <?php require("common/footer.php");?>
 </div><!-- ./wrapper -->
<?php require("common/footer_links.php");?>
</body>
</html>
<script>
function validatePassword() {
var currentPassword,newPassword,confirmPassword,output = true;
currentPassword = document.frmChange.currentPassword;
newPassword = document.frmChange.newPassword;
confirmPassword = document.frmChange.confirmPassword;

if(!currentPassword.value) {

currentPassword.focus();

document.getElementById("currentPassword").innerHTML = "required";

output = false;

}

else if(!newPassword.value) {

newPassword.focus();

document.getElementById("newPassword").innerHTML = "required";

output = false;

}

else if(!confirmPassword.value) {

confirmPassword.focus();

document.getElementById("confirmPassword").innerHTML = "required";

output = false;

}

if(newPassword.value != confirmPassword.value) {

newPassword.value="";

confirmPassword.value="";

newPassword.focus();

document.getElementById("confirmPassword").innerHTML = "Not Match";

output = false;

} 	

return output;

}

</script>