The following files exists in this folder. Click to view.
pchanger.php30 lines ASCII Unix (LF)
<?php
include('check_login.php');
$file_in = "users.json";
$json = json_decode(file_get_contents($file_in), true);
if($_SESSION["password"] == $_POST["npassword"]){
header("location:pmanager.php?mess=OLD");
exit();
}
if($_POST["opassword"] != $_SESSION["password"]){
header("location:pmanager.php?mess=BAD");
exit();
}
foreach($json["users"] as &$u){
if($u["usn"]==$_SESSION["username"]){
$u["pwd"]=$_POST["npassword"];
$file_out = "users.json";
$file = fopen($file_out, "w");
fwrite($file, json_encode($json, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
fclose($file);
}
}
header("location:index.php?mess=NEWPASS");
exit();
?>