-
Notifications
You must be signed in to change notification settings - Fork 0
/
kuva.php
49 lines (38 loc) · 1.29 KB
/
kuva.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
<?php
session_start();
$db = mysqli_connect('127.0.0.1:49207', 'azure', '******', 'terveysremontti');
$email = $_SESSION['email'];
$sql = "SELECT * FROM accounts WHERE email='$email'";
$result = $db->query($sql);
if (mysqli_num_rows($result) > 0) {
// fetches a result row as an associative array
while ($row = mysqli_fetch_assoc($result)) {
$id = $row['id']; // tarkista onko sama accounts taulussa
$sqlImg = "SELECT * FROM profileimg WHERE id= '$id'";
$resultImg = mysqli_query($db, $sqlImg);
while ($rowImg = mysqli_fetch_assoc($resultImg)) {}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Image Upload</title>
</head>
<body>
<form action="upload.php" method="POST" enctype="multipart/form-data">
<div class="col-md-3">
<?php
if ($rowImg['status'] == 0) {
echo "<img src='images/profiili".$id.".jpg' class='img-thumbnail' alt='Responsive image'>";
}
else {
echo "<img src='kuvat/profile.png' class='img-thumbnail' alt='Responsive image'>";
}
?>
</div>
<input type="file" name="file">
<button type="submit" name="submit">Lataa profiilikuva</button>
</form>
</body>
</html>