TEMPLATE_ADMIN.pl
92 lines of code
1
#!/usr/local/bin/perl
2
3
($<,$>) = (getpwnam('nobody'), getpwnam('nobody')) or die $!;
4
5
binmode(STDIN, ":utf8");
6
binmode(STDOUT, ":utf8");
7
8
# must have's!
9
use strict;
10
use warnings;
11
use CGI::Carp qw(fatalsToBrowser);
12
use DBI;
13
use URI::Escape;
14
15
use lib "/var/www/html/Pm";
16
17
use Html qw(pre_html_header header html_end debug_banner);
18
use Html2 qw(tag br hr);
19
use Bc_chef qw(cookie_get);
20
use Bc_misc qw(get_param referrer get_params_asHash);
21
use Bc_sql qw(sql_execute
22
              get_constant
23
              user_exists
24
              $QUERY_PAGE
25
              $QUERY_UID
26
              $LOGGEDIN
27
28
              $DB
29
             );
30
use Redir qw(notice_redir error_redir);
31
use User qw(isUserAdmin $USER_DATA);
32
use Security qw(banned); Security::count_hits();
33
34
#######################################
35
# add your own USE statements here
36
37
# end of your USE statements
38
#######################################
39
40
my $DEBUG = 1;
41
my $DEBUG_STR = "";
42
43
my %params = get_params_asHash();
44
45
my $output;
46
47
if (not user_exists($LOGGEDIN) or banned($LOGGEDIN) or not isUserAdmin($LOGGEDIN)) {
48
  my $msg =  "Access Denied";
49
  if ($DEBUG) { $msg .= " (TEMPLATE_ADMIN.pl)"; }
50
  $output = error_redir("/", $msg);
51
} else {
52
  ############################################################
53
  ### YOUR CONTENT HERE
54
  $output = pre_html_header();
55
  $output .= header(
56
                   "TEMPLATE_ADMIN",
57
                   "?nobg_img=1&nogrid=1",
58
                   0,
59
                   "setTimeout(removeMsg, " . get_constant("REMOVE_MSG_TIMEOUT") . ");",
60
                   "",
61
                   "style=\"padding: 2px;\""
62
                  );
63
64
  if ($DEBUG) {
65
    if (keys %params) {
66
      foreach my $key (sort keys %params) {
67
        $params{$key} =~ s/^ *//;
68
        $params{$key} =~ s/ *$//;
69
        $DEBUG_STR .= "$key = $params{$key}" . br;
70
      }
71
    } else {
72
      { my %str;
73
        $str{tag} = "div";
74
        $str{class} = "red-panel";
75
        $str{innerHTML} = "No Params Given!";
76
77
        $DEBUG_STR .= tag(\%str);
78
      }
79
      $DEBUG_STR .= br;
80
    }
81
82
    $output .= debug_banner("TEMPLATE ADMIN", $DEBUG_STR, 1);
83
  }
84
85
  ### END YOUR CONTENT
86
  $output .= html_end();
87
  ############################################################
88
}
89
90
print $output;
91
92
exit 1;