-
Notifications
You must be signed in to change notification settings - Fork 0
/
changepass.php
29 lines (27 loc) · 1.11 KB
/
changepass.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
<?php
#####################################################################
#
# File : CHANG PASS
# Project : Game Magazine Project
# Author : Béo Sagittarius
# Created : 07/01/2015
#
##################################################################### -->
include('/includes/backend/mysqli_connect.php');
include('/includes/functions.php');
if (isset($_POST['oldpass'])) {
$oldpass = mysqli_real_escape_string($dbc, strip_tags($_POST['oldpass']));
$newpass = mysqli_real_escape_string($dbc, strip_tags($_POST['newpass']));
$result = checkOldPass($oldpass, $_SESSION['uid']);
if (mysqli_num_rows($result) == 1) {
$user = mysqli_fetch_array($result, MYSQLI_ASSOC);
$rs2 = changePass($newpass, $_SESSION['uid']);
if (mysqli_affected_rows($dbc) == 1) {
echo json_encode(['status' => 'OK']);
} else {
echo json_encode(['status' => 'FAIL']);
}
} else {
echo json_encode(['status' => 'CHECK FAIL']);
}
}