-
Notifications
You must be signed in to change notification settings - Fork 0
/
mycharacters.php
247 lines (193 loc) · 7.14 KB
/
mycharacters.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
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
<?php
session_start();
if(isset($_GET['logout'])) {
session_destroy();
unset($_SESSION['username']);
header("location: index.php");
}
?>
<!doctype html>
<html>
<head>
<title>Monkehh's DM Tools</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<link href="dmtools.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php include "page-header.php"; ?>
<div class="container-flex" style="padding-left: 1rem;">
<div class="row">
<div class="col-md-12">
<h1>My Characters</h1>
</div>
</div>
<div class="row">
<div class="col-md-12">
<?php
$changes = array();
include "changes.php";
include "db_connect.php";
if (!empty($_SESSION['user_id'])) { ?>
<?php
$userid = $_SESSION['user_id'];
$sql = "SELECT * FROM `characters` WHERE `User` LIKE $userid";
$result = $mysqli->query($sql);
$character = "";
if ($result->num_rows > 0) {
?>
</div>
</div>
<div class="row">
<div id="characters-table" class="col-md-6 col-xs-12">
<table class="table table-striped custab">
<thead>
<tr>
<th style="width: 25%;">Name</th>
<th style="width: 10%;">Level</th>
<th style="width: 15%">Race</th>
<th style="width: 25%">Class/Subclass</th>
<th style="width: 20%;">Campaign</th>
<!-- <th class="width:40%;">Action</th>-->
</tr>
</thead>
<?php
// output data of each row
while($row = $result->fetch_assoc()) {
unset($charactersubclass);
$charactername = $row['Character Name'];
$characterrace = $row['Character Race'];
$characterclass = $row['Character Class'];
$characterid = $row['character_id'];
$campaign = $row['campaign'];
$level = $row['Character Level'];
$charactersubrace = $row['Character Subrace'];
$charactersubclass = $row['Character Subclass'];
$sql = "SELECT `name` FROM `classes` WHERE `id`LIKE $characterclass";
$result1 = $mysqli->query($sql);
$row1 = $result1->fetch_assoc();
$classname = $row1['name'];
$sql = "SELECT `name` FROM `races` WHERE `race-id`LIKE $characterrace";
$result1 = $mysqli->query($sql);
$row1 = $result1->fetch_assoc();
$racename = $row1['name'];
$sql = "SELECT `campaign_name` FROM `campaigns` WHERE `campaign_id`LIKE $campaign";
$result1 = $mysqli->query($sql);
$row1 = $result1->fetch_assoc();
$campaignname = $row1['campaign_name'];
if (!empty($charactersubrace)): {
$sql = "SELECT `name` FROM `subraces` WHERE `id`LIKE $charactersubrace";
$result1 = $mysqli->query($sql);
$row1 = $result1->fetch_assoc();
$racename = $row1['name'];
unset($charactersubrace);
} endif;
if (!empty($charactersubclass)): {
$sql = "SELECT `name` FROM `subclasses` WHERE `id`LIKE $charactersubclass";
$result1 = $mysqli->query($sql);
$row1 = $result1->fetch_assoc();
$subclassname = $row1['name'];
unset($charactersubclass);
} endif;
?>
<tr>
<td> <a
<?php echo 'href=character.php?id='.$characterid;
?>
?>
<?php echo $charactername; ?>
</a>
</td>
<td><?php echo $level;?></td>
<td><?php echo $racename; ?></td>
<td>
<?php echo $classname;
if (!empty($subclassname)) :{
echo "/" . $subclassname;
unset($subclassname);
}
endif;
?>
</td>
<td><?php echo $campaignname; ?></td>
<!--
<td class="text-center">
<a class="btn btn-success btn-xs"><span class="glyphicon glyphicon-edit"></span>View</a>
<a class="btn btn-info btn-xs"><span class="glyphicon glyphicon-remove"></span>Edit</a>
<a class="btn btn-danger btn-xs" href=""><span class="glyphicon glyphicon-remove"></span>Delete</a>
</td>
-->
</tr>
<!--
echo
'<a href="myretainers.php?id='.$retainer_id.'&name=' .
$row['Retainer-Name'] . "&type=" . $type . "&retainerlevel=" . $row['Retainer-Level'] . '">' . $row['Retainer-Name'] . "</a></br>";
-->
<?php
}
?>
</table>
</div>
<?php
}
}
else {
?>
<h5>You must be logged in to view your saved retainers.</h5>
<?php
}
?>
<div class="col-md-8 col-xs-12" style="padding-top: 10px;">
<?php
if (isset($_GET["type"])) : {
include "retainercardgenerator.php";
}
elseif (isset($_GET['add_retainer'])): {
include "retainer_creation_form.php";
}
?>
<!--
<div class="col-md-10">
<div class="container">
<div class="row">
<div class="col-md-2"></div>
<div class="npc-top-block">
<div class="npc-name">
Test 1
</div>
<div class="npc-type">
Test Type
</div>
<div class="npc-level">
Test Level
</div>
</div>
</div>
<div class="row">
<div class ="npc-ability-block">
Test
</div>
</div>
</div>
</div>
-->
<?php
elseif (isset($_GET['edit_retainer'])): {
// echo "<h1>Add New Retainer</h1>";
include "edit_retainer_form.php";
}
endif;
?>
</div>
</div>
</div>
</body>
</html>