Latest guestbook++
This commit is contained in:
parent
164258d02a
commit
e62fce85fd
|
@ -19,9 +19,8 @@ use WebService::Mattermost;
|
||||||
# Create CGI object (query)
|
# Create CGI object (query)
|
||||||
my $q = CGI->new();
|
my $q = CGI->new();
|
||||||
|
|
||||||
# Open banned phrases file
|
# Open banned phrases and users files
|
||||||
open(my $thoughtCrimes, '.msg.bans') or die "$@";
|
open(my $thoughtCrimes, '.msg.bans') or die "$@";
|
||||||
# Open banned users file
|
|
||||||
open(my $nameBans, '.name.bans') or die "$@";
|
open(my $nameBans, '.name.bans') or die "$@";
|
||||||
|
|
||||||
# Get creds file
|
# Get creds file
|
||||||
|
@ -127,9 +126,11 @@ sub params_in {
|
||||||
# Enforce max length for params
|
# Enforce max length for params
|
||||||
if (length($name) < 1 || (length($name) >= 40)) {
|
if (length($name) < 1 || (length($name) >= 40)) {
|
||||||
die "Name field must be between 1 and 40 characters\n"
|
die "Name field must be between 1 and 40 characters\n"
|
||||||
} elsif (length($location) < 1 || length($location) >= 40) {
|
}
|
||||||
|
elsif (length($location) < 1 || length($location) >= 40) {
|
||||||
die "Location field must be between 1 and 40 characters\n"
|
die "Location field must be between 1 and 40 characters\n"
|
||||||
} elsif (length($message) < 1 || length($message) >= 1900) {
|
}
|
||||||
|
elsif (length($message) < 1 || length($message) >= 1900) {
|
||||||
die "Message field must be between 1 and 1900 characters\n"
|
die "Message field must be between 1 and 1900 characters\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,6 +195,7 @@ print $q->header(-charset => 'UTF-8');
|
||||||
|
|
||||||
# Print the head & title, begin the body
|
# Print the head & title, begin the body
|
||||||
print $q->start_html(
|
print $q->start_html(
|
||||||
|
-dtd => 'html',
|
||||||
-title => 'SwaggNet Guestbook',
|
-title => 'SwaggNet Guestbook',
|
||||||
-style => '/css/swagg.css'
|
-style => '/css/swagg.css'
|
||||||
);
|
);
|
||||||
|
@ -207,7 +209,7 @@ print $q->div(
|
||||||
) . "\n";
|
) . "\n";
|
||||||
|
|
||||||
# Process returned params if present; else print form
|
# Process returned params if present; else print form
|
||||||
($q->param()) ? params_in() : form_out();
|
$q->param() ? params_in() : form_out();
|
||||||
|
|
||||||
# Print link to go back to homepage in footer
|
# Print link to go back to homepage in footer
|
||||||
print $q->div(
|
print $q->div(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user