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'])) {
        
        
$pas $_POST['pas'];
        
$password $_POST['password'];
    
        include 
'set-cost.php';
        
$_POST['password'] = password_hash($passwordPASSWORD_DEFAULT,["cost" => $cost]);
        
        include 
'log.php';
        
update_account($_SESSION['userID'],'set');

        
session_destroy();
        
header('Location:login.php?bye');
    }
    
if( (isset(
$_POST['pas'])) || (isset($_POST['password'])) && ( $_POST['pas'] != $_POST['password']) )

        
$message 'Passwords did not match. Please try again.';

?>
<!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">&larr;</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">
            
            
            
            <!-- SUBMIT -->
            <input class="stylish-button" style="margin-top:40px" type="submit">
            
            
        </form>
        
    </div>
    
</div>
</body>
</html>