-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathupdate-profile.php
More file actions
40 lines (32 loc) · 1.05 KB
/
update-profile.php
File metadata and controls
40 lines (32 loc) · 1.05 KB
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
<?php
include("includes/db_conn.php");
if(isset($_POST['update-profile']))
{
$admin_id = mysqli_real_escape_string($db, $_POST['admin_id']);
$fullname = mysqli_real_escape_string($db, $_POST['fullname']);
// image processing
$admin_img = $_FILES['user_img']['name'];
$temp_name = $_FILES['user_img']['tmp_name'];
move_uploaded_file($temp_name,"user_images/$admin_img");
if($admin_img == "")
{
$update_pro = "UPDATE admin_tbl SET fullname = '$fullname' WHERE admin_id = '$admin_id'";
$run_pro = mysqli_query($db, $update_pro);
if($run_pro)
{
echo "<script>alert('Profile updated successfully!')</script>";
echo "<script>document.location='profile.php'</script>";
}
}
else
{
$update_pro = "UPDATE admin_tbl SET fullname = '$fullname', admin_img = '$admin_img' WHERE admin_id = '$admin_id'";
$run_pro = mysqli_query($db, $update_pro);
if($run_pro)
{
echo "<script>alert('Profile updated successfully!')</script>";
echo "<script>document.location='profile.php'</script>";
}
}
}
?>