#! /usr/bin/perl #This file password protects the chat room, using board accounts. require '/var/www/vhosts/uhnd.com/httpdocs/board/cookie.pl'; $valid_passwords = "members"; $basedir = "/var/www/vhosts/uhnd.com/httpdocs/board"; $errormsg = ''; # Verify that the user's login information is correct. If it is, # set cookie. Otherwise, bring login screen back up. # Verify login info. if ($ENV{QUERY_STRING} eq 'login') { ReadParse(*FORM); if (!defined $FORM{'username'} || !defined $FORM{'password'}) { $errormsg = '

Login failed!

'; &login; } if (!(-e "$basedir/$valid_passwords/$FORM{'username'}")) { $errormsg = '

Login failed!

'; &login; } open(FILE, "$basedir/$valid_passwords/$FORM{'username'}") or &login; $password = ; chomp $password; if($FORM{'password'} eq "$password") { $validation = "$FORM{'username'}" . '&' . "$FORM{'password'}"; &set_cookie('validation', $validation, '', '/', 'www.uhnd.com'); &set_cookie('validation', $validation, '', '/', 'uhnd.com'); &load_chat; } else { $errormsg = '

Login failed!

'; &login; } } #START HERE. When the chat page loads, check if a cookie exists. If not, bring up login screen. if (&get_cookie('validation') ne '') { @validation = split(/&/, &get_cookie('validation')); if (!(-e "$basedir/$valid_passwords/$validation[0]")) { &login; } else { &load_chat; } } else { &login; } #Subroutine to load chat room sub load_chat { print "Content-type: text/html\n\n"; print <<'ENCODING';

The chat room is always open, and now available to board members only.  

We no longer organize chats, but you may post on the football board to gather other members. Or try checking in on gamedays.  Use the "float" button to maximize the room.   More instructions below.

Sorry, but your browser is not Java enabled, and you will not be able to chat

To enter the chat room, enter a username and click "Ok, connect". The other fields are optional.

Once inside the chat, you can ignore a user by highlighting their username (on the left), and then clicking the "ignore" box.  Highlighting a username and then clicking "Private Chat" will allow you to chat separately with anyone else in the room (similar to an instant message). 

For more available user commands see the parachat FAQ page.

Email questions to: Contacts

ENCODING exit; } #subroutine to load login screen sub login { print "Content-type: text/html\n\n"; print $errormsg; print <<'ENCODING';

The UHND.com Chat Room

Please login using your member information at this time:

Username:
Password:

Contacts

ENCODING exit; } #Error message would go here. sub trojan_error { print "Content-type: text/html\n\n"; print "hello3"; exit; } #parse form sub ReadParse { local (*in) = @_ if @_; local ($i, $key, $val); if ( $ENV{'REQUEST_METHOD'} eq "GET" ) { $in = $ENV{'QUERY_STRING'}; } elsif ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN,$in,$ENV{'CONTENT_LENGTH'}); } else { $in = ( grep( !/^-/, @ARGV )) [0]; $in =~ s/\\&/&/g; } @in = split(/&/,$in); foreach $i (0 .. $#in) { # Convert plus's to spaces $in[$i] =~ s/\+/ /g; # Split into key and value. ($key, $val) = split(/=/,$in[$i],2); # splits on the first =. # Convert %XX from hex numbers to alphanumeric $key =~ s/%(..)/pack("c",hex($1))/ge; $val =~ s/%(..)/pack("c",hex($1))/ge; # Associate key and value. \0 is the multiple separator $in{$key} .= "\0" if (defined($in{$key})); $in{$key} .= $val; } return length($in); }