purchasegift.pl
Copying Source is Forbidden
47 lines of code
1
#!/usr/local/bin/perl
2
3
# must have's!
4
use strict;
5
use warnings;
6
use CGI::Carp qw(fatalsToBrowser);
7
use DBI;
8
use URI::Escape;
9
10
use lib "/var/www/html/Pm";
11
12
use Html qw(pre_html_header);
13
use Bc_chef qw(cookie_get);
14
use Bc_misc qw(get_param referrer);
15
use Bc_sql qw(sql_execute
16
get_constant
17
18
$DB
19
);
20
21
my $DEBUG = 0;
22
23
my $output = pre_html_header();
24
25
my $loggedin = Security::get_login($db);
26
my $gid = get_param("gid");
27
my $quantity = get_param("quantity");
28
my $referrer = referrer();
29
30
# check if loggedin exists
31
# check if gid exists
32
# if above fails
33
# redirect to REFERRER as error
34
# else
35
# if gid{expires} is in the past
36
# redirect to REFERRER as error
37
# else
38
# if user has enough coins
39
# subtract quantity x gid cost from user's coins
40
# add quantity of gid to user's giftbox
41
# and redirect to previewgift.pl?gid=$gid as notice
42
# else
43
# redirect to REFERRER as error
44
45
print $output;
46
47
exit 1;