PATH:
home2
/
pbkvidya
/
public_html
/
admin
/
Editing: change_password.php
<?php include_once('connect.php'); session_start(); // Check if the user is logged in if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) { echo "<script type='text/javascript'>window.location.href = 'index.php';</script>"; // Redirect to login page exit(); } include_once('head.php'); $user=$_SESSION["username"]; echo $user; ?> <?php if(isset($_POST["btnPassword"])) { $pwd=$_POST['txtPwd']; $pwd1=$_POST['txtPwd1']; if($pwd==$pwd1) { $sql=mysqli_query($con,"UPDATE tbl_user SET password='$pwd' WHERE username='$user'"); mysqli_close($con); echo "<script>alert('Password Changed!!!');</script>"; } else{ echo "<script>alert('Password Mismatch!!!');</script>"; } } ?> <main id="main" class="main"> <div class="pagetitle"> <!-- <h1>Dashboard</h1> --> <nav> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="index.html">Home</a></li> <li class="breadcrumb-item active">Change Password</li> </ol> </nav> </div><!-- End Page Title --> <section class="section"> <div class="row"> <div class="col-lg-1"> </div> <div class="col-lg-10"> <div class="card"> <div class="card-body"> <div class="row mb-3 bord-bottom"> <div class="col-lg-5"><h5 class="card-title">Change Password</h5></div> <div class="col-lg-5"> <!-- <h5 class="card-title title-right"><a href="view_gallery.php" class="btn btn-secondary">View All Gallery Images</a></h5> --> </div> </div> <div class="row mb-3"> </div> <!-- General Form Elements --> <form name="FormChngPwd" method="post" enctype="multipart/form-data" class="pt-20"> <div class="row mb-3"> <label for="inputText" class="col-sm-3 col-form-label">Username</label> <div class="col-sm-5"> <input class="form-control" type="text " id="txtUser" name="txtUser" value="<?php echo $user; ?>" required="" readonly> </div> </div> <div class="row mb-3"> <label for="inputText" class="col-sm-3 col-form-label">Enter New Password</label> <div class="col-sm-5"> <input class="form-control" type="password" id="txtPwd" name="txtPwd" value="" required=""> </div> </div> <div class="row mb-3"> <label for="inputText" class="col-sm-3 col-form-label">Enter Password Again</label> <div class="col-sm-5"> <input class="form-control" type="password" id="txtPwd1" name="txtPwd1" value="" required=""> </div> </div> <div class="row mb-3 pt-20"> <label class="col-sm-3 col-form-label"></label> <div class="col-sm-5 "> <input type="submit" class="btn btn-primary btn-center" name="btnPassword" id="btnPassword" value="Change Password"> </div> </div> </form><!-- End General Form Elements --> </div> </div> </div> <div class="col-lg-1"> </div> </div> </section> </main><!-- End #main --> <?php include_once('footer.php'); ?>
SAVE
CANCEL