-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_master.php
84 lines (66 loc) · 2.21 KB
/
update_master.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
include_once 'lib/dao.php';
include_once 'lib/model.php';
$d = new dao();
$m = new model();
$a1;
if(isset($_POST["update_password"]))
{
extract(array_map("test_input" , $_POST));
session_start();
$username = $_SESSION['username'];
$m->set_data('password',$password);
$a1= array ('password'=> $m->get_data('password'));
// print_r($a1);
session_start();
$username = $_SESSION['username'];
$update=$d->update("members",$a1 ,"username='$username'");
if($update>0)
{
header('location:profile.php?msg=Password Updated');
}
else {
header('location:profile.php?msg1=Please Try Again.');
}
}
else if(isset($_POST["update_contactno"]))
{
extract(array_map("test_input" , $_POST));
session_start();
$username = $_SESSION['username'];
$m->set_data('contactno',$contactno);
$a1= array ('contactno'=> $m->get_data('contactno'));
// print_r($a1);
session_start();
$username = $_SESSION['username'];
$update=$d->update("members",$a1 ,"username='$username'");
if($update>0)
{
header('location:profile.php?msg=Password Updated');
}
else {
header('location:profile.php?msg1=Please Try Again.');
}
}
else if(isset($_POST["update_image"]))
{
extract(array_map("test_input" , $_POST));
$imagetype=$_FILES["file"]['type'];
$imagesize=$_FILES["file"]['size'];
$image_Arr = $_FILES['file'];
move_uploaded_file($image_Arr['tmp_name'],'img/' .$image_Arr['name']);
$file_name = $image_Arr['name'];
session_start();
$username = $_SESSION['username'];
$m->set_data('file_name',$file_name);
$a1= array ('file'=> $m->get_data('file_name'));
$update=$d->update("members",$a1,"username='$username'");
if($update>0)
{
header('location:profile.php?msg=Image Updated');
}
else {
header('location:profile.php?msg1=Image not changed');
}
}
?>