forked from Znote/ZnoteAAC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buypoints.php
127 lines (113 loc) · 5.09 KB
/
buypoints.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
<?php require_once 'engine/init.php';
protect_page();
include 'layout/overall/header.php';
// Import from config:
$paypal = $config['paypal'];
$prices = $config['paypal_prices'];
if ($paypal['enabled']) {
?>
<h1>Buy Points</h1>
<h2>Buy points using Paypal:</h2>
<table id="buypointsTable" class="table table-striped table-hover">
<tr class="yellow">
<th>Price:</th>
<th>Points:</th>
<?php if ($paypal['showBonus']) { ?>
<th>Bonus:</th>
<?php } ?>
<th>Action:</th>
</tr>
<?php
foreach ($prices as $price => $points) {
echo '<tr class="special">';
echo '<td>'. $price .'('. $paypal['currency'] .')</td>';
echo '<td>'. $points .'</td>';
if ($paypal['showBonus']) echo '<td>'. calculate_discount(($paypal['points_per_currency'] * $price), $points) .' bonus</td>';
?>
<td>
<form action="https://www.paypal.com/cgi-bin/webscr" method="POST">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="<?php echo $paypal['email']; ?>">
<input type="hidden" name="item_name" value="<?php echo $points .' shop points on '. $config['site_title']; ?>">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="amount" value="<?php echo $price; ?>">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="<?php echo $paypal['currency']; ?>">
<input type="hidden" name="lc" value="GB">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="hidden" name="return" value="<?php echo $paypal['success']; ?>">
<input type="hidden" name="cancel_return" value="<?php echo $paypal['failed']; ?>">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="notify_url" value="<?php echo $paypal['ipn']; ?>" />
<input type="hidden" name="custom" value="<?php echo (int)$_SESSION['user_id']; ?>">
<input type="submit" value=" PURCHASE ">
</form>
</td>
<?php
echo '</tr>';
}
?>
</table>
<?php } ?>
<?php
if ($config['pagseguro']['enabled'] == true) {
// Import from config:
$pagseguro = $config['pagseguro'];
$psprices = $config['pagseguro_prices'];
?>
<h2>Buy points using Pague Seguro:</h2>
<table id="buypointsTable" class="table table-striped table-hover">
<tr class="yellow">
<th>Price:</th>
<th>Points:</th>
<?php if ($pagseguro['showBonus']) { ?>
<th>Bonus:</th>
<?php } ?>
<th>Action:</th>
</tr>
<?php
foreach ($psprices as $psprice => $pspoints) {
echo '<tr class="special">';
echo '<td>'. $psprice .'('. $paypal['currency'] .')</td>';
echo '<td>'. $pspoints .'</td>';
if ($pagseguro['showBonus']) echo '<td>'. calculate_discount(($pagseguro['points_per_currency'] * $psprice), $pspoints) .' bonus</td>';
?>
<td>
<form target="pagseguro" method="post" action="https://pagseguro.uol.com.br/v2/checkout/payment.html">
<input type="hidden" name="receiverEmail" value="<?php echo $pagseguro['email']; ?>">
<input type="hidden" name="currency" value="<?php echo $pagseguro['currency']; ?>">
<input type="hidden" name="reference" value="<?php echo (int)$_SESSION['user_id']; ?>">
<input type="hidden" name="itemId1" value="1">
<input type="hidden" name="itemAmount1" value="<?php echo $psprice; ?>.00">
<input type="hidden" name="itemQuantity1" value="1">
<input type="hidden" name="itemDescription1" value="<?php echo $pspoints .' shop points on '. $config['site_title'] .' in account '. (int)$_SESSION['user_id'];?>">
<input alt="Pague com PagSeguro" name="submit" type="image" src="https://p.simg.uol.com.br/out/pagseguro/i/botoes/pagamentos/205x30-pagar-preto.gif"/>
</form>
</td>
<?php
echo '</tr>';
}
?>
</table>
<?php } ?>
<?php
if ($config['paygol']['enabled'] == true) {
?>
<!-- PayGol Form using Post method -->
<h2>Buy points using Paygol:</h2>
<?php $paygol = $config['paygol']; ?>
<p><?php echo $paygol['price'] ." ". $paygol['currency'] ."~ for ". $paygol['points'] ." points:"; ?></p>
<form name="pg_frm" method="post" action="http://www.paygol.com/micropayment/paynow" >
<input type="hidden" name="pg_serviceid" value="<?php echo $paygol['serviceID']; ?>">
<input type="hidden" name="pg_currency" value="<?php echo $paygol['currency']; ?>">
<input type="hidden" name="pg_name" value="<?php echo $paygol['name']; ?>">
<input type="hidden" name="pg_custom" value="<?php echo $session_user_id; ?>">
<input type="hidden" name="pg_price" value="<?php echo $paygol['price']; ?>">
<input type="hidden" name="pg_return_url" value="<?php echo $paygol['returnURL']; ?>">
<input type="hidden" name="pg_cancel_url" value="<?php echo $paygol['cancelURL']; ?>">
<input type="image" name="pg_button" src="http://www.paygol.com/micropayment/img/buttons/150/black_en_pbm.png" border="0" alt="Make payments with PayGol: the easiest way!" title="Make payments with PayGol: the easiest way!">
</form>
<?php }
if (!$config['paypal']['enabled'] && !$config['pagseguro']['enabled'] && !$config['paygol']['enabled']) echo '<h1>Buy Points system disabled.</h1><p>Sorry, this functionality is disabled.</p>';
include 'layout/overall/footer.php'; ?>