checkpremium.pl
49 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_sql qw(sql_execute
14
              user_exists
15
              $QUERY_PAGE
16
              $QUERY_UID
17
              $LOGGEDIN
18
19
              $DB
20
             );
21
use Bc_chef qw(cookie_get);
22
use Redir qw(error_redir);
23
use Security qw(banned);
24
25
my $rv = 0;
26
27
my $DEBUG = 0;
28
if (not user_exists($LOGGEDIN) or banned($LOGGEDIN)) {
29
  my $msg =  "Access Denied";
30
  if ($DEBUG) { $msg .= " (checkpremium.pl)"; }
31
  print error_redir("/", $msg);
32
33
  exit 1;
34
}
35
36
if ($DB) {
37
  my $sql = "select subscriber from users where ID=" . $DB->quote($LOGGEDIN);
38
39
  my $result = sql_execute($sql, "checkpremium.pl");
40
  if (ref $result eq "HASH") {
41
    if ($result->{subscriber} eq 2) { $rv = 1; }
42
  }
43
}
44
45
print pre_html_header({type=>"text/plain"});
46
print $rv;
47
48
49
exit 1;