-
Notifications
You must be signed in to change notification settings - Fork 0
/
ajax_changepassword.php
50 lines (44 loc) · 1.29 KB
/
ajax_changepassword.php
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
require_once("shared.php");
$rc = -1;
$msg = "";
try
{
if (isset($_POST['uuid']) && isset($_POST['useruuid']) && isset($_POST['password']))
{
$uuid = $_POST['uuid'];
$memberuuid = $_POST['useruuid'];
$password = $_POST['password'];
$userid = SharedGetUserIdFromUuid($uuid, $dblink);
$memberid = SharedGetUserIdFromUuid($memberuuid, $dblink);
if ($memberid != 0)
{
$dbupdate = "update users set " .
"pwd=" . SharedNullOrQuoted($password, 50, $dblink) . "," .
"datemodified=CURRENT_TIMESTAMP," .
"usersmodified_id=$userid " .
"where " .
"id=$memberid";
error_log($dbupdate);
if ($dbresult = SharedQuery($dbupdate, $dblink))
{
$rc = 0;
$msg = "Password successfully changed...";
}
else
$msg = "Error changing password...";
}
else
$msg = "Unable to retrieve member details...";
}
else
$msg = "Missing parameters...";
}
catch (Exception $e)
{
$msg = "Unable to change password...";
}
$response = array("rc" => $rc, "msg" => $msg);
$json = json_encode($response);
echo $json;
?>