-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.php
More file actions
135 lines (132 loc) · 4.82 KB
/
admin.php
File metadata and controls
135 lines (132 loc) · 4.82 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
<DOCTYPE HTML>
<html>
<?php
require_once("connection.php");
if (!isset($_COOKIE['slogin'])) {
header('Location:login.php',true);
} else if ($_COOKIE['slogin'] != "admin" || $_COOKIE['slogin'] == "value") {
header('Location:login.php?admin=true',true);
}
?>
<head>
<title>Admin Console</title>
<head>
<div id="all">
<div id="container" style="max-width:800px;margin:1em auto 0;background-color:lightgrey;border-radius:15px;height:500px">
<p id="allottedtext">Allotted Stickers</p>
<div id="allottedstickers">
<?php
//here
if (!empty($_POST['submitstickers'])) {
$stmt = $db_stickers->prepare("UPDATE allottedstickers SET blackstickers = ?, greystickers = ?, whitestickers = ?");
$stmt->bind_param('iii', $_POST['blackAllotted'], $_POST['greyAllotted'], $_POST['whiteAllotted']);
$stmt->execute();
$stmt->close();
}
$stickersQuery = $db_stickers->query("SELECT * FROM allottedstickers LIMIT 1");
$stickersResult = $stickersQuery->fetch_array();
?><form name="stickerform" method="post">
<div class="rangecontent">
<div id="blackdiv" class="stickerdiv">Black Stickers</div><input type="range" id="black" class="ranged" name="blackAllotted" min="0" max="10" step="1" value="<?php echo $stickersResult['blackstickers'] ?>" oninput="updateTextInput(this.value, 'blackS');"><span class="label" id="blackS"><?php echo " " . $stickersResult['blackstickers'] ?></span><br /><br />
<div id="greydiv" class="stickerdiv">Grey Stickers</div> <input type="range" id="grey" class="ranged" name="greyAllotted" min="0" max="10" step="1" value="<?php echo $stickersResult['greystickers'] ?>" oninput="updateTextInput(this.value, 'greyS');"><span class="label" id="greyS"><?php echo $stickersResult['greystickers'] ?></span><br /><br />
<div id="whitediv" class="stickerdiv">White Stickers</div><input type="range" id="white" class="ranged" name="whiteAllotted" min="0" max="10" step="1" value="<?php echo $stickersResult['whitestickers'] ?>" oninput="updateTextInput(this.value, 'whiteS');"><span class="label" id="whiteS"><?php echo $stickersResult['whitestickers'] ?></span><br /><br />
<input type="submit" name="submitstickers" value="submit">
</div>
</form>
</div>
<p id="weighttext">Sticker Weight</p>
<div id="stickerweight">
<?php
//sticker weight
if (!empty($_POST['submitweight'])) {
$stmt = $db_stickers->prepare("UPDATE stickerweight SET blackvalue = ?, greyvalue= ?, whitevalue = ?");
$stmt->bind_param('ddd', $_POST['blackWeight'], $_POST['greyWeight'], $_POST['whiteWeight']);
$stmt->execute();
$stmt->close();
}
$weightQuery = $db_stickers->query("SELECT * FROM stickerweight LIMIT 1");
$weightResult = $weightQuery->fetch_array();
?><form name="weightform" method="post">
<div class="rangecontent">
<div id="blackdivW" class="stickerdiv">Black Stickers</div><input type="range" id="black" class="ranged" name="blackWeight" min="0" max="15" step=".5" value="<?php echo $weightResult['blackvalue'] ?>" oninput="updateTextInput(this.value, 'blackW');"><span id="blackW" class="label"><?php echo " " . $weightResult['blackvalue'] ?></span><br /><br />
<div id="greydivW" class="stickerdiv">Grey Stickers</div> <input type="range" id="grey" class="ranged" name="greyWeight" min="0" max="15" step=".5" value="<?php echo $weightResult['greyvalue'] ?>" oninput="updateTextInput(this.value, 'greyW');"><span id="greyW" class="label"><?php echo $weightResult['greyvalue'] ?></span><br /><br />
<div id="whitedivW" class="stickerdiv">White Stickers</div><input type="range" id="white" class="ranged" name="whiteWeight" min="0" max="15" step=".5" value="<?php echo $weightResult['whitevalue'] ?>" oninput="updateTextInput(this.value, 'whiteW');"><span id="whiteW" class="label"><?php echo $weightResult['whitevalue'] ?></span><br /><br />
<input type="submit" name="submitweight" value="submit">
</div>
</form>
</div>
</div>
</div>
</html>
<script>
function updateTextInput(val, span) {
document.getElementById(span).innerHTML = val;
}
</script>
<style>
* {
font-family:sans-serif;
}
#allottedtext {
}
#weighttext {
}
#stickerweight {
height:25%;
width:45%;
float:left;
margin:20px;
background-color:#A5A5A5
}
#allottedstickers {
width:45%;
height:25%;
float:left;
margin:20px;
background-color:#A5A5A5;
}
.ranged {
float:right;
}
.label {
margin-left:5%;
font-weight:bold;
text-align:center;
}
.stickerdiv {
height:20px;
width:110px;
text-align:center;
border-radius:5px;
display:inline-block;
}
#blackdiv {
background-color:black;
color:white;
}
#blackdivW {
background-color:black;
color:white;
}
#greydiv {
background-color:grey;
color:white;
}
#greydivW {
background-color:grey;
color:white;
}
#whitediv {
background-color:white;
color:black;
border: 1px solid;
}
#whitedivW {
background-color:white;
color:black;
border: 1px solid;
}
.rangecontent {
margin: 3%;
}
</style>