-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofilePage.php
More file actions
137 lines (115 loc) · 3.92 KB
/
Copy pathprofilePage.php
File metadata and controls
137 lines (115 loc) · 3.92 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<title>A Walk in the Bark</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="HomePage.css?version=3" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://kit.fontawesome.com/c91294ea81.js" crossorigin="anonymous"></script>
</head>
<body>
<div class="header">
<i class="fas fa-dog fa-5x"></i><h1>A Walk in the Bark</h1>
<p><b>Dog walking</b> in Leeds</p>
<?php
session_start();
if(isset($_SESSION['user'])){
echo 'Welcome '.$_SESSION['user'].'<br>';
}elseif(isset($_SESSION['admin'])){
echo 'Welcome '.$_SESSION['admin'].'<br>';
}
?>
</div>
<div class="navbar">
<a href="index.php"><i class="fa fa-fw fa-home"></i> Home</a>
<a href="Walkers.php"><i class="fa fa-fw fa-paw"></i> Walkers</a>
<?php
if(isset($_SESSION['admin'])){
echo '<a href="adminPage.php"><i class="fa fa-cog fa-spin"></i> Admin</a>';
}
?>
<a href="Login/loginform.php" class="right"><i class="fa fa-fw fa-user"></i> Login</a>
<a href="profilePage.php" class="right active"><i class="fa fa-fw fa-user"></i> Profile</a>
</div>
</div>
<div class="main">
<div class= "profile-pic">
<?php
include 'connection.php';
$query = "SELECT * FROM dogusers WHERE userName = '$_SESSION[username]' AND userPass = '$_SESSION[password]'";
//echo $query;
//exit;
$result=mysqli_query($connection, $query);
while ($row=mysqli_fetch_assoc($result)){
$_SESSION['id'] = $row['userID'];
$email = $row['userEmail'];
$fname = $row['name'];
$city = $row['city'];
$postcode = $row['postcode'];
$id = $_SESSION['id'];
$img = $row['Img'];
//echo $id;
//exit;
}
if($img == 0){
echo "<img src='Images/ProfileDefault.png'>";
} else {
echo "<img src='Images/Profile".$id.".png' style= height:150px;width:150px;object-fit:cover;>";
}
?>
</div>
<form method="post" action="Login/update.php" style="max-width:30%;margin:auto">
<h2>Update Profile</h2>
<div class="errors">
<?php
foreach ($_SESSION['errors'] as $value) {
echo "$value <br>";
}
?>
</div>
<b>
<label>Email:</label>
<div class="input-container">
<i class="fa fa-envelope icon"></i>
<input class="input-field" input type="text" placeholder="Email" name="regEmail" value= "<?php echo $email; ?>" />
</div>
<label>Full Name:</label>
<div class="input-container">
<i class="fa fa-address-card icon"></i>
<input class="input-field" input type="text" placeholder="Full Name" maxlength="30" name="name" value= "<?php echo $fname; ?>" />
</div>
<label>City:</label>
<div class="input-container">
<i class="fa fa-globe icon"></i>
<input class="input-field" input type="text" placeholder="City/Town" maxlength="20" name="city" value= "<?php echo $city; ?>" />
</div>
<label>Outward Postcode:</label>
<div class="input-container">
<i class=" fa fa-address-book icon"></i>
<input class="input-field" input type="text" placeholder="Postcode (Outward)" maxlength="4" name="postcode" value= "<?php echo $postcode; ?>" />
</div>
</b>
<div class="input-group">
<button type="submit" class='btn' name="upSubmit" value="submit">Update</button>
</div>
<p>
</p>
</form>
<form action="upload.php" method="post" enctype="multipart/form-data">
<h2>Update Profile Picture</h2>
<b>
Select image to upload:
<input type="file" name="fileToUpload" id="fileToUpload">
<input type="submit" value="Upload Image" name="submit">
</form>
</div>
</div>
</b>
<div class="footer">
<?php
echo '<a href="Login/logout.php">logout</a>' ;
?>
</div>
</body>
</html>