-
Notifications
You must be signed in to change notification settings - Fork 0
/
_category.php
101 lines (101 loc) · 2.8 KB
/
_category.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
<?
$sql="SELECT id,name,tag,icon FROM categories WHERE tag=:tag LIMIT 1";
try
{
$q=$GLOBALS['dbh']->prepare($sql);
$q->bindParam(':tag',$_GET["tag"], PDO::PARAM_STR);
$q->execute();
if ($q->rowCount()>0||$_GET["tag"]=="all")
{
$row=$q->fetch(PDO::FETCH_ASSOC);
title(($row["name"]?$row["name"]:"All Collections"));
$sql="SELECT * FROM `collections` WHERE (JSON_EXTRACT(metadata, '$.category')=:category".($_GET["tag"]=="all"?" OR 1=1":"").") AND network_id=:network_id";
$q=$GLOBALS['dbh']->prepare($sql);
$q->bindParam(':category',$_GET["tag"], PDO::PARAM_STR);
$q->bindParam(':network_id',$GLOBALS['network_id'], PDO::PARAM_STR);
$q->execute();
?>
<div class="bg-dark text-white">
<div class="container">
<div class="p-1 bg-dark">
<div class="container-fluid py-0">
<div class="row">
<div class="col-md-12">
<h4 class="display-5 fw-bold"><i class="<?=($row["icon"]?$row["icon"]:"fas fa-list")?>"></i> <?=($row["name"]?$row["name"]:"All Collections")?></h4>
<p class="text-secondary"><?=$q->rowCount()?> Collection</p>
</div>
</div>
<div class="row">
<?
if ($q->rowCount()>0)
{
while ($row=$q->fetch(PDO::FETCH_ASSOC))
{
$metadata=json_decode($row["metadata"]);
?>
<div class="col-md-3 mt-3 mb-3 text-secondary">
<div class="card bg-black text-secondary">
<?
if ($metadata->attributes->thumbnail_url)
{
?>
<img src="<?=ipfs_to_url($metadata->attributes->thumbnail_url)?>" class="card-img-top" alt="<?=$metadata->name?>">
<?
}
else
{
?>
<center>
<i class="fas fa-image fa-9x text-secondary" style="height: 40vh"></i>
</center>
<?
}
?>
<div class="card-body">
<h5 class="card-title">
<?=$metadata->name?>
</h5>
<p><?=$metadata->description?></p>
<!--<p class="card-text">Max Supply : <?=$row["supply"]?></p>!-->
<a href="collection/<?=$row["token_id"]?>" class="btn btn-outline-secondary stretched-link"><i class="fa-solid fa-eye"></i> VIEW</a>
</div>
</div>
</div>
<?
}
}
else
{
?>
<p class="col-md-8 fs-4">No collection found in this category</p>
<?
}
?>
</div>
</div>
</div>
</div>
</div>
<?
}
else
{
?>
<div class="bg-dark text-secondary">
<div class="container">
<div class="p-1 bg-dark">
<div class="container-fluid py-5">
<h1 class="display-5 fw-bold">Not Found</h1>
<p class="col-md-8 fs-4">Category not found</p>
</div>
</div>
</div>
</div>
<?
}
}
catch (PDOException $e)
{
echo $e->getMessage();
}
?>