password_change.php
File Type: php
File Location: monofiles/
File name: password_change.php
<?php
include_once 'data_connect.php';
if (isset($_POST['pas']) && isset($_POST['password']) && $_POST['pas'] == $_POST['password']) {
$subcnt = time() - (int)$_POST['subtimer'];
if ($_POST['sesssid'] == session_id() && $subcnt < 3*60 && $subcnt > 0) {
$pas = $_POST['pas'];
$password = $_POST['password'];
include 'set-cost.php';
$_POST['password'] = password_hash($password, PASSWORD_DEFAULT,["cost" => $cost]);
include 'log.php';
update_account($_SESSION['userID'],'set');
session_destroy();
header('Location:login.php?bye');
}
else
$message = 'Please try again';
}
if( (isset($_POST['pas'])) || (isset($_POST['password'])) && ( $_POST['pas'] != $_POST['password']) )
$message = !isset($message) ? 'Passwords did not match' : $message;
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="cmstyle.css">
<?php include 'csstheme.php' ?>
<title>Settings - Change Password</title>
</head>
<body>
<?php
include 'mypanel.php';
if (isset($message))
echo '<div id="error-confirm"><span>'.$message.'</span></div>'
?>
<div class="main">
<h1 class="inbl">
<a href="general.php" title="Back to Settings">←</a>
Change password</h1>
<div id="pass-change">
<form id="passform" action="" style="margin:10px" method="post">
<!-- PASS INPUT -->
<span style="font-size:16px">New password</span>
<input class="passinput" id="passwrd" name="pas" value="" type="password">
<div style="height:20px"></div>
<!-- PASS INPUT -->
<span style="font-size:16px">Type again</span>
<input class="passinput" id="passwrd_sec" name="password" value="" type="password">
<!-- session & time confirm -->
<input type="hidden" name="sesssid" value="<?php print session_id() ?>">
<input type="hidden" name="subtimer" value="<?php print time() ?>">
<!-- SUBMIT -->
<input class="stylish-button" style="margin-top:40px" type="submit">
</form>
</div>
</div>
</body>
</html>