#!/usr/bin/perl =pod This file is originally intended to be a cgi program for writing online journals. Original author: Caro This is the second of two files to deal with online conferences. This one does the work of taking user data in and publishing it to the web in auto-refreshing pages =cut use English; use Fcntl ':flock'; # import LOCK_* constants require "cgi-lib.pl"; $ret=&ReadParse; # Get username and textarea value $user = $in{user}; $speaker = $in{speaker}; $userinput = $in{userinput}; # Call the subroutine to print the tops of cgi screens: &printHeader; # If no user name dump them unless(defined($user)) { print "

Sorry, you have no user name! Please log in. "; exit; } # get the kick list and check it open(KICKED, ") {$kicked{$name} = 1;} close(KICKED); if (exists $kicked{$user}) { print "

You have been kicked out of the conference. "; exit; } # now we need to append the user text, if it exists $userinput =~ s/^\s+//; # drop leading and trailing whitespace $userinput =~ s/\s+$//; if (length($userinput)) { if (defined($speaker)) { $archivefile = "../onlinecon/speaker.html"; } else { $archivefile = "../onlinecon/user.html"; } &updateArchive; } &printEntryPage; ## Subroutine Definitions ########################### sub printHeader { ## Print header: print "Content-Type: text/html\n\n"; print " Enlightenment Talk

"; } sub printEntryPage { =pod shows a happy page for user input =cut print "
Enlightenment Online Conference
\n \n "; if (defined($speaker)) { print ""; } } sub updateArchive { my $count = 1; while(!open(ARCHIVE,">>$archivefile")) { sleep(1); # sleep one second and try again if ($count > 5) { print "Sorry--things are so busy I couldn't send that!

Please hit BACK on your browser and try again"; exit; } $count = $count + 1; } flock(ARCHIVE,LOCK_EX); #lock the archive seek(ARCHIVE, 0, 2); #seek end in case modified after open before lock # append our stuff to the archive print ARCHIVE "


$user: $userinput"; flock(ARCHIVE,LOCK_UN); close(ARCHIVE); }