Viewing File: /home/quiczmwg/bitmaven.org/change_password.php
<?php
// Start the session
session_start();
// Check if the 'userid' session is not set
if (!isset($_SESSION['userid'])) {
header("Location: ./login.php");
exit();
}
// Include database connection and other necessary files
require_once('_db.php');
// Set the user ID from the session variable
$userid = $_SESSION['userid'];
// Check if the form is submitted
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Get the form data
$current_password = $_POST['current_password'];
$new_password = $_POST['new_password'];
$confirm_password = $_POST['confirm_password'];
// Validate the form data
if (empty($current_password) || empty($new_password) || empty($confirm_password)) {
header("Location: change_password.php?status=error&message=" . urlencode('All fields are required.'));
exit();
} elseif ($new_password !== $confirm_password) {
header("Location: change_password.php?status=error&message=" . urlencode('New password and confirm password do not match.'));
exit();
} else {
// Fetch the current password from the database
$stmt = $conn->prepare("SELECT password FROM user_login WHERE userid = ?");
$stmt->bind_param("s", $userid);
$stmt->execute();
$stmt->bind_result($hashed_password);
$stmt->fetch();
$stmt->close();
// Verify the current password
if (password_verify($current_password, $hashed_password)) {
// Hash the new password
$new_hashed_password = password_hash($new_password, PASSWORD_DEFAULT);
// Update the password in the database
$stmt = $conn->prepare("UPDATE user_login SET password = ? WHERE userid = ?");
$stmt->bind_param("ss", $new_hashed_password, $userid);
if ($stmt->execute()) {
header("Location: change_password.php?status=success&message=" . urlencode('Password changed successfully.'));
} else {
header("Location: change_password.php?status=error&message=" . urlencode('Failed to change the password. Please try again.'));
}
$stmt->close();
} else {
header("Location: change_password.php?status=error&message=" . urlencode('Current password is incorrect.'));
}
exit();
}
}
?>
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<title>Change Password - Bitmaven </title>
<meta content="width=1200" name="viewport">
<meta name="format-detection" content="telephone=no">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="fonts/icomoon/style.css" />
<link rel="stylesheet" type="text/css" href="fonts/stylesheet.css" />
<link rel="stylesheet" type="text/css" href="css/jquery-ui.min.css" />
<link rel="stylesheet" type="text/css" href="css/selectric.css" />
<link rel="stylesheet" type="text/css" href="css/owl.carousel.min.css" />
<link rel="stylesheet" type="text/css" href="css/animate.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" type="text/css" href="css/responsive.css" />
<!-- Include SweetAlert CSS and JS via CDN -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@10.16.3/dist/sweetalert2.min.css">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10.16.3/dist/sweetalert2.all.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/7.2.0/sweetalert2.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/7.2.0/sweetalert2.all.min.js"></script>
<script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="js/detect.min.js"></script>
<script type="text/javascript" src="js/jquery-ui.min.js"></script>
<script type="text/javascript" src="js/jquery.selectric.min.js"></script>
<script type="text/javascript" src="js/owl.carousel.min.js"></script>
<script type="text/javascript" src="js/clipboard.min.js"></script>
<script type="text/javascript" src="js/wow.min.js"></script>
<script type="text/javascript" src="js/clock.js"></script>
<script type="text/javascript" src="js/modal.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<script src="//code.tidio.co/okcjoxpwqcqjojyqeqtoy15nqmc3h3tq.js" async></script>
<!-- <script src="//code.jivosite.com/widget/jaS5xGD7Od" async></script> -->
</head>
<body>
<section class="wrapper">
<div class="lkPage">
<div class="lineLeftLk">
<div class="logo invsLink">
<a href="dashboard.php?a=home"></a>
<img src="img/logo.png" alt="">
</div>
<button class="menuBtn">
<span></span>
<span></span>
<span></span>
<span></span>
</button>
<div class="menuLk">
<ul>
<li class="invisLink active">
<a href="dashboard.php?a=account"></a>
<span class="iconBl icon-user-icon-3"></span>
<span class="txt">user<br> area</span>
</li>
<li class="invisLink">
<a href="deposit.php?a=deposit"></a>
<span class="iconBl icon-plus-icon"></span>
<span class="txt">make a<br> deposit</span>
</li>
<li class="invisLink">
<a href="inevest_now.php?a=deposit"></a>
<span class="iconBl icon-plus-icon"></span>
<span class="txt">make a<br> Invesment</span>
</li>
<li class="invisLink">
<a href="transaction.php?a=deposit_list"></a>
<span class="iconBl icon-files-and-folders-1"></span>
<span class="txt">your<br> deposit</span>
</li>
<li class="invisLink">
<a href="withdraw.php?a=withdraw"></a>
<span class="iconBl icon-business-and-finance-3"></span>
<span class="txt">withdraw<br> funds</span>
</li>
<li class="invisLink">
<a href="transaction.php?a=earnings"></a>
<span class="iconBl icon-time-and-date-1"></span>
<span class="txt">operation<br> history</span>
</li>
<li class="invisLink">
<a href="change_password.php"></a>
<span class="iconBl icon-time-and-date-1"></span>
<span class="txt">Change<br> Password</span>
</li>
<li class="invisLink">
<a href="logout.php?a=logout"></a>
<span class="iconBl icon-placeholder-44"></span>
<span class="txt">Logout</span>
</li>
</ul>
</div>
</div>
<div class="lkLeft">
<div class="welcomeBl">
<?php
// Assume $userid is the user's ID you want to retrieve details for
// Execute query to retrieve user information from user_login table based on userid
$sql = $conn->prepare("SELECT username, account_balance, created_at FROM user_login WHERE userid = ?");
$sql->bind_param("i", $userid);
$sql->execute();
// Store result
$sql->store_result();
// Check if there are any rows returned by the query
if ($sql->num_rows > 0) {
// Bind result variables
$sql->bind_result($username, $account_balance, $created_at);
// Fetch the row from the result set
$sql->fetch();
?>
<span class="desr">Welcome,</span>
<span class="name"><?php echo $username; ?></span>
<ul>
<li>
<span class="tit">Registration date:</span>
<span class="time"><?php echo date('M-d-Y', strtotime($created_at)); ?></span>
</li>
</ul>
<a href="index.php?a=home" class="btn btnYellow">Main page</a>
</div>
<div class="balanceBl" id="balance">
<span class="tit">Your balance:</span>
<span class="value">$ <?php echo number_format($account_balance, 2); ?></span>
<!-- <span class="value"></?php echo $row['username']; ?></span> -->
</div>
<?php
}
?>
<div class="listBalance" id="infodata">
<div class="item">
<span class="iconBl" style="background-image: url(img/ps_g/18.png);"></span>
<span class="val">0.00 <span class="cur">$</span></span>
</div>
<div class="item">
<span class="iconBl" style="background-image: url(img/ps_g/43.png);"></span>
<span class="val">0.00 <span class="cur">$</span></span>
</div>
<div class="item">
<span class="iconBl" style="background-image: url(img/ps_g/48.png);"></span>
<span class="val">0.00 <span class="cur">$</span></span>
</div>
<div class="item">
<span class="iconBl" style="background-image: url(img/ps_g/68.png);"></span>
<span class="val">0.00 <span class="cur">$</span></span>
</div>
<div class="item">
<span class="iconBl" style="background-image: url(img/ps_g/79.png);"></span>
<span class="val">0.00 <span class="cur">$</span></span>
</div>
<div class="item">
<span class="iconBl" style="background-image: url(img/ps_g/69.png);"></span>
<span class="val">0.00 <span class="cur">$</span></span>
</div>
<div class="item">
<span class="iconBl" style="background-image: url(img/ps_g/77.png);"></span>
<span class="val">0.00 <span class="cur">$</span></span>
</div>
</div>
</div>
<div class="lkRight">
<h2 class="capTitle">Change Password</h2>
<?php if ($error): ?>
<div class="error"><?php echo $error; ?></div>
<?php endif; ?>
<!-- Deposit form -->
<form method="POST" action="change_password.php" name="spendform" class="makeBl" enctype="multipart/form-data">
<!-- Deposit details -->
<div class="right">
<div class="col">
<h2 class="capTitleIn">Current Password</h2>
<div class="inputLine">
<label for="current_password">Current Password:</label>
<input type="password" name="current_password" id="current_password" required>
</div>
</div>
<div class="col">
<h2 class="capTitleIn">New Password</h2>
<div class="inputLine">
<label for="new_password">New Password:</label>
<input type="password" name="new_password" id="new_password" required>
</div>
<div class="col">
<h2 class="capTitleIn">Confirm New Password</h2>
<div class="inputLine">
<label for="confirm_password">Confirm New Password:</label>
<input type="password" name="confirm_password" id="confirm_password" required>
</div>
</div>
<div class="bot">
<button type="submit" class="btn btnGreen">Change Password</button>
</div>
<div class="bot">
<a href="dashboard.php" class="btn btnYellow">Back to Dashboard</a>
</div>
</div>
</form>
<script language=javascript>
for (i = 0; i<document.spendform.type.length; i++) {
if ((document.spendform.type[i].value.match(/^process_/))) {
document.spendform.type[i].checked = true;
break;
}
}
updateCompound();
</script>
</div>
<div class="lineRightLk">
<div class="infoLine">
<div class="top">
<div class="socialBl">
<ul>
<li><a href="https://t.me/fzjoseph"><span class="iconBl icon-telegram"></span></a></li>
</ul>
</div>
<div class="timeBlock">
<span class="iconBl icon-clock-29"></span>
<span id="date"><span></span></span>
<span id="time"><span><span class="dot">:</span><span class="dot">:</span></span></span>
</div>
<div class="linksBlock">
<ul>
<li>
<span class="iconBl icon-mail-6"></span>
<span class="tit">E-mail: </span>
<a href="mailto:bitmaven@gmail.com" class="mail">bitmaven@gmail.com</a>
</li>
<li>
<span class="iconBl icon-calendar-50"></span>
<span class="tit">Working days: </span>
<span class="txt">Daily<br> 24/7</span>
</li>
</ul>
</div>
<div class="copy"><p> Copyright ©2013 <br> Bitmaven</p></div>
</div>
</div>
</div>
</div>
</section>
<!-- SweetAlert Script -->
<script>
document.addEventListener("DOMContentLoaded", function() {
// Parse the query string to get the status and message parameters
var urlParams = new URLSearchParams(window.location.search);
var status = urlParams.get('status');
var message = urlParams.get('message');
// Check if status and message parameters are present
if (status && message) {
// Decode URI components
message = decodeURIComponent(message.replace(/\+/g, ' '));
// Show SweetAlert based on the status
if (status === 'success') {
Swal.fire({
icon: 'success',
title: 'Success!',
text: message,
});
} else {
Swal.fire({
icon: 'error',
title: 'Error!',
text: message,
});
}
}
});
</script>
</body>
</html>
Back to Directory
File Manager
<