-
Notifications
You must be signed in to change notification settings - Fork 1
/
uploadedTogether.php
77 lines (60 loc) · 2.23 KB
/
uploadedTogether.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
<html>
<head>
<title>Pipoca</title>
<link rel="stylesheet" type="text/css" href="css/main.css">
<style>
img {
float: left;
margin: 0 20px 10px 0;
width: 150px;
}
.item {
}
</style>
</head>
<body>
<div id="#tudo">
<object data="css/logo.svg" type="image/svg+xml" height=200 width=900></object>
<div id="menu">
<?php include("menu.html"); ?>
</div>
<div id="centro">
<h2>Registered images</h2>
<?php
include("connection.php");
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$d = str_replace("x"," ",$_GET["date"]); //tweaking back the string
echo "<span class='fieldname'>Images uploaded at: </span>" . $d . "</br></br>\n";
//getting the registers inserted at the given date
$sql = "SELECT id, name, memo FROM sources WHERE date='" . $d . "'";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
//basic info from the sources table
echo "<div class='item'>";
echo "<img src='sources/" . $row["name"]. "'>\n";
echo "<span class='fieldname'>ID: </span>" . $row["id"]. "<br/><span class='fieldname'>Description: </span>" . $row["memo"]. "<br/>";
//getting and showing the attributes
$result2 = mysqli_query($conn, "SELECT * FROM (SELECT sourceAttributes.value, attributes.name, sourceAttributes.source_id FROM sourceAttributes INNER JOIN attributes ON sourceAttributes.attributes_id=attributes.id)fusao WHERE source_id=" . $row["id"]);
echo "<span class='fieldname'>Atributes:</span>";
while($row2 = mysqli_fetch_assoc($result2)) {
echo $row2["name"] . "=" . $row2["value"] . ", ";
}
echo "\n<br>\n<br>\n<span class='fieldname'>actions:</span><a href='viewImagewithBites.php?idImage=" . $row["id"] . "'>View</a> | <a href='editAttributes.php?idImage=" . $row["id"] . "'>Edit attributes</a> | <a href='applyCodes.php?idImage=" . $row["id"] . "'>Apply code</a>";
echo "\n<div style='clear: both;'><!-- --></div></div>\n";
}
} else {
echo "0 results";
}
mysqli_close($conn);
?>
</div>
</div>
</body>
</html>