Skip to content

Commit be46b7f

Browse files
committed
Merge branch 'master' of [email protected]:labitat/labipay
2 parents 436e18b + 738ed9f commit be46b7f

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

terminal.pl

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/usr/bin/perl -Tw
2+
3+
use strict;
4+
use warnings;
5+
6+
use lib '.';
7+
8+
use Labipay::Funcs;
9+
10+
use CGI;
11+
use JSON;
12+
13+
my $q = new CGI;
14+
my $dbh = db_connect();
15+
my $response = {};
16+
17+
18+
19+
20+
21+
print "Content-Type: application/json\n\n";
22+
my $json = new JSON;
23+
print $json->encode($response);
24+
25+
exit;
26+
27+
28+
29+
30+
sub error {
31+
my $response = shift || {};
32+
my $status = shift || 'error';
33+
34+
35+
36+
37+
}
38+
39+
40+
sub add_checksum {
41+
my $response = shift;
42+
my $fields = shift;
43+
my $secret = shift;
44+
45+
my $string = $response->{seed} = seed();
46+
foreach my $field (@$fields) {
47+
$string .= $response->{$field};
48+
}
49+
$string .= $secret;
50+
51+
$response->{checksum} = $string;
52+
53+
return $string;
54+
55+
}
56+
57+
58+
sub seed {
59+
60+
my $length = 10;
61+
my $seed = '';
62+
for (my $i = 0; $i < $length; $i++) {
63+
$seed .= 'g';
64+
}
65+
66+
67+
return $seed;
68+
}

0 commit comments

Comments
 (0)