forked from SecareLupus/fc_pos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuturepacks.php
136 lines (119 loc) · 4.21 KB
/
futurepacks.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
<?php
/**
* @file futurepacks.php
* @brief futurepacks.php is a page for making use of future packs on members' accounts.
*
* This file includes:
* funcs.inc:
* - Used for the config.inc include
* - adjustPacksOnAcct()
* - convertPacksToStoreCredit()
* - selectMember()
* - printMember()
* - getAccountPacks()
* - printMemberString()
*
* Possible Arguments:
* SESSION:
* - eve - Used to determine whether the current user has inventory
* privledges.
* - adm - Used to determine whether the current user has admin
* privledges.
* - reg - Used to determine whether the current user has register
* privledges.
* - ID - Current user's member ID. Used to display the current
* user's Future Packs.
*
* POST:
* - submit - When this variable is filled, we need to do work. The three
* values this variable can have are 'Add Packs', 'Remove Packs',
* and 'Convert Packs'.
* - target - This is the member ID of the member whose packs we are modifying.
* - qty - This is the number of packs we are modifying.
* - notes - This is a place to put an explanation for the modification.
* - selMem - This string is used to pull up a member's info, but not to
* modify their account.
*
* @link http://www.worldsapartgames.org/fc/futurepacks.php @endlink
*
* @author Michael Whitehouse
* @author Creidieki Crouch
* @author Desmond Duval
* @copyright 2009-2014 Pioneer Valley Gaming Collective
* @version 1.8d
* @since Project has existed since time immemorial.
*/
$title = "Future Packs";
$version = "1.8d";
require_once 'funcs.inc';
require_once 'header.php';
$cxn = open_stream();
echo"<hr>";
if (isset($_POST['submit'])) {
extract($_POST);
if ($_POST['submit'] == 'Add Packs') {
adjustPacksOnAcct(
$_POST['target'], $qty,
htmlspecialchars($_POST['notes'], ENT_QUOTES)
);
}
if ($_POST['submit'] == 'Remove Packs') {
adjustPacksOnAcct(
$_POST['target'], ($qty * -1),
htmlspecialchars($_POST['notes'], ENT_QUOTES)
);
}
if ($_POST['submit'] == 'Convert Packs') {
convertPacksToStoreCredit($_POST['target'], $qty);
}
}
if ($_SESSION['eve'] == 1 || $_SESSION['adm'] == 1 || $_SESSION['reg'] == 1) {
echo "<h3>Select Member</h3>
<form method='post'>";
selectMember('selMem', 0);
echo "<input type='submit' name='update' value='Get Member Info'></form>";
}
if ($_POST['update'] == 'Get Member Info') {
extract($_POST);
printMember($selMem, 1);
$numpacks = getAccountPacks($selMem);
echo "<br>Current packs: " . $numpacks . "<br>";
echo "<form method='post'>";
echo "<input type='hidden' name='update' value='Get Member Info'>
<input type='hidden' name='selMem' value='$selMem'>
<input type='hidden' name='target' value='$selMem'>";
echo "Quantity of Packs:<input type='text' name='qty'><br>";
echo "Why Adding/Removing?:<input type='text' name='notes'><br>";
if ($_SESSION['eve'] == 1 || $_SESSION['adm'] == 1) {
echo "<input type='submit' name='submit' value='Add Packs'>";
}
echo "<input type='submit' name='submit' value='Remove Packs'>
<input type='submit' name='submit' value='Convert Packs'><br>
</form>";
}
echo "<h3>Your Future Packs</h3>";
$numpacks = getAccountPacks($_SESSION['ID']);
echo "You currently have " . $numpacks . " future packs on account.<br>
What would you like to do with them?<br><br>";
echo "<form method='post'>
<input type='hidden' name='target' value='" . $_SESSION['ID'] . "'>";
echo "Qty:<input type='text' name='qty'><br>
<input type='submit' name='submit' value='Convert Packs'><br>
</form>";
if ($_SESSION['adm'] == 1) {
echo "<hr><h3>Future Packs Report</h3>";
$sql = "SELECT memberID, SUM( qty ) FROM futurepacks GROUP BY memberID "
. "ORDER BY SUM( qty ) DESC";
$result = query($cxn, $sql);
echo "<table><tr><th width=250>Name</th><th width=100>Packs</th></tr>";
while ($row = mysqli_fetch_row($result)) {
if ($row[1] <= 0) {
break;
}
echo "<tr><td>" . printMemberString($row[0], 1)
. "</td><td align='center'>" . $row[1] . "</td></tr>";
}
echo "</table>";
}
require 'footer.php';
?>