How To change password from admin panel.

1 Create change password page.
2 create form fields like username, oldpassword, newpassword.

//                                             Code                          //


<?php
include"config.php";
$msg='';
$msg1='';
session_start();
$count=0;
if(isset($_POST['submit']) && !empty($_POST['submit']))
{
 $sql = "select * from user where email='".$_POST['email']."' and password ='".$_POST['password']."'";
$run = mysql_query($sql);
$count = mysql_num_rows($run);
if($count>0)
{
$sql = "UPDATE `user` SET `password`= '".$_POST['newpassword']."'";
$run = mysql_query($sql);
$msg1 = "Password change sucessful.";
}
else
{
$msg = "Your login details not same.";
}
}
?>
<h3 id="forms-example" class="">Change Password</h3>
<?php echo $msg;
     echo $msg1;
?>
  <form action="" method="post" enctype="multipart/form-data">
  <div class="form-group">
    <label for="exampleInputEmail1">Email address</label>
    <input type="email" class="form-control" id="email" name="email" placeholder="Email address">
  </div>
  <div class="form-group">
    <label for="exampleInputPassword1">Old Password</label>
    <input type="password" class="form-control" id="password1" name="password" placeholder="Password">
<label for="exampleInputPassword1">New Password</label>
    <input type="password" class="form-control" id="newpassword" name="newpassword" placeholder="Password">
<!--<label for="exampleInputPassword1">conform Password</label>
    <input type="password" class="form-control" id="conformpassword" name="conformpassword" placeholder="Password">-->
  </div>
  
  <input type="submit" class="btn btn-default" id="submit" name="submit" value="updatepassword ">
 <!-- <button type="submit" class="btn btn-default">Update Password</button>-->
</form>

Comments

Popular posts from this blog

How to filter data from database according to client name & date wise in PHP

Captcha Code In PHP