-
Notifications
You must be signed in to change notification settings - Fork 0
/
album.php
340 lines (315 loc) · 15.8 KB
/
album.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Albums</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="script.js"></script>
</head>
<body>
<?php
include("barreoutils.php");
?>
<?php
$bdd3 = new PDO("mysql:host=localhost;dbname=librarie", "root", "");
$mailSes = $_GET['email'];
$mailSes2 = $_SESSION['email'];
$requetePro = $bdd3->query("SELECT * FROM profil WHERE email=\"$mailSes\"");
$resultPro = $requetePro->fetch();
if(isset($_POST['albumTitre']) AND !empty($_POST['albumTitre'])){
$tmptitre = $_POST['albumTitre'];
$tmpstatu = $_POST['prive'];
if($reqalbum = $bdd3->query("INSERT INTO albums VALUES ('$mailSes', '$tmptitre', NULL, '$tmpstatu')")){
echo $mailSes;
echo $tmptitre;
echo $tmpstatu;
}
}
if(isset($_POST['album'])){
$tmpidal = $_POST['album'];
$tmpidphoto = $_POST['photoalbid'];
$jajou = $bdd3->query("INSERT INTO albumphoto VALUES ('$tmpidal', '$mailSes', '$tmpidphoto', NULL)");
}
?>
<div>
<h3 id="profil_nom"><?php echo $resultPro['prenom'] . " " . $resultPro['nom']; ?></h3>
</div>
<div ><img src="<?php echo $resultPro['profil_picture'] ;?>" id="profilphoto"></div>
<table id="profilmenu">
<tr>
<td><a href="profil.php?email=<?php echo $mailSes;?>">Photos</a></td>
<td class="encadre"><a href="album.php?email=<?php echo $mailSes;?>">Albums</a></td>
<td><a href="favoris.php?email=<?php echo $mailSes;?>">Favoris</a></td>
</tr>
</table>
<input type="button" value="<-" id="return">
<?php
if ($mailSes==$_SESSION['email']) {
$requeteAlb = $bdd3->query("SELECT * FROM albums WHERE email=\"$mailSes\"");
?>
<input type="button" value="+" id="addalb">
<div id="newalb">
<div id="alb">
<form method="post" action="album.php?email=<?php echo $mailSes;?>">
<input type="text" name="albumTitre" placeholder="Veuillez entrer le nom d'album" required class="form inp2 alb1"><br>
<div id="chpri" >
<br>
<input type="radio" name="prive" value="1"/> <label>Privée</label>
<input type="radio" name="prive" value="0"/> <label>Public</label>
</div>
<br>
<input type="submit" class="bouton inp alb1" value="Ajouter Nouveau Album ">
</form>
</div>
</div>
<div class="fullcontent" >
<div id="gallerieProfil" class="gallerie album">
<?php while($resultAlb = $requeteAlb->fetch())
{
$titrealbum = $resultAlb['titre_album'];
$idalbum = $resultAlb['id_album'];
$requeteAlbPho = $bdd3->query("SELECT * FROM albumphoto WHERE email=\"$mailSes\" AND id_album=\"$idalbum\"");
$resultAlbPho = $requeteAlbPho->fetch();
$tmpphoto = $resultAlbPho['idphoto'];
$requeteAlbPhoMaster = $bdd3->query("SELECT * FROM photos WHERE idphoto=\"$tmpphoto\"");
$resultAlbPhoMaster = $requeteAlbPhoMaster->fetch();
?>
<div class="contenualbum">
<div class="thumbnailalbum" >
<div class="thumno grey" >
<a href="#" class="albumlight" data-rel="fca<?php echo $resultAlb['id_album'];?>">
<img src="<?php echo $resultAlbPhoMaster['path']; ?>" class="landscape albumMaster" alt="<?php echo $resultAlb['titre_album'];?>">
</a>
</div>
<div class="titlealbum">
<p><?php echo $titrealbum; ?></p>
</div>
</div>
<div class="galAlbum" id="fca<?php echo $resultAlb['id_album'];?>">
<?php
$requeteAlbPho2 = $bdd3->query("SELECT * FROM albumphoto WHERE id_album=\"$idalbum\"");
?> <p class="titrealbumno"><?php echo $resultAlb['titre_album'];?> </p><?php
while($resultAlbPhoGal = $requeteAlbPho2->fetch()){
$tmpphotoGal = $resultAlbPhoGal['idphoto'];
$requeteAlbPhoMasterGal = $bdd3->query("SELECT * FROM photos WHERE idphoto=\"$tmpphotoGal\"");
$result2 = $requeteAlbPhoMasterGal->fetch();
?>
<div class="thumbnail">
<div class="thumno">
<a href="#" data-width="60%" data-rel="popup_img<?php echo $result2['idphoto']; ?>" class="poplight">
<img src="<?php echo $result2['path']; ?>" class="landscape" alt="<?php echo $result2['titre_photo']; ?>">
</a>
</div>
<div class="titlealbum">
<p class="soustitre"><?php echo $result2['titre_photo']; ?></p>
</div>
</div>
<?php
}
?>
</div>
</div>
<?php
}
?>
</div>
</div>
<?php
$requeteAlb2 = $bdd3->query("SELECT * FROM albums WHERE email=\"$mailSes\"");
?>
<div class="popup_img">
<?php
while($result = $requeteAlb2->fetch())
{
$tempid = $result['id_album'];
$requetePf = $bdd3->query("SELECT * FROM albumphoto WHERE email=\"$mailSes\" AND id_album=\"$tempid\"");
while($resultPf = $requetePf->fetch()){
$tmpphotopop = $resultPf['idphoto'];
$request= $bdd3->query("SELECT * FROM photos WHERE idphoto=\"$tmpphotopop\"");
$requestPf = $bdd3->query("SELECT * FROM profil WHERE email=\"$mailSes\"");
$resultPf = $requestPf->fetch();
$result3 = $request->fetch();
?>
<div id="popup_img<?php echo $result3['idphoto']; ?>" class="popup_block">
<img src="<?php echo $result3['path']; ?>" class="popup_image portrait" alt="Cedric Content">
<div class="exif" id="exif<?php echo $result3['idphoto'];?>">
<?php
if($exif = exif_read_data($result3['path'], 0, true)){
foreach ($exif as $key => $section) {
foreach ($section as $name => $val) {
echo "$key.$name: $val<br />\n";
}
}
} else {
echo "Exif info non disponible";
}
?>
<input type="button" class="adminsup closeExif" value="x">
</div>
<div class="comments" >
<input type="button" data-rel="exif<?php echo $result3['idphoto'];?>" class="bouton2 exifbut" value="Exif">
<a href="profil.php?email=<?php echo $result3['email'];?>" id="Xprofil" ><?php echo $resultPf['prenom']; ?> <?php echo $resultPf['nom']; ?> <?php echo $result3['commentaire']; ?>Lieu :<?php echo $result3['lieu']; ?> Date :
<?php echo $result3['date']; ?></a>
<form name="ajoutfav" action="profil.php?email=<?php echo $mailSes;?>" method="post">
<input type="text" name="photoid" value="<?php echo $result3['idphoto'];?>" required class="form inp2 photoid">
<input type="submit" class="bouton" id="like" value="<3" >
</form>
<form name="modifierphotos" action="modifierphoto.php?idphoto=<?php echo $result3['idphoto'];?>" method="post">
<a href="modifierphoto.php?idphoto=<?php echo $result3['idphoto'];?>">
<input type="text" name="photoid2" value="<?php echo $result3['idphoto'];?>" required class="form inp2 photoid">
<input type="submit" class="bouton2" id="plus" value="...">
</a>
</form>
<form name="ajoutalbum" method="post" class="plplplpl">
<input type="text" name="photoalbid" value="<?php echo $result3['idphoto'];?>" required class="form inp2 photoid">
<div class="albumlisto" id="list<?php echo $result3['idphoto'];?>">
<label for="AlbumName"></label>
<select name="album" class="albumlist">
<?php
$requestListe = $bdd3->query("SELECT * FROM albums WHERE email=\"$mailSes\"");
while($resultListe = $requestListe->fetch()){
echo '<option value="'. $resultListe['id_album'] . '">' . $resultListe['titre_album'] .'</option>';
}
?>
</select>
<input type="submit" class="bouton validerajoutalbum" id="validerajoutalbum<?php echo $result3['idphoto'];?>" value="valider">
<input type="button" class="bouton closeem" id="closeem<?php echo $result3['idphoto'];?>" value="x">
</div>
<input type="button" data-rel="list<?php echo $result3['idphoto'];?>" class="bouton ajoutalbum" value="+">
</form>
</div>
</div>
<?php
}
}
?>
</div>
<?php
}
?>
<?php
if ($mailSes!=$_SESSION['email']) {
$requeteAlb = $bdd3->query("SELECT * FROM albums WHERE email=\"$mailSes\" AND statut='0'");
?>
<div class="fullcontent" >
<div id="gallerieProfil" class="gallerie album">
<?php while($resultAlb = $requeteAlb->fetch())
{
$titrealbum = $resultAlb['titre_album'];
$idalbum = $resultAlb['id_album'];
$requeteAlbPho = $bdd3->query("SELECT * FROM albumphoto WHERE email=\"$mailSes\" AND id_album=\"$idalbum\"");
$resultAlbPho = $requeteAlbPho->fetch();
$tmpphoto = $resultAlbPho['idphoto'];
$requeteAlbPhoMaster = $bdd3->query("SELECT * FROM photos WHERE idphoto=\"$tmpphoto\"");
$resultAlbPhoMaster = $requeteAlbPhoMaster->fetch();
?>
<div class="contenualbum">
<div class="thumbnailalbum" >
<div class="thumno grey">
<a href="#" class="albumlight" data-rel="fca<?php echo $resultAlb['id_album'];?>">
<img src="<?php echo $resultAlbPhoMaster['path']; ?>" class="landscape albumMaster" alt="<?php echo $resultAlb['titre_album'];?>">
</a>
</div>
<div class="titlealbum">
<p><?php echo $titrealbum; ?></p>
</div>
</div>
<div class="galAlbum" id="fca<?php echo $resultAlb['id_album'];?>">
<?php
$requeteAlbPho2 = $bdd3->query("SELECT * FROM albumphoto WHERE id_album=\"$idalbum\"");
while($resultAlbPhoGal = $requeteAlbPho2->fetch()){
$tmpphotoGal = $resultAlbPhoGal['idphoto'];
$requeteAlbPhoMasterGal = $bdd3->query("SELECT * FROM photos WHERE idphoto=\"$tmpphotoGal\"");
$result2 = $requeteAlbPhoMasterGal->fetch();
?>
<div class="thumbnail">
<div class="thumno">
<a href="#" data-width="60%" data-rel="popup_img<?php echo $result2['idphoto']; ?>" class="poplight">
<img src="<?php echo $result2['path']; ?>" class="landscape" alt="<?php echo $result2['titre_photo']; ?>">
</a>
</div>
<div class="titlealbum">
<p class="soustitre"><?php echo $result2['titre_photo']; ?></p>
</div>
</div>
<?php
}
?>
</div>
</div>
<?php
}
?>
</div>
</div>
<?php
$requeteAlb2 = $bdd3->query("SELECT * FROM albums WHERE email=\"$mailSes\"");
?>
<div class="popup_img">
<?php
while($result = $requeteAlb2->fetch())
{
$tempid = $result['id_album'];
$requetePf = $bdd3->query("SELECT * FROM albumphoto WHERE email=\"$mailSes\" AND id_album=\"$tempid\"");
while($resultPf = $requetePf->fetch()){
$tmpphotopop = $resultPf['idphoto'];
$request= $bdd3->query("SELECT * FROM photos WHERE idphoto=\"$tmpphotopop\"");
$requestPf = $bdd3->query("SELECT * FROM profil WHERE email=\"$mailSes\"");
$resultPf = $requestPf->fetch();
$result3 = $request->fetch();
?>
<div id="popup_img<?php echo $result3['idphoto']; ?>" class="popup_block">
<img src="<?php echo $result3['path']; ?>" class="popup_image portrait" alt="Cedric Content">
<div class="exif" id="exif<?php echo $result3['idphoto'];?>">
<?php
if($exif = exif_read_data($result3['path'], 0, true)){
foreach ($exif as $key => $section) {
foreach ($section as $name => $val) {
echo "$key.$name: $val<br />\n";
}
}
} else {
echo "Exif info non disponible";
}
?>
<input type="button" class="adminsup closeExif" value="x">
</div>
<div class="comments" >
<input type="button" data-rel="exif<?php echo $result3['idphoto'];?>" class="bouton2 exifbut" value="Exif">
<a href="profil.php?email=<?php echo $result3['email'];?>" id="Xprofil" ><?php echo $resultPf['prenom']; ?> <?php echo $resultPf['nom']; ?> <?php echo $result3['commentaire']; ?>Lieu :<?php echo $result3['lieu']; ?> Date :
<?php echo $result3['date']; ?></a>
<form name="ajoutfav" action="profil.php?email=<?php echo $mailSes;?>" method="post">
<input type="text" name="photoid" value="<?php echo $result3['idphoto'];?>" required class="form inp2 photoid">
<input type="submit" class="bouton" id="like" value="<3" >
</form>
<form name="ajoutalbum" method="post" class="plplplpl">
<input type="text" name="photoalbid" value="<?php echo $result3['idphoto'];?>" required class="form inp2 photoid">
<div class="albumlisto" id="list<?php echo $result3['idphoto'];?>">
<label for="AlbumName"></label>
<select name="album" class="albumlist">
<?php
$requestListe = $bdd3->query("SELECT * FROM albums WHERE email=\"$mailSes2\"");
while($resultListe = $requestListe->fetch()){
echo '<option value="'. $resultListe['id_album'] . '">' . $resultListe['titre_album'] .'</option>';
}
?>
</select>
<input type="submit" class="bouton validerajoutalbum" id="validerajoutalbum<?php echo $result3['idphoto'];?>" value="valider">
<input type="button" class="bouton closeem" id="closeem<?php echo $result3['idphoto'];?>" value="x">
</div>
<input type="button" data-rel="list<?php echo $result3['idphoto'];?>" class="bouton ajoutalbum" value="+">
</form>
</div>
</div>
<?php
}
}
?>
</div>
<?php
}
?>
<hr id="menu" >
</body>
</html>