-
Notifications
You must be signed in to change notification settings - Fork 0
/
submit-change-password.php
44 lines (31 loc) · 1.07 KB
/
submit-change-password.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
<?php
require_once('functions/function.php');
needtologin();
if(!empty($_POST))
{
$current_password=md5($_POST['current_password']);
$new_password=md5($_POST['new_password']);
$confirm_new_password=md5($_POST['confirm_new_password']);
if($_SESSION['role_id']=='1'){
$password=$_SESSION['sa_password'];
$update="UPDATE super_admin SET sa_password='$new_password'";
}else{
$password=$_SESSION['password'];
$slug=$_SESSION['slug'];
$update="UPDATE user SET password='$new_password' WHERE slug='$slug'";
}
if($password==$current_password){
if($new_password==$confirm_new_password){
$Q=mysqli_query($con,$update);
$_SESSION['success_alert']='10';
header('Location: change-password.php');
}else{
$_SESSION['success_alert']='8';
header('Location: change-password.php');
}
}else{
$_SESSION['success_alert']='9';
header('Location: change-password.php');
}
}
?>