-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathupdateprofile.php
148 lines (103 loc) · 3.31 KB
/
updateprofile.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?php
require ('core.inc.php');
include ('headerlogin.php');
include('connect.php');
if(loggedIn()) {
$sql= "SELECT * FROM registration WHERE email ='".$_SESSION['email']."'";
$result = mysqli_query($link, $sql);
while (@$row = mysqli_fetch_array($result)) {
if($_POST)
{
$fnm= $_POST["fnm"];
$lnm= $_POST["lnm"];
$phn= $_POST["phn"];
$abi= $_POST["abi"];
$err1 = 0;
$err2 = 0;
$err3 = 0;
$err4 = 0;
if(trim($fnm)=="")
{
$err1=1;
}
if(trim($lnm)=="")
{
$err2=1;
}
if(trim($phn)=="")
{
$err3=1;
}
if(trim($abi)=="")
{
$err4=1;
}
$error = $err1+$err2+$err3+$err4;
if ($error == 0){
$res = "UPDATE registration SET first_name='".$fnm."', last_name='".$lnm."', PhoneNumber='".$phn."', Abilities='".$abi."' WHERE email='".$_SESSION['email']."'";
$result = mysqli_query($link, $res);
if($res){
echo "<div class=\"alert alert-success alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">×</button>
Updated Successfully!
</div>";
echo "<meta http-equiv='refresh' content='0'>";
}else{
echo "<div class=\"alert alert-danger alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">×</button>
Some Problem Occure. Please Try Again Later !
</div>";
}
} else {
if ($err1 == 1){
echo "<div class=\"alert alert-danger alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">×</button>
First Name Can Not Be Empty!!!
</div>";
}
if ($err2 == 1){
echo "<div class=\"alert alert-danger alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">×</button>
Last Name Can Not Be Empty!!!
</div>";
}
if ($err3 == 1){
echo "<div class=\"alert alert-danger alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">×</button>
Phone Number Can Not Be Empty!!!
</div>";
}
if ($err4 == 1){
echo "<div class=\"alert alert-danger alert-dismissable\">
<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">×</button>
Abilities Can Not Be Empty!!!
</div>";
}
}
}
echo '<section class="section">
<div class="inner text-center">
<h4 class="title text-white uppercase" style="position: relative; color:#000000!important;">Update your Profile -'. $ufnm .'</h4>
</div>
<div class="col-md-6 col-md-offset-3 col-sm-12">
<form action="" method="post" id="proForm" name="proForm">
First Name:
<input class="form-control input-lg" name="fnm" type="text" value="'.$row['first_name'].'" required><br><br>
Last Name:
<input class="form-control input-lg" name="lnm" type="text" value="'.$row['last_name'].'" required><br><br>
Phone Number:
<input class="form-control input-lg" name="phn" type="tel" value="'.$row['PhoneNumber'].'" required><br><br>
Abilities (Programming Skills):
<input class="form-control input-lg" name="abi" type="text" value="'.$row['Abilities'].'" required><br><br>
<button type="submit" class="btn btn-success btn-block">CHANGE</button>
</form>
</div>
<section>';
}
}else {
die("Unauthorised entry");
}
include 'footer.php';
?>
</body>
</html>