-
Notifications
You must be signed in to change notification settings - Fork 0
/
senior.php
146 lines (127 loc) · 5.38 KB
/
senior.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
<?php
session_start();
if (!isset($_SESSION['admin']) && !isset($_SESSION['user'])) {
header("Location: index.php");
exit;
}
if (isset($_SESSION['admin'])) {
header("Location: adminPanel/dashboard.php");
exit;
}
require_once "components/db_connect.php";
require_once "components/file_upload.php";
$res = mysqli_query($connect, "SELECT * FROM user WHERE id=" . $_SESSION['user']);
$rowUser = mysqli_fetch_array($res, MYSQLI_ASSOC);
$str = "SELECT * FROM `animal` WHERE `age` > 8";
$result = mysqli_query($connect, $str);
$card = '';
if (mysqli_num_rows($result) > 0) {
$colortd = '';
$rows = mysqli_fetch_all($result, MYSQLI_ASSOC);
foreach ($rows as $row) {
if ($row['status'] == 1) {
$row['status'] = 'Available';
$colortd = "green";
} else {
$row['status'] = 'Adopted';
$colortd = "red";
}
$card .= "
<div class='card mt-3 mx-3' style='width: 18rem;'>
<img src='pictures/{$row['picture']}' class='card-img-top imgTop' alt='...'>
<div class='card-body'>
<h5 class='card-title'>Name: {$row['name']}</h5>
<p class='card-text'>Breed: {$row['breed']} </p>
<p class='card-text'>Age: {$row['age']} </p>
</div>
<div class='card-footer text-center'>
<p class='card-text' style='color:$colortd;'> {$row['status']} </p>
<a href='details.php?id={$row['id']}' role='button' class='btn btn-warning'>more...</a>
</div>
</div>
";
};
} else {
$card = "<tr><td colspan='5'><center>No Data Available </center></td></tr>";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Senior</title>
<?php include_once "components/boot.php"; ?>
<link rel="stylesheet" href="components/css/style.css">
<style>
.userImage {
width: 3rem;
height: 3rem;
}
.hero {
background: rgb(2, 0, 36);
background: linear-gradient(24deg, rgba(2, 0, 36, 1) 0%, rgba(0, 212, 255, 1) 100%);
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg" style="background-color: #C1A3A3;">
<div class="container-fluid">
<a class="navbar-brand txtFont">Adopt a Pet</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="home.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="senior.php">Senior</a>
</li>
<li class="nav-item">
<a class="nav-link" href="login.php"></a>
</li>
</ul>
</div>
<div class="collapse navbar-collapse justify-content-end ps-5" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link rightLogin">Hi, <?= $rowUser['first_name']; ?></a>
</li>
<li class="nav-item">
<a class="nav-link rightLogin"><?= $rowUser['email']; ?></a>
</li>
<li class="nav-item">
<img class="img-thumbnail userImage" src="pictures/<?=$rowUser['picture'];?>" >
</li>
<li class="nav-item">
<a class="nav-link rightLogin" href="logout.php?logout"><i class="bi bi-box-arrow-left"></i> Logout</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container">
<fieldset class="read">
<legend class='h2 text-center mt-3'>Senior</legend>
<div class="row row-cols-md-3">
<?= $card ?>
</div>
<footer class="d-flex flex-wrap justify-content-between align-items-center py-3 my-4 border-top">
<div class="col-md-4 d-flex align-items-center">
<i class="bi bi-book"></i>
<span class="mb-3 mb-md-0 text-muted">© PHP-Mysql Adop a Pet, CodeFactory</span>
</div>
<ul class="nav col-md-4 justify-content-end list-unstyled d-flex">
<li class="ms-3"><i class="bi bi-twitter"></i></li>
<li class="ms-3"><i class="bi bi-facebook"></i></li>
<li class="ms-3"><i class="bi bi-instagram"></i></li>
<li class="ms-3"><i class="bi bi-youtube"></i></li>
</ul>
</footer>
</div>
<?php require_once "components/bootjs.php"; ?>
</body>
</html>