forked from SecareLupus/fc_pos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspendcredits.php
73 lines (61 loc) · 2.42 KB
/
spendcredits.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
<?php
// spendcredits.php
// This is the app with which member spend credits, including renewing membership.
// POST
// renew - for renewing membership
// values: any integer - renew membership for that many months. If insufficent credits, renews as many as possible
// if no previous wExp, then starts from today. If wExp, renews from then unless wExp is more than
// 60 days previous
// Versions
// 1.0 Allows members to renew membership
include('funcs.inc');
include('credits.inc');
include('friendcomputer.inc');
include('header.php');
$cxn = open_stream();
$SID = $_SESSION['ID'];
// determine current number of credits
$credits = getCreditTotal($SID);
if(isset($_POST))
{
extract($_POST);
// renew working membership
if($renew > 0)
{
// reduce number of months if necessary
$creditCost = $renew * $WORKINGMEMBERCREDITS;
if($creditCost > $credits)
{
$renew = $credits / $WORKINGMEMBERCREDITS;
$renew = floor($renew);
$reduction = true; // a flag so we know it was changed
}
if($renew > 0)
{
renewMembership($SID, $renew);
if($reduction == true)
{
$message .= "Due to lack of credits, Friend Computer has reduced the number of months you will renew for.<br>";
}
if($renew == 1)
$message .= "Membership renewed for one month.<p>";
else
$message .= "Membership renewed for $renew months.<p>";
}
else
{
$message .= "You lack sufficient credits to renew membership.<p>";
}
} // end renewing membership
} // end using POST
fcMessage($message);
$credits = getCreditTotal($SID);
echo "You currently have $credits Credits in your account<p>";
displayMembershipStatus($SID);
echo "<font size=+1>Spend Credits with Friend Computer</font><br>
<form action='spendcredits.php' method='post'>
Renew Membership for <input type='text' name='renew' size=3 maxlength=3> months for 15 Credits per month.<p>
<input type='submit' name='submit' value='submit'>
<input type='submit' name='submit' value='dominate'></form><p>";
include('footer.php');
?>