-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpets.php
More file actions
181 lines (134 loc) · 5.78 KB
/
pets.php
File metadata and controls
181 lines (134 loc) · 5.78 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
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
<?php
//need this to connect to database.
include('connetDB.php');
//need this to continue session.
session_start();
//checks to see if the user has signed.
if(!isset($_SESSION['user_id']) || !isset($_SESSION['logged_in']) || $_SESSION['type'] != "admin"){
//will send user back to sign-in.
header('location:adminSign.php');
exit;
}
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Pets</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<link rel="stylesheet" href="assets/css/main.css" />
</head>
<body class="landing is-preload">
<div id="page-wrapper">
<!-- Header -->
<header id="header" class="alt">
<h1><a href="welcome.php">Apartment Portal</a> Pets</h1>
<nav id="nav">
<ul>
<li><a href="homePage.php">Home</a></li>
<li><a href="logout.php" class="button">Logout</a></li>
</ul>
</nav>
</header>
<!-- Banner -->
<section id="banner">
<h2>Admin - Pets</h2>
<p>Pets in Complex</p>
</section>
<section id="main" class="container">
<section class="box special">
<header class="major">
<h2>Current Pets</h2><br />
<p>
<?php
$q = 'Select pets.petId, pets.petName, pets.breed, pets.active, rentPets.renterUser FROM pets join rentPets on rentPets.petId = pets.petId';
$statement = $conn->prepare($q);
//bind the values to the statement.
$statement->bindValue(1,$q,PDO::PARAM_STR);
//executes the sql statement.
$statement->execute();
$row2 = $statement->fetchAll();
if($row2 != null){
echo "<table>
<tr>
<th><center>petId</center></th>
<th><center>PetName</center></th>
<th><center>Breed</center></th>
<th><center>Active</center></th>
<th><center>renterUser</center></th>
</tr>";
foreach($row2 as $r){
echo "<tr>";
echo "<td>" .$r['petId'] ."</td>";
echo "<td>" .$r['petName'] ."</td>";
echo "<td>" .$r['breed'] ."</td>";
echo "<td>" .$r['active'] ."</td>";
echo "<td>" .$r['renterUser']."</td>";
echo "</tr>";
}
echo "</table>";
}
?>
<div><br>
<input type="submit" name="tb" value="Remove Pet" onclick="return foo();" />
</div>
<script>
function foo(){
alert("click click bitch");
return true;
}
</script>
<span class="image featured"><img src="images/pet.jpg" alt="" / height = "250" width = "200">
</p>
</header>
</span>
</section>
<!-- CTA -->
<section id="cta">
<h2>Add Pets</h2>
<form action="pet.php" method="POST">
<div class="col-8 col-12-mobilep">
<input type="text" name="petId" placeholder="Pet Id" /required>
</div><br>
<div class="col-8 col-12-mobilep">
<input type="text" name="renterUser" placeholder="Renter UserName" /required>
</div><br>
<div class="col-8 col-12-mobilep">
<input type="text" name="petName" placeholder="Pet Name" /required>
</div><br>
<div class="col-8 col-12-mobilep">
<input type="text" name="breed" placeholder="Breed" / required>
</div><br>
<div class="col-8 col-12-mobilep">
<input type="text" name="active" placeholder="t/f" required/>
</div>
<div class="col-4 col-12-mobilep"><br>
<input type="submit" name="sb" value="Add Pet" class="fit" />
</div>
</form>
</section>
<!-- Footer -->
<footer id="footer">
<ul class="icons">
<li><a href="#" class="icon brands fa-twitter"><span class="label">Twitter</span></a></li>
<li><a href="#" class="icon brands fa-facebook-f"><span class="label">Facebook</span></a></li>
<li><a href="#" class="icon brands fa-instagram"><span class="label">Instagram</span></a></li>
<li><a href="#" class="icon brands fa-github"><span class="label">Github</span></a></li>
<li><a href="#" class="icon brands fa-dribbble"><span class="label">Dribbble</span></a></li>
<li><a href="#" class="icon brands fa-google-plus"><span class="label">Google+</span></a></li>
</ul>
<ul class="copyright">
<li>© Untitled. All rights reserved.</li><li>Design: <a href="http://html5up.net">HTML5 UP</a></li>
</ul>
</footer>
</div>
<!-- Scripts -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/jquery.dropotron.min.js"></script>
<script src="assets/js/jquery.scrollex.min.js"></script>
<script src="assets/js/browser.min.js"></script>
<script src="assets/js/breakpoints.min.js"></script>
<script src="assets/js/util.js"></script>
<script src="assets/js/main.js"></script>
</body>
</html>