-
Notifications
You must be signed in to change notification settings - Fork 3
/
pp_protx.php
89 lines (69 loc) · 2.75 KB
/
pp_protx.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
<?php
#################################################################
## MyPHPAuction v6.04 ##
##-------------------------------------------------------------##
## Copyright ©2009 MyPHPAuction. All rights reserved. ##
##-------------------------------------------------------------##
#################################################################
session_start();
define ('IN_SITE', 1);
include_once ('includes/global.php');
include_once ('includes/class_fees.php');
(string) $active_pg = 'Protx';
(string) $error_output = null;
$pg_enabled = $db->get_sql_field("SELECT checked FROM " . DB_PREFIX . "payment_gateways WHERE
name='" . $active_pg . "' LIMIT 0,1", "checked");
if (!$pg_enabled) { die(GMSG_NOT_AUTHORIZED); }
function get_var($name, $default = 'none')
{
return (isset($_GET[$name])) ? $_GET[$name] : ((isset($_POST[$name])) ? $_POST[$name] : $default);
}
$protx_amount = 0;
$protx_crypt = $_GET['crypt'];
$protx_plain = '';
list($custom, $fee_table) = explode('TBL',get_var('item_id'));
if ($fee_table == 100) /* the tables for direct payment */
{## MyPHPAuction 2009 get the direct payment ikobo username/password
}
else
{
$protx_username = $setts['pg_protx_username'];
$protx_password = $setts['pg_protx_password'];
}
$protx_status = 'ERROR';## MyPHPAuction 2009 decode protx crypt
$protx_crypt = base64_decode($protx_crypt);
$key_values = array();
for ($i = 0; $i < strlen($protx_password); $i++)
{
$key_values[$i] = ord(substr($protx_password, $i, 1));
}
for ($i = 0; $i < strlen($protx_crypt); $i++)
{
$protx_plain .= chr(ord(substr($protx_crypt, $i, 1)) ^ ($key_values[$i % strlen($protx_password)]));
}
$protx_plain = $protx_plain . '&';## MyPHPAuction 2009 get payment amount and status
if (preg_match('/Amount=([^&]+)&/si', $protx_plain, $matches)) $protx_amount = $matches[1];
if (preg_match('/Status=([^&]+)&/si', $protx_plain, $matches)) $protx_status = $matches[1];
if (preg_match('/Currency=([^&]+)&/si', $protx_plain, $matches)) $protx_currency = $matches[1];
if (preg_match('/VPSTxId=([^&]+)&/si', $protx_plain, $matches)) $protx_txnid = $matches[1];
if (preg_match('/VendorTxCode=([^&-]+)TBL([^&-]+)TBL([^&-]+)&/si', $protx_plain, $matches))
{
$custom = $matches[1];
$fee_table = $matches[2];
}
$payment_gross = $protx_amount;
$payment_currency = $protx_currency;
$txn_id = $protx_txnid;
if ($custom != '' && $protx_status == 'OK')
{
$process_fee = new fees();
$process_fee->setts = &$setts;
$process_fee->callback_process($custom, $fee_table, $active_pg, $payment_gross, $txn_id, $payment_currency);
$redirect_url = SITE_PATH . 'payment_completed.php';
}
else
{
$redirect_url = SITE_PATH . 'payment_failed.php';
}
header_redirect($redirect_url);
?>