-
Notifications
You must be signed in to change notification settings - Fork 2
/
update-profile.php
75 lines (50 loc) · 1.28 KB
/
update-profile.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
<?php
require 'init.php';
session_regenerate_id(true);
include('config.php');
include('functions.php');
if(isset($_POST['submit']))
{
$ID = $_SESSION['id'];
$full_name = $_POST['full_name'];
$user_name= $_POST['user_name'];
$email_address= $_POST['email'];
$facebook = $_POST['fbook'];
$whatsapp = $_POST['wapp'];
$bio = $_POST['bio'];
$image = $_FILES['image']['temp_name'];
if($image != "")
{
$image_name = $user_name . ".jpg";
}
else{
$image_name = $_SESSION['img_path'];
}
if($user_name != $_SESSION['username'])
{
$sql_query = "SELECT USER_NAME FROM USERS WHERE USER_NAME = '$user_name';";
echo $sql_query;
$stmt = $conn->prepare($sql_query);
$stmt->execute();
$stmt->store_result();
if($stmt->num_rows() > 0)
{
header('location: edit-profile.php?error_message=User Name Already Taken');
exit;
}
else
{
Update_Profile($ID, $full_name, $user_name, $email_address, $facebook, $whatsapp, $bio);
}
}
else
{
Update_Profile($ID, $full_name, $user_name, $email_address, $facebook, $whatsapp, $bio);
}
}
else
{
header("location: edit-profile.php");
exit;
}
?>