-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfunctions.php
More file actions
31 lines (26 loc) · 770 Bytes
/
Copy pathfunctions.php
File metadata and controls
31 lines (26 loc) · 770 Bytes
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
<?php
error_reporting(-1);
require './luhn-creator.php';
define('PAYSTACK_TEST_SECRET_KEY', 'sk_test_xxxxx');
define('PAYSTACK_LIVE_SECRET_KEY', 'sk_live_xxxxx');
function getIp()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
function getUnusedCode()
{
// to generate our random string code
$newcode = createLuhnCheckedRandomString(10);
// while the new string exists, get a new code
while (file_exists('results/' . $newcode . '-response.json')) {
$newcode = createLuhnCheckedRandomString(10);
}
return $newcode;
}