newid.pl
54 lines of code
1
#!/usr/local/bin/perl
2
3
binmode(STDIN, ":utf8");
4
binmode(STDOUT, ":utf8");
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 header);
16
use Bc_chef qw(cookie_get);
17
use Bc_misc qw(get_param referrer new_id);
18
use Bc_sql qw(
19
              get_constant
20
              sql_execute
21
              user_exists
22
              $QUERY_PAGE
23
              $QUERY_UID
24
              $LOGGEDIN
25
26
              $DB
27
             );
28
29
use Security qw(banned);
30
use Redir qw(error_redir notice_redir);
31
32
my $DEBUG = 0;
33
34
my $output;
35
36
if (not user_exists($LOGGEDIN) or banned($LOGGEDIN)) {
37
  my $msg =  "Access Denied";
38
  if ($DEBUG) { $msg .= " (TEMPLATE.pl)"; }
39
  $output = error_redir("/", $msg);
40
} else {
41
  ############################################################
42
43
  ### YOUR CONTENT HERE
44
  my $numchars = get_param("l");
45
  if (not $numchars) { $numchars = 10; }
46
  $output = pre_html_header({type => "text/plain"});
47
  $output .= new_id($numchars, 1, 1, 1);
48
49
  ############################################################
50
}
51
52
print $output;
53
54
exit 1;