File "changePassword.php"

Full Path: /home/krishnamexports/public_html/panel/pages/product/changePassword.php
File size: 3.18 KB
MIME-type: text/x-php; charset=us-ascii
Charset: utf-8

<?php 		  

if(isset($_POST['add']))

{

	$password  = $_POST['password'];	

	$npassword = $_POST['npassword'];

	$cpassword = $_POST['cpassword'];		

	if($npassword==$cpassword)

	{

		$password = encryptIt($password);

		$sqlUser  = mysqli_query($cn, "select `id` from tbl_employee where `id`='".$_SESSION['krishnamExportsId']."' and `password`='".$password."'")or die(mysql_error("login issue"));

		if(mysqli_num_rows($sqlUser)>0)

		{

			$sqlUserData = mysqli_fetch_array($sqlUser);		

			mysqli_query($cn, "update tbl_employee SET `password`='".encryptIt($npassword)."' where `id`='".$sqlUserData['id']."'");

			echo '<div class="alert alert-success"><strong>Success!</strong> Password Update Successfully.</div>';

		}

		else

		{

			echo '<div class="alert alert-danger"><strong>Danger!</strong> Current Password Not Matched.</div>';				

		}		

	}

	else

	{

		echo '<div class="alert alert-danger"><strong>Danger!</strong> New and confirm Password Not Matched.</div>';

	}	

}

?>

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

    <div class="card">

        <div class="card-body">

            <h4 class="card-title">Change Password</h4>        

            <div class="row">                                

                <form method="post">

                <div class="form-group">

                  <label class="label">Current Password</label>

                  <div class="input-group">

                    <input type="text" name="password" class="form-control" placeholder="Password" required>

                    <div class="input-group-append">

                      <span class="input-group-text">

                        <i class="mdi mdi-check-circle-outline"></i>

                      </span>

                    </div>

                  </div>

                </div>

                <div class="form-group">

                  <label class="label">New Password</label>

                  <div class="input-group">

                    <input type="password" name="npassword" class="form-control" placeholder="*********" required>

                    <div class="input-group-append">

                      <span class="input-group-text">

                        <i class="mdi mdi-check-circle-outline"></i>

                      </span>

                    </div>

                  </div>

                </div>

                <div class="form-group">

                  <label class="label">Confirm Password</label>

                  <div class="input-group">

                    <input type="password" name="cpassword" class="form-control" placeholder="*********" required>

                    <div class="input-group-append">

                      <span class="input-group-text">

                        <i class="mdi mdi-check-circle-outline"></i>

                      </span>

                    </div>

                  </div>

                </div>

                <div class="form-group">

                  <button type="submit" name="add" class="btn btn-primary submit-btn btn-block">Change Password</button>

                </div>                                       

              </form>                                  

            </div>

        </div>

    </div>

</div>