View sourcecode

The following files exists in this folder. Click to view.

pchanger.php

30 lines ASCII Unix (LF)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?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($filejson_encode($jsonJSON_UNESCAPED_UNICODE JSON_PRETTY_PRINT));
        
fclose($file);
    }
}

header("location:index.php?mess=NEWPASS");
exit();
?>