This repository was archived by the owner on Feb 8, 2022. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathgalbums.php
More file actions
96 lines (90 loc) · 3.13 KB
/
Copy pathgalbums.php
File metadata and controls
96 lines (90 loc) · 3.13 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
<?
session_start();
include('exec/dbconnect.php');
include('exec/check_user.php');
include('exec/header.php');
include('exec/leftmenu.php');
include 'exec/datefn.php';
if ($_GET['id'] != '') {
$id = $_GET['id'];
}else{
echo 'error ID';
exit();
}
if ($_GET['id'] == '0') {
echo "error ID";
exit();
}
if($_GET['sort_by'] == "date1"){
$qs = $dbh1->prepare("SELECT * FROM galbums WHERE `aid` = '".$id."'");
}elseif($_GET['sort_by'] == "date2"){
$qs = $dbh1->prepare("SELECT * FROM galbums WHERE `aid` = '".$id."' ORDER BY id DESC");
}elseif(empty($_GET['sort_by']) || $_GET['sort_by'] == "random"){
$qs = $dbh1->prepare("SELECT * FROM galbums WHERE `aid` = '".$id."' ORDER BY RAND()");
}
$qs->execute();
$userr = $dbh1->prepare("SELECT * FROM club WHERE id = '".$id."'");
$userr->execute();
$userrr = $userr->fetch();
?>
<div id="content-infoname"><b><?php echo '<a href="club'.$userrr['id'].'">'.$userrr['name'].'</a>' ?> » Альбомы</b><?php if($_SESSION['id'] == $userrr['authorid']){?><text style="font-size: 8pt; color: #aaa; float: right;"><a href="galbum_add.php?id=<?php echo $id;?>">Создать альбом</a></text><?php } ?></div>
<br>
<?php
$qalbumscount = $dbh1->prepare("SELECT COUNT(1) FROM galbums WHERE `aid` = '".$id."'");
$qalbumscount -> execute();
$albcount = $qalbumscount->fetch();
$albcount = $albcount[0];
if ($albcount == '1') {
$albcouunt = (string)$albcount." альбом";
}elseif ($albcount == '2' OR $albcount == '3' OR $albcount == '4') {
$albcouunt = (string)$albcount." альбома";
}else{
$albcouunt = (string)$albcount." альбомов";
}
echo '<b>'.$albcouunt.'</b><br>';?>
<div id="content-main-gray">
<?php
while($alb = $qs->fetch()){
$qg = $dbh1->prepare("SELECT * FROM galbums WHERE `id` = '".$alb['id']."'");
$qg->execute();
$album = $qg->fetch();
$qphotocount = $dbh1->prepare("SELECT COUNT(1) FROM photo WHERE `galbum` = '".$album['id']."'");
$qphotocount -> execute();
$phocount = $qphotocount->fetch();
$phocount = $phocount[0];
if ($phocount == '1') {
$photocouunt = (string)$phocount." фотография";
}elseif ($phocount == '2' OR $phocount == '3' OR $phocount == '4') {
$photocouunt = (string)$phocount." фотографии";
}else{
$photocouunt = (string)$phocount." фотографий";
}
$qphoto = $dbh1->prepare("SELECT * FROM photo WHERE `galbum` = '".$album['id']."' ORDER BY id LIMIT 1");
$qphoto->execute();
$photo = $qphoto->fetch();
if ($phocount == "0") {
$photoalbum = "img/nophoto.jpg";
}else{
$photoalbum = $photo['image'];
}
echo '<div id="content-main-gray-content">
<table border="0" style="font-size: 11px;">
<tbody>
<tr>
<td width="200" style="vertical-align: top;">
<img src="avatar.php?image='.$photoalbum.'">
</td>
<td style="vertical-align: 0;">
<div id="content-main-gray-content-info"><a href="album-'.$album['id'].'"><h4><b>'.$album['name'].'</b></h4></a><span><br>'.$photocouunt.'<br>Создан '.zmdate($album['date']).'</span><br>'.$album['note'].'</div>
</td>
</tr>
</tbody>
</table>
</div>';
}
?>
</div>
</div>
<? include ('exec/footer.php'); ?>
</body>
</html>