-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmystuffview.php
More file actions
66 lines (66 loc) · 2.58 KB
/
Copy pathmystuffview.php
File metadata and controls
66 lines (66 loc) · 2.58 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
<?php
require "includes/header.php";
$userid = $_SESSION['userid'];
// CONNECT TO DATABASE
include 'includes/library.php';
$pdo = connectdb();
// QUERY FOR SHEET INFO
$query = "SELECT * FROM signin_info where userid = ?";
$stmt=$pdo->prepare($query);
$results = $stmt->execute([$userid]);
$sheets = $stmt->fetchAll();
// QUERY FOR SLOT INFO
$username = $_SESSION['username'];
$query = "SELECT * FROM slot_info where user = ?";
$stmt=$pdo->prepare($query);
$results = $stmt->execute([$username]);
$slots = $stmt->fetchAll();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php $page_title = "My stuff view"; ?>
<?php include "includes/metadata.php" ?>
</head>
<body class="mystuff">
<section>
<h2>My Sign-Up Sheets</h2>
<?php if($sheets==null):?>
<p>You have not made any signup sheets</p>
<?php endif ?>
<?php foreach($sheets as $r): ?>
<div class="inforows">
<div class="sbox">
<div>
<p>Title: <?php echo "$r[title]"; ?></p>
<p>Total slots: <?php echo "$r[numofslots]"; ?></p>
<p>Number of people signed up: <?php echo "$r[numofpeoplesignedup]"; ?></p>
</div>
<div>
<a href="viewsheet.php?sheetid=<?php echo $r['sheetid']; ?>"><img src="images/view.png" alt="view sheet" title="view"></a>
<a href="editsheet.php?sheetid=<?php echo $r['sheetid']; ?>"><img src="images/edit.png" alt="edit sheet" title="edit sheet"></a>
<a href="deletesheet.php?sheetid=<?php echo $r['sheetid']; ?>"><img src="images/delete.png" alt="delete sheet" title="delete sheet"></a>
</div>
</div>
</div>
<?php endforeach ?>
<h2>My Signed-Up Slots</h2>
<?php if($slots==null):?><p>You have not signed up in any slots</p><?php endif ?>
<?php foreach($slots as $r): ?>
<div class="inforows">
<div class="sbox">
<div>
<p>Title: <?php echo "$r[title]"; ?></p>
<p>Date and time: <?php echo "$r[timeslot]"; ?></p>
</div>
<div>
<a href="slotview.php?slotid=<?php echo $r['slotid']; ?>"><img src="images/view.png" alt="view details" title="view details"></a> <!--DO THIS!! -->
<a href="cancelslot.php?slotid=<?php echo $r['slotid']; ?>"><img src="images/delete.png" alt="cancel slot" title="cancel slot"></a>
</div>
</div>
</div>
<?php endforeach ?>
</section>
<?php include "includes/footer.php" ?>
</body>
</html>