-
Notifications
You must be signed in to change notification settings - Fork 1
/
profile_pass_edit_action.php
45 lines (38 loc) · 1.28 KB
/
profile_pass_edit_action.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
<?php
$ID =$_REQUEST['accID'];
include("db.php");
if (isset($_POST['ProfileEdit']))
{
$profile_edit_oldpass = $_POST['profile_edit_oldpass'];
$profile_edit_password = $_POST['profile_edit_password'];
$profile_edit_repassword = $_POST['profile_edit_repassword'];
if (empty($profile_edit_oldpass))
{
}
else
{
$res = mysqli_query($con,"SELECT * FROM emp_accounts_record WHERE accID = '$ID'");
$test = mysqli_fetch_array($res);
if ($profile_edit_oldpass == $test['password'])
{
if ($profile_edit_password == $profile_edit_repassword) //if password and retypepassword match query execute
{
//Query for update profile information
$sql = "UPDATE emp_accounts_record ";
$sql.= " SET password = '$profile_edit_password' WHERE accID ='$ID'";
$result = mysqli_query($sql);
//display success update msg
echo "<script>alert('Update info successfully');
window.location='profile.php';
</script>";
}
else//if password not match display error msg
{
echo "<script>alert('Password Not Match');
window.location='profile.php';
</script>";
}
}
}
}
?>