
PK 
<?php
ob_start();
//error_reporting(E_ALL ^ E_NOTICE);
@session_start();
ini_set('allow_url_include',1);
date_default_timezone_set("Asia/Kolkata");
set_time_limit(600);
ini_set('max_execution_time',600);
require_once '../includes/settings/PDODB.php';
include '../includes/modules/functions.php';
$function = new FUNCTIONS();
if(empty($_SESSION['tourAdminId'])){
header("Location: ../index.php");
exit();
}
$error_msg = "";
$success_msg = "";
if ($_SERVER["REQUEST_METHOD"] === "POST") {
$current_password = $_POST['current_password'] ?? '';
$new_password = $_POST['new_password'] ?? '';
$confirm_password = $_POST['confirm_password'] ?? '';
$user_id = $_SESSION['tourAdminId'];
// Basic validation
if ($new_password !== $confirm_password) {
$error_msg = "New password and confirm password do not match.";
} else {
$pdodb = PDODB::getInstance();
// Fetch the current hashed password
$sql = "SELECT password FROM `admin` WHERE id='$user_id' AND isactive = 1";
$result = $pdodb->query($sql);
if ($result) {
$stored_hash = $result[0]['password'];
// Verify current password
if (password_verify($current_password, $stored_hash)) {
// Hash new password
$new_hash = password_hash($new_password, PASSWORD_DEFAULT);
// Update password
$update = "UPDATE `admin` SET password = '$new_hash' WHERE id='$user_id'";
$resultupdate = $pdodb->query($update);
$success_msg = "✅ Password changed successfully.";
} else {
$error_msg = "❌ Current password is incorrect.";
}
} else {
$error_msg = "❌ Admin user not found or inactive.";
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Admin | Dashboard</title>
<?php include_once '../layout/style.php'; ?>
<link href="../css/plugins/datapicker/datepicker3.css" rel="stylesheet">
</head>
<body>
<div id="wrapper">
<nav class="navbar-default navbar-static-side" role="navigation">
<div class="sidebar-collapse">
<ul class="nav metismenu" id="side-menu">
<li class="nav-header">
<div class="dropdown profile-element"> <span>
<img alt="image" class="img-circle" src="../img/profile_small.jpg" />
</span>
<a data-toggle="dropdown" class="dropdown-toggle" href="#">
<span class="clear"> <span class="block m-t-xs"> <strong class="font-bold">Vinay</strong>
</span> <span class="text-muted text-xs block">Art Director <b class="caret"></b></span> </span> </a>
<ul class="dropdown-menu animated fadeInRight m-t-xs">
<li><a href="#">Profile</a></li>
<li class="divider"></li>
<li><a href="#">Logout</a></li>
</ul>
</div>
<div class="logo-element">Vinay</div>
</li>
<li class="active">
<a href="#"><i class="fa fa-th-large"></i> <span class="nav-label">Dashboards</span> <span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li class="active"><a href="../dashboard/index.php">Dashboard</a></li>
</ul>
</li>
<li>
<a href="#"><i class="fa fa-pencil"></i> <span class="nav-label">Blog</span><span class="fa arrow"></span></a>
<ul class="nav nav-second-level collapse">
<li><a href="../blog/index.php">Blog List</a></li>
<li><a href="../blog/inactive.php">Off Blog List</a></li>
<li><a href="../blog/create.php">Add Blog</a></li>
</ul>
</li>
</ul>
</div>
</nav>
<div id="page-wrapper" class="gray-bg dashbard-1">
<?php include_once '../layout/header.php'; ?>
<div class="row wrapper border-bottom white-bg page-heading">
<div class="col-lg-6">
<h2>Welcome to Admin Panel</h2>
<?php if ($error_msg): ?>
<div class="alert alert-danger text-center" id="alert-danger">
<a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">×</a>
<strong><?php echo $error_msg; ?></strong>
</div>
<?php elseif ($success_msg): ?>
<div class="alert alert-success text-center" id="alert-success">
<a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">×</a>
<strong><?php echo $success_msg; ?></strong>
</div>
<?php endif; ?>
<form method="POST" action="">
<label>Current Password:</label><br>
<input class="form-control" type="password" name="current_password" required><br><br>
<label>New Password:</label><br>
<input class="form-control" type="password" name="new_password" required><br><br>
<label>Confirm New Password:</label><br>
<input class="form-control" type="password" name="confirm_password" required><br><br>
<input class="btn btn-lg btn-primary" type="submit" value="Change Password">
</form>
</div>
</div>
</div>
</div>
<?php include_once '../layout/script.php'; ?>
<script type="text/javascript">
$('#data_5 .input-daterange').datepicker({
keyboardNavigation: false,
forceParse: false,
autoclose: true
});
</script>
<script>
$(document).ready(function() {
setTimeout(function() {
toastr.options = {
closeButton: true,
progressBar: true,
showMethod: 'slideDown',
timeOut: 4000
};
toastr.success('Responsive Admin Theme', 'Welcome to Admin Panel');
}, 1300);
});
</script>
<script>
$(document).ready(function() {
$('#example').DataTable( {
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel'
]
} );
} );
</script>
</body>
</html>


PK 99