checkcoins.pl
Copying Source is Forbidden
49 lines of code
1
#!/usr/local/bin/perl
2
3
# this script will return 0 if the server is undergoing maintenence
4
# and 1 when the server is live
5
6
# must have's!
7
use strict;
8
use warnings;
9
use CGI::Carp qw(fatalsToBrowser);
10
use DBI;
11
use URI::Escape;
12
13
use lib "/var/www/html/Pm";
14
15
use Html qw(pre_html_header);
16
use Html2 qw(tag br hr embolden italicize);
17
use Bc_sql qw(sql_execute
18
user_exists
19
$QUERY_PAGE
20
$QUERY_UID
21
$LOGGEDIN
22
23
$DB
24
);
25
use Bc_chef qw(cookie_get);
26
use Redir qw(error_redir);
27
28
my $DEBUG = 0;
29
30
if (not user_exists($LOGGEDIN) or Security::banned($LOGGEDIN)) {
31
my $msg = "Access Denied";
32
if ($DEBUG) { $msg .= " (checkcoins.pl)"; }
33
print error_redir("/", $msg);
34
35
exit 1;
36
}
37
38
my $sql = "select points from coins where ID=" . $DB->quote($LOGGEDIN);
39
my $rv = 0; # assume the user has no coins
40
41
if ($DB) {
42
my $result = sql_execute($sql, "checkcoins.pl");
43
if (ref $result eq "HASH") { $rv = $result->{points}; }
44
}
45
46
print pre_html_header({type=>"text/plain"});
47
print $rv;
48
49
exit 1;