-
Notifications
You must be signed in to change notification settings - Fork 0
/
gallery1.php
145 lines (111 loc) · 3.65 KB
/
gallery1.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
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
136
137
138
139
140
141
142
143
144
145
<?php
session_start();
require 'vendor/autoload.php';
#create RDSclient using the us-west-2
$rds = new Aws\Rds\RdsClient([
'version' => 'latest',
'region' => 'us-west-2'
]);
#fetch the DB instance
$result = $rds->describeDBInstances(['DBInstanceIdentifier' => 'usneha']);
#get the end point to the instance
$endpoint = $result['DBInstances'][0]['Endpoint']['Address'];
print "============\n". $endpoint . "================";
echo "endpoint is available";
echo "Inside Gallery code";
$link = mysqli_connect($endpoint,"username","password","usnehadb",3306);
?>
<!DOCTYPE html>
<html><head>
<!-- adding jquery gallery as per graduate requirement -->
<link rel="stylesheet" href="https://raw.githubusercontent.com/usneha/itmo-544-mp1/master/css/magnific-popup.css" />
<style>
.magnific-gallery li{
float: relative;
height: 80px;
}
.magnific-gallery img{
width:75px;
border: 1px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://raw.githubusercontent.com/usneha/itmo-544-mp1/master/js/jquery.magnific-popup.js"></script>
<script src="https://raw.githubusercontent.com/usneha/itmo-544-mp1/master/js/jquery.magnific-popup.min.js"></script>
</head>
<body>
<h3> Welcome to your Gallery! </h3>
<?php
if (!$link)
{
die("connection failed". mysqli_connect_error());
}
else
{
if(isset($_POST['email'])){
$useremail = $_POST['email'];
$sqlstat= "SELECT RawS3Url FROM items WHERE Email='$useremail'";
}
else
{
$sqlstat= "SELECT RawS3Url FROM items";
$output = mysqli_query($link, $sqlstat);
$link->real_query("SELECT RawS3Url FROM items WHERE email = '$useremail'");
$res = $link->use_result();
echo "Result set order...\n";
while ($row = $res->fetch_assoc()) {
echo "<img src =\" " . $row['s3rawurl'] . "\" /><img src =\"" .$row['s3finishedurl'] . "\"/>";
echo $row['id'] . "Email: " . $row['email'];
}
}
//$link->real_query("SELECT * FROM items");
$res = $link->use_result();
echo "Result set order...\n";
while ($row = $res->fetch_assoc()) {
echo "<img src =\" " . $row['s3rawurl'] . "\" /><img src =\"" .$row['s3finishedurl'] . "\"/>";
echo $row['id'] . "Email: " . $row['email'];
}
$link->close();
//$link->real_query("SELECT * FROM items WHERE email = '$email'");
//$link->real_query("SELECT * FROM items");
//$res = $link->use_result();
//echo "Result set order...\n";
//while ($row = $res->fetch_assoc()) {
// echo "<img src =\" " . $row['s3rawurl'] . "\" /><img src =\"" .$row['s3finishedurl'] . "\"/>";
//echo $row['id'] . "Email: " . $row['email'];
//}
//$link->close();
#$imgPath = array();
//print "Result set order...\n";
#if (mysqli_num_rows($output) > 0) {
# while($row = mysqli_fetch_assoc($output)) {
# $imgPath[$row["JpgFileName"]] = $row["RawS3URL"];
// echo "id: " . $row["ID"]."- RawS3URL" . $row["RawS3URL"]. "<br>";
// echo "<img src =\" " . $row['s3rawurl'] . "\" /><img src =\"" .$row['s3finishedurl'] . "\"/>";
//echo $row['id'] . "Email: " . $row['email'];
#}
#}
#else {
# echo "no rows in the output";
#}
#$link->close();
}
?>
<!--
/<ul class="magnific-gallery">
//<?php foreach ($imgPath as $key => $value) {
//?>
<li>
<a href="<?php echo $value ?>"> <img src=<?php echo $value ?>"></img><?php echo $key ?></a>
<?php echo $value; ?>
<?php echo $key; ?>
</li>
<?php }?>
-->
</ul>
</body>
<!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://raw.githubusercontent.com/usneha/itmo-544-mp1/master/js/jquery.magnific-popup.js"></script>
<script src="https://raw.githubusercontent.com/usneha/itmo-544-mp1/master/js/jquery.magnific-popup.min.js"></script>
-->
</html>