File "password_reset.php"
Full path: /home/fsibplc/public_html/fsib/accountOpening-v2/password_reset.php
File
size: 2.05 B (2.05 KB bytes)
MIME-type: text/x-php
Charset: utf-8
Download Open Edit Advanced Editor Back
<?php
include 'all_sql.php';
include 'sidebar.php';
$success = false;
if (isset($_POST['pass_reset'])) {
$username = $_POST['reset_user'];
$password = "Abcd@1234";
if (!empty($username)) {
$updated_password = "UPDATE `user_list` SET `password`='$password' WHERE `username`='$username'";
$updated_password_execute = $conn->query($updated_password);
$affected_rows = $updated_password_execute->num_rows;
if($updated_password_execute){
$success = true;
}
// if( $updated_password_execute > 0){
// echo '<script>alert("Password Reset Successful. New Password is Abcd@1234");</script>';
// }
// else{
// echo '<script>alert("Sorry !!! Password Not Reset");</script>';
// }
}
}
?>
<div class="show-content">
<div class="card" style="width: 600px;margin:30px auto">
<h3 class="text-info mt-3 text-center">Password Reset</h3>
<script>
<?php if ($success) { ?>
alert('Password Reset Successful.\nUsername: <?php echo $username; ?>\nPassword: <?php echo $password; ?>\n');
<?php } ?>
</script>
<form action="" method="post" class="p-5">
<div class="form-group row">
<label for="user" class="form-label">Username</label>
<select name="reset_user" id="" class="form-control">
<option value="">Select an User</option>
<?php
while ($all_user = $user_sql_execute->fetch_assoc()) {
?>
<option value="<?php echo $all_user['username'] ?>"><?php echo $all_user['username'] ?></option>
<?php } ?>
</select>
</div>
<div class="form-group row">
<input type="submit" name="pass_reset" value="Reset" class="btn btn-success">
</div>
</form>
</div>
</div>
<?php include 'footer.php'; ?>