-
Notifications
You must be signed in to change notification settings - Fork 0
/
my_account_submit.php
34 lines (34 loc) · 1.04 KB
/
my_account_submit.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
<?php
session_start();
include('function.php');
include('constant.php');
include('connect.php');
if(!isset($_SESSION['USER_LOGIN']) && $_SESSION['USER_LOGIN']!='yes'){
redirect(constant('FETCH_PATH').'shop');
}
// prx($_POST[]);
$id=$_SESSION['USER_ID'];
$type=$_POST['type'];
if($type=='name_details'){
$name=$_POST['name'];
$mobile=$_POST['mobile'];
$smtm=$con->prepare("update user set name='$name',mobile='$mobile' where id='$id'");
$smtm->execute();
$_SESSION['USER_NAME']=$name;
}
if($type=='password_details'){
$old_password=$_POST['old_password'];
$smtm=$con->prepare("select * from user where id='$id'");
$smtm->execute();
$row=$smtm->fetch(PDO::FETCH_ASSOC);
if(password_verify($old_password,$row['password'])){
$new_password=$_POST['new_password'];
$db_password=password_hash($new_password,PASSWORD_BCRYPT);
$smtm=$con->prepare("update user set password='$db_password' where id='$id'");
$smtm->execute();
echo 'success';
}else{
echo 'error';
}
}
?>