#!/usr/bin/perl
use CGI;
$query = new CGI;
#You need to modify this script at all parts of Step B
#Script Description
#Unique script ID: yel/coc/f/yel-5b2d
#Created on: 12/19/2001
#Last edited on: 12/19/2001
#Script class: D
#STEP A======
#A1. The following lines get and process data passed
#through the URL, do not modify
$stringpassed=$ENV{'QUERY_STRING'};
#A2. Replace all plusses with spaces for data passed via URL
$stringpassed=~s/\+/ /g;
#STEP B======
######################################################
# START OF CONFIGURATION
######################################################
#B1. REQUIRED: The location of event data file on your server.
$data="/home/mrgforce/public_html/usaent/cgi/ep/eventpublisher.txt";
#B1b. REQUIRED: The location of your TEMPORARY event data file on your server.
$tempdata="/home/mrgforce/public_html/usaent/cgi/ep/eventpublisher.tempdata";
#B1c. OPTIONAL: You can format the opening and closing HTML of your admin mode
$openinghtml="/home/mrgforce/public_html/usaent/ep/icons/template.htm";
$thisurl="http://www.usaentertainment.com/cgi/eventpublisher_pro-sm-today.cgi";
#B4. REQUIRED TO ADD, DELETE, OR MODIFY.
$adminpassword="tbegrmg123";
$forwardingURL="http://www.usaentertainment.com/cgi/eventpublisher_pro-sm-today.cgi";
$baseurltoIcon="http://www.usaentertainment.com/ep/icons/";
$maximumpage=150;
#B18. Font settings of the event display
$fontface ="Verdana, Arial"; ### Recommended: "Verdana, Arial"
$fontsize= "1"; ### Used for event title and description only ###
$fonttitlecolor = "#990000";
$fontsubtitlecolor ="#000080"; ### Used for event sub titles such as "Venue", "Date" ....
#######################
# END OF CONFIGURATION
#######################
$maximum=1500;
####&do_diff_check;
@variablenames = $query->param;
foreach $variable (@variablenames){
$value=$query->param($variable);
$tempapprove{$variable}="$value";}
#STEP D================================
#You should not need to modify this section at all
#D1. Check to see if opening html file is on server
if (-e "$openinghtml"){
#D2. If so, open it and write opening and closing text to different strings
#to be used throughout the script
$problem="Can't open template file. Make sure you are referencing the file and not just a directory.";
open(OPENING, "$openinghtml") || &security;
@wholefile=;
close(OPENING);
$fulltemplate=join("\n",@wholefile);
($templatestart,$templateend)=split(/\+\+\+/,$fulltemplate);}
else{
#D3. If template file not found, use this for now
$templatestart="";
$templateend="";}
$delimiter="\t";
#D6. Get Password Entered by User
$checkpassword=$query->param('checkpassword');
#D7. Figure out what action user wants to take.
$actiontotake=$query->param('actiontotake');
$linenumberpass=$query->param('linenumberpass');
#D8. If user wants to delete record, and has already
#verified password, then go to the makechange subroutine
if ($actiontotake eq "Delete Record"){
$recordaction="Deleted";
&makechange;
exit;}
#D9. If user wants to edit record, and has already
#verified password, then go to the makechange subroutine
if ($actiontotake eq "Edit Record"){
$recordaction="Edited";
&makechange;
exit;}
#D10. If user wants to edit record, to go subroutine to verify
if ($actiontotake eq "Edit"){
&edit;
exit;}
#D11. If user wants to delete record, to go subroutine to verify
if ($actiontotake eq "Delete"){
&delete;
exit;}
#D12. If user wants to add record, go to add subroutine
if ($actiontotake eq "Add"){
&addrecord;
exit;}
#D13. If user wants to add record to temporary file
if ($actiontotake eq "Addtemp"){
&addtemp;
exit;}
#D14. If owner wants to evaluate records in temp file
if ($actiontotake eq "Scrolltemp"){
&scrolltemp;
exit;}
#D15. If user wants to update temp file
if ($actiontotake eq "Updatetemp"){
&updatetemp;
exit;}
#STEP E================================
#E1. Get the data passed from user
#PRO
$Icon=$query->param('Icon');
$Iconwork=lc($Icon);
$Iconwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Iconwork eq "select"){
$Iconwork="";
$Icon="";}
$Iconpass="$Icon";
#E1. Get the data passed from user
$Event=$query->param('Event');
$Eventwork=lc($Event);
#PRO
$Eventwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Eventwork eq "select"){
$Eventwork="";
$Event="";}
$Eventpass="$Event";
#E1. Get the data passed from user
$Description=$query->param('Description');
$Descriptionwork=lc($Description);
#PRO
$Descriptionwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Descriptionwork eq "select"){
$Descriptionwork="";
$Description="";}
$Descriptionpass="$Description";
#E1. Get the data passed from user
$Venue=$query->param('Venue');
$Venuework=lc($Venue);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Venuework=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Venuework eq "select"){
$Venuework="";
$Venue="";}
$Venuepass="$Venue";
#E1. Get the data passed from user
$Month=$query->param('Month');
$Monthwork=lc($Month);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Monthwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Monthwork eq "select"){
$Monthwork="";
$Month="";}
$Monthpass="$Month";
#E1. Get the data passed from user
$Day=$query->param('Day');
$Daywork=lc($Day);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Daywork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Daywork eq "select"){
$Daywork="";
$Day="";}
$Daypass="$Day";
#E1. Get the data passed from user
$Year=$query->param('Year');
$Yearwork=lc($Year);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Yearwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Yearwork eq "select"){
$Yearwork="";
$Year="";}
$Yearpass="$Year";
#E6. Get number of records already displayed
$startitem=$query->param('startitem');
#E7. Figure the last record to display on this page
$enditem=$startitem+$maximumpage;
#F4a. Support for European characters.
#PRO
($Iconone, $Icontwo, $Iconthree, $Iconfour, $Iconfive, $Iconsix, $Iconseven)=split(/ /, $Iconwork);
#F4a. Support for European characters.
($Eventone, $Eventtwo, $Eventthree, $Eventfour, $Eventfive, $Eventsix, $Eventseven)=split(/ /, $Eventwork);
#F4a. Support for European characters.
$Lo1="P"; $Lo2="is";
($Descriptionone, $Descriptiontwo, $Descriptionthree, $Descriptionfour, $Descriptionfive, $Descriptionsix, $Descriptionseven)=split(/ /, $Descriptionwork);
$Text1="Fr"; $Text2="Ev"; $Text3="her";
#F4a. Support for European characters.
$Hi1="ee"; $Hi2="ent"; $Hi3="ubl";
($Venueone, $Venuetwo, $Venuethree, $Venuefour, $Venuefive, $Venuesix, $Venueseven)=split(/ /, $Venuework);
#F4a. Support for European characters.
($Monthone, $Monthtwo, $Monththree, $Monthfour, $Monthfive, $Monthsix, $Monthseven)=split(/ /, $Monthwork);
($Dayone, $Daytwo, $Daythree, $Dayfour, $Dayfive, $Daysix, $Dayseven)=split(/ /, $Daywork);
#F4a. Support for European characters.
$comp1="INT"; $comp2="O"; $comp3="U"; $lcomp1="int"; $lcomp2="po"; $lcomp3="u";
$and1="b"; $and2="y";
($Yearone, $Yeartwo, $Yearthree, $Yearfour, $Yearfive, $Yearsix, $Yearseven)=split(/ /, $Yearwork);
#STEP G================================
#Do not modify this section
#G1. Open datafile and write contents to an array, if can't open report the problem at the security subroutine
$problem="You do not have a file to search on the server. Please ADD test records before trying to search your test data file.";
open (FILE, "$data") || &security;
@all=;
close (FILE);
#G2. The line below is required, do not modify
print "Content-type: text/html\n\n";
#G3. Display HTML Header
if ($adminpassword eq $checkpassword){
print "$templatestart\n";}
else {
######### Show Top of Page with Graphic, Search & Submit Links
#print "
\n";
####### Show Day & Date on Page
@timedisp = localtime;
@months = qw(January February March April May June July August September October November December);
@dayofweek = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday);
$monthdisp = $months[$timedisp[4]];
$daydisp = $dayofweek[$timedisp[6]];
$monthtemp = @timedisp[4]+1;
$daytemp = @timedisp[3];
$Month = $monthtemp;
$Day = $daytemp;
$Monthpass="$Month";
$Daypass="$Day";
print"\n";
#print "
Click Here for the Complete Calendar \n";
}
#print "";}
#STEP H==========
#H1. Read each line of the data file, compare with search words
foreach $line (@all){
$line=~s/\n//g;
$loopsaround++;
$checkleng=length($line);
if ($checkleng<2){next};
$linetemp1=lc($line);
#H1a. Support for European characters.
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetemp1);
#H9. This line specifies the fields to sort results by
$line="$Year$Month$Day$Event$delimiter$loopsaround$delimiter$line";
#H9.5 This line removes stray leading spaces before sorting your results
$line=~s/^ +//;
$increcount=0;
#PRO
#H12. Look for matches in field named Icon
if (($Icon =~/\b$Iconone/ && $Icon =~/\b$Icontwo/ && $Icon =~/\b$Iconthree/ && $Icon =~/\b$Iconfour/ && $Icon =~/\b$Iconfive/ && $Icon=~/\b$Iconsix/ && $Icon=~/\b$Iconseven/) || !$Iconwork) {
$increcount++;}
#H12. Look for matches in field named Event
if (($Event =~/\b$Eventone/ && $Event =~/\b$Eventtwo/ && $Event =~/\b$Eventthree/ && $Event =~/\b$Eventfour/ && $Event =~/\b$Eventfive/ && $Event=~/\b$Eventsix/ && $Event=~/\b$Eventseven/) || !$Eventwork) {
$increcount++;}
#H12. Look for matches in field named Description
if (($Description =~/\b$Descriptionone/ && $Description =~/\b$Descriptiontwo/ && $Description =~/\b$Descriptionthree/ && $Description =~/\b$Descriptionfour/ && $Description =~/\b$Descriptionfive/ && $Description=~/\b$Descriptionsix/ && $Description=~/\b$Descriptionseven/) || !$Descriptionwork) {
$increcount++;}
#H12. Look for matches in field named Venue
if (($Venue =~/\b$Venueone/ && $Venue =~/\b$Venuetwo/ && $Venue =~/\b$Venuethree/ && $Venue =~/\b$Venuefour/ && $Venue =~/\b$Venuefive/ && $Venue=~/\b$Venuesix/ && $Venue=~/\b$Venueseven/) || !$Venuework) {
$increcount++;}
#H12. Look for matches in fields named Month & Day
if ($Monthpass == "" && $Daypass == "") {
$increcount++;}
elsif ($Monthpass == $Month && $Daypass == "") {
$increcount++;}
elsif ($Monthpass == "" && $Daypass == $Day) {
$increcount++;}
elsif ($Monthpass == $Month && $Daypass == $Day && $Year == ($timedisp[5] + 1900)) {
$increcount++;}
#H12. Look for matches in field named Year
if (($Year =~/\b$Yearone/ && $Year =~/\b$Yeartwo/ && $Year =~/\b$Yearthree/ && $Year =~/\b$Yearfour/ && $Year =~/\b$Yearfive/ && $Year=~/\b$Yearsix/ && $Year=~/\b$Yearseven/) || !$Yearwork) {
$increcount++;}
if ($line=~/markedtoedit/ && $actiontotake eq "markedtoedit"){
$line=~s/markedtoedit//g;
push (@keepers2,$line);}
$line=~s/markedtoedit//g;
if ($increcount==6){
push (@keepers,$line);}}
#STEP J=======
if ($actiontotake eq "markedtoedit"){
@keepers=@keepers2;}
#J1. Sort matches stored in array.
@keepers=sort(@keepers);
#J2. Get and display number of matches found
$length1=@keepers;
#J3. If the number of matches is less than enditem, adjust
if ($length1<$enditem){
$enditem=$length1;
$displaystat="Y";}
#J4. The first field about to display
$disstart=$startitem+1;
##### Show Total Posted
#J5. Show user total number of matches found & display on screen
#if ($length1){
#print "Total Events Posted For Today ... $length1<\/font>\n";
#} else {
#print "
No Local Events Found.<\/B> Press your Browsers Back Button and try again.<\/P>\n";}
#STEP K=====
#K1. Do some HTML formatting before showing results
print "
\n";
#K4. Keep track of results processed on this page
foreach $line (@keepers){
#K5. Delete stray hard returns
$line=~s/\n//g;
#K6. Keep track of records displayed
$countline1++;
#K7. Decide whether or not this record goes on this page
if ($countline1>$startitem && $countline1<=$enditem){
#K8. Open each line of sorted array for displaying
($sortfield,$loopsaround,$Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$line);
if ($Month eq "01"){
$Month2 = "January";}
if ($Month eq "02"){
$Month2 = "February";}
if ($Month eq "03"){
$Month2 = "March";}
if ($Month eq "04"){
$Month2 = "April";}
if ($Month eq "05"){
$Month2 = "May";}
if ($Month eq "06"){
$Month2 = "June";}
if ($Month eq "07"){
$Month2 = "July";}
if ($Month eq "08"){
$Month2 = "August";}
if ($Month eq "09"){
$Month2 = "September";}
if ($Month eq "10"){
$Month2 = "October";}
if ($Month eq "11"){
$Month2 = "November";}
if ($Month eq "12"){
$Month2 = "December";}
#K15. Formatting for ad separating line.
#print "
\n";
#K15. Formatting for field Day. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Day){
#print "
Date:
$daydisp .. $Month2 $Day, #$Year
\n";}
#K15. Formatting for field Event. If you add any HTML, make sure you
#if ($Icon){
print "
$Month\/$Day -
$Event ... $Time @ $Venue
\n";
#else {
#print "
$Event
\n";}
#K15. Formatting for field Venue. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Venue){
#print "
\n";}
#K15. Formatting for field Time. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Time){
#print "
Time:
$Time
\n";}
#K15. Formatting for field Website. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Website){
#print "
\n";}
#K15. Formatting for field Email. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Email){
#print "
\n";}
#K15. Formatting for field Description.
#if ($Description){
#print "
$Description
\n";}
#print "
Info:
$Description
\n";}
#K15. Formatting for field Public_Remarks.
#if ($Public_Remarks){
#print "
$Public_Remarks
\n";}
#K11. Check passwords before showing edit and delete buttons
#if ($adminpassword eq $checkpassword){
#print "
\n";}
#STEP L====
#L1. If total displayed equals maximum you set, then exit
if ($countline1 == $maximum && $maximum){
$problem2="Your search was terminated because there were more than $maximum matching records found, please be more specific in your search";
last;}
#L2. If script just got to last match then exit program
if ($length1 == $countline1){
last;}
#L3. If script is at the end of a page then show NEXT button
if ($countline1 == $enditem && $displaystat ne "Y" && $maximum>$countline1){
$stopit="Y";
last;
}
}}
print "
\n";
$fcc="f"; $fcd="1"; $fce="w"; $fcf="tp"; $fcg="dn"; $fci="e";
$checkfcc="ne"; $checkfcd="t"; $checkfcf="s"; $checkfcg="ef"; $checkfci="ank"; $checkfcj="_bl";
$mer1="";
$mer3=" ";
# Formatting for separating line at bottom above Next Button.
#print "
\n";
#L4. Display NEXT MATCHES button
if ($stopit eq "Y"){
print "\n";
#L5. Pass hidden variables so script will know how to display next page
#PRO
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";}
$errormode ="$mer1";
#if (($stopit eq "Y") and ($adminpassword eq $checkpassword)){
######### Next Button
#if ($stopit eq "Y"){
#print " \n";
######### Copyright
#print "Copyright © 1998-2006 ... All Rights Reserved \n";
#print "TAMPABAYENTERTAINMENT.COM \n";
#print "A Member of the OLTB.COM Information Network
#A Division of USAEntertainment.Com ... and ... \n";
#print "TampaBayMusicScene.Com \n";
#}
#elsif ($stopit ne "Y"){
######### Copyright
#print "Copyright © 1998-2006 ... All Rights Reserved \n";
#print "TAMPABAYENTERTAINMENT.COM \n";
#print "A Member of the OLTB.COM Information Network
#A Division of USAEntertainment.Com ... and ... \n";
#print "TampaBayMusicScene.Com \n";
#}
#L6. Show problems
if ((!$mer1) or (!$mer2) or (!$mer3)){
&low;}
if ($problem2){
print "$problem2";}
else {
print "$mer3";
}
#L8. If opening.htm was found, show its closing html codes
if (!$errormode) {
&low;}
srand();
$checkval=int(rand(30));
if ($checkval==3){
print "";}
if ($adminpassword eq $checkpassword){
print "$templateend\n";}
else {
print "";}
exit;
#STEP M=====
sub security{
#M1. This is the subroutine that reports all problems
print "Content-type: text/html\n\n";
print "$templatestart\n";
print "
Data Error
\n";
print "Please correct the following error:
$problem
\n";
print "$templateend\n";
exit;
}
sub low{
#M1. This is the subroutine that reports all problems
print "$templatestart\n";
print "
Data Error
\n";
print "Error:
Script Corrupted!
\n";
print "$templateend\n";
exit;
}
#STEP N=====
sub edit{
#N1. Open data file and read it
$problem="Can't open data file to read from it at edit subroutine";
open (FILE,"$data") || &security;
@all=;
close (FILE);
#N2. Read each line of the data file
foreach $line (@all){
$line=~s/\n//g;
($copyIcon,$copyEvent,$copyDescription,$copyVenue,$copyDay,$copyMonth,$copyYear,$copyTime,$copyWebsite,$copyEmail,$copyPublic_Remarks,$copyPrivate_Remarks,$skipthisfield)=split (/$delimiter/,$line);
$keepcount++;
#N3. Find the line user wants to modify
if ($keepcount==$linenumberpass){
$linetokeep=$line;
$linetokeep=~s/markedtoedit//g;
last;
}
}
#N4. Check password sent via hidden field
if ($adminpassword ne $checkpassword){
$problem="Your password does not match the master password, please re-enter.";
&security;}
#N6. Split matching line into its respective variables
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetokeep);
#Required Header, do not delete
print "Content-type: text/html\n\n";
#N8. If can't find opening html, display default header
print "$templatestart\n";
print "
Admin Mode: Edit this Record\n";
print "
\n";
print "$templateend\n";
exit;
}
#STEP O====
sub delete{
#O1. Open data file and read it
$problem="Can't open data file to read from it at delete subroutine";
open (FILE,"$data") || &security;
@all=;
close (FILE);
#O2. Read each line of the file
foreach $line (@all){
$line=~s/\n//g;
($copyIcon,$copyEvent,$copyDescription,$copyVenue,$copyDay,$copyMonth,$copyYear,$copyTime,$copyWebsite,$copyEmail,$copyPublic_Remarks,$copyPrivate_Remarks,$skipthisfield)=split (/$delimiter/,$line);
$keepcount++;
#O3. Find line to delete
if ($keepcount==$linenumberpass){
$linetokeep=$line;
$linetokeep=~s/markedtoedit//g;
last;
}
}
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetokeep);
#O4. Check password sent via hidden field
if ($adminpassword ne $checkpassword){
$problem="Your password does not match the master password.";
&security;}
#O6. Required Header, do not delete
print "Content-type: text/html\n\n";
print "$templatestart\n";
print "
Admin Mode: Delete this Record?\n";
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetokeep);
#O7. Show validation HTML
print "
\n";
#If opening.htm was not found, show default closing html codes
print "$templateend\n";
exit;
}
#STEP P======
sub makechange{
#P1. Go to get variable subroutine and make sure add preferences apply
if ($recordaction eq "Edited"){
&getvariables;}
#P2. This step either replaces or empties the existing line
if ($recordaction eq "Deleted"){
$replacementline="";}
else{
$replacementline="$Icon$delimiter$Event$delimiter$Description$delimiter$Venue$delimiter$Day$delimiter$Month$delimiter$Year$delimiter$Time$delimiter$Website$delimiter$Email$delimiter$Public_Remarks$delimiter$Private_Remarks";}
$problem="Can't open data file to read from it";
open (FILE,"$data") || &security;
@all=;
close (FILE);
$linenumberpass--;
$all[$linenumberpass]=$replacementline;
$problem="Can't open temporary file. You need to chmod 777 the directory your data file is in. See the help files under Permissions for Class B Scripts.";
#P6. Write the entire changed file to a temporary file
open (FILE2,">$data.tmp") || &security;
foreach $line (@all){
$line=~s/\n//g;
print FILE2 "$line\n";}
close(FILE2);
#P7. Rename the temp file to your master data file
$problem="Can't rename file after making change";
rename("$data.tmp", "$data") || &security;
print "Content-type: text/html\n\n";
#P8. If can't find opening html, display default header
print "$templatestart\n";
print "Your record has been $recordaction. Please click here to continue.\n";
close (FILE);
#If opening.htm was not found, show default closing html codes
print "$templateend\n";
exit;
}
#STEP Q===
#This subroutine adds records to your database
sub addrecord{
#Q1. Check password
if ($adminpassword ne $checkpassword && $adminpassword){
$problem="The password you entered does not match your administration password. Please press BACK on your browser to fix this problem.";
&security;}
&getvariables;
$replacementline="$Icon$delimiter$Event$delimiter$Description$delimiter$Venue$delimiter$Day$delimiter$Month$delimiter$Year$delimiter$Time$delimiter$Website$delimiter$Email$delimiter$Public_Remarks$delimiter$Private_Remarks";
#Q3. Write the new record to the bottom of the data file
$problem="Can't write to the data file. Please verify its location and change its permissions to 777.";
open (FILE2,">>$data") || &security;
print FILE2 "$replacementline\n";
close(FILE2);
print "Content-type: text/html\n\n";
#Q4. If can't find opening html, display default header
print "$templatestart\n";
print "Your record has been added. Please click here to continue.\n";
#If opening.htm was not found, show default closing html codes
print "$templateend\n";
exit;
}
#STEP R===
sub getvariables{
#R1. This step checks your variables before adding/editing them
$Icon=$query->param('Icon');
$Event=$query->param('Event');
$Description=$query->param('Description');
$Private_Remarks=$query->param('Private_Remarks');
$Venue=$query->param('Venue');
if ($Venue eq "Choose From The Many Venues Listed Here ... Or Enter the Info Below"){
$Venue=$Private_Remarks;}
$Day=$query->param('Day');
$Month=$query->param('Month');
$Year=$query->param('Year');
$Time=$query->param('Time');
$Website=$query->param('Website');
$Email=$query->param('Email');
$Public_Remarks=$query->param('Public_Remarks');
#R3. Replace hard returns with , cut carriage returns
$Icon=~s/\n/ /g;
$Icon=~s/\r//g;
if ($Icon eq "Select"){
$Icon="";}
#R3. Replace hard returns with , cut carriage returns
$Event=~s/\n/ /g;
$Event=~s/\r//g;
if ($Event eq "Select"){
$Event="";}
#R3. Replace hard returns with , cut carriage returns
$Description=~s/\n/ /g;
$Description=~s/\r//g;
if ($Description eq "Select"){
$Description="";}
#R3. Replace hard returns with , cut carriage returns
$Venue=~s/\n/ /g;
$Venue=~s/\r//g;
if ($Venue eq "Select"){
$Venue="";}
#R3. Replace hard returns with , cut carriage returns
$Day=~s/\n/ /g;
$Day=~s/\r//g;
if ($Day eq "Select"){
$Day="";}
#R3. Replace hard returns with , cut carriage returns
$Month=~s/\n/ /g;
$Month=~s/\r//g;
if ($Month eq "Select"){
$Month="";}
#R3. Replace hard returns with , cut carriage returns
$Year=~s/\n/ /g;
$Year=~s/\r//g;
if ($Year eq "Select"){
$Year="";}
#R3. Replace hard returns with , cut carriage returns
$Time=~s/\n/ /g;
$Time=~s/\r//g;
if ($Time eq "Select"){
$Time="";}
#R3. Replace hard returns with , cut carriage returns
$Website=~s/\n/ /g;
$Website=~s/\r//g;
if ($Website eq "Select"){
$Website="";}
#R3. Replace hard returns with , cut carriage returns
$Email=~s/\n/ /g;
$Email=~s/\r//g;
if ($Email eq "Select"){
$Email="";}
#R3. Replace hard returns with , cut carriage returns
$Public_Remarks=~s/\n/ /g;
$Public_Remarks=~s/\r//g;
if ($Public_Remarks eq "Select"){
$Public_Remarks="";}
#R3. Replace hard returns with , cut carriage returns
$Private_Remarks=~s/\n/ /g;
$Private_Remarks=~s/\r//g;
if ($Private_Remarks eq "Select"){
$Private_Remarks="";}
#R4. You have marked Event as a field that must contain at least 2
$Eventcheck=$Event;
$Eventcheck=~s/ +/ /g;
$Eventcheck=length($Eventcheck);
if ($Eventcheck<2){
$problem="Please press back on your browser and provide more information for the .. Event .. field.";
&security;}
#R4. You have marked Description as a field that must contain at least 2
$Venuecheck=$Venue;
$Venuecheck=~s/ +/ /g;
$Venuecheck=length($Venuecheck);
if ($Venuecheck<2){
$problem="Please press the Back Button on your browser and provide more information for the .. Venue .. Field. It is either not indicated in the dropdown box or not indicated in the additional field provided";
&security;}
#R4. You have marked Day as a field that must contain at least 1
$Daycheck=$Day;
$Daycheck=~s/ +/ /g;
$Daycheck=length($Daycheck);
if ($Daycheck<1){
$problem="Please press back on your browser and provide more information for the .. Day .. field.";
&security;}
#R4. You have marked Month as a field that must contain at least 1
#non-blank characters before allowing the field to be added. You can change the
#requirement below, or comment out all 6 lines below step to skip validation
$Monthcheck=$Month;
$Monthcheck=~s/ +/ /g;
$Monthcheck=length($Monthcheck);
if ($Monthcheck<1){
$problem="Please press back on your browser and provide more information for the .. Month .. field.";
&security;}
#R4. You have marked Year as a field that must contain at least 2
#non-blank characters before allowing the field to be added. You can change the
#requirement below, or comment out all 6 lines below step to skip validation
$Yearcheck=$Year;
$Yearcheck=~s/ +/ /g;
$Yearcheck=length($Yearcheck);
if ($Yearcheck<2){
$problem="Please press back on your browser and provide more information for the .. Year .. field.";
&security;}
#R4. You have marked Time as a field that must contain at least 2
$Timecheck=$Time;
$Timecheck=~s/ +/ /g;
$Timecheck=length($Timecheck);
if ($Timecheck<2){
$problem="Please press back on your browser and provide more information for the .. Time .. field - at least 2 letters or numbers.";
&security;}
#R10. You have marked Email as a field that must contain a valid e-mail
#Address, OR, be empty. To remove requirement, comment out 9 lines below
$Emailcheck=$Email;
($firstpart,$secondpart)=split(/\@/,$Emailcheck);
if ($Email && (!$firstpart || !$secondpart || $secondpart!~/\./)){
$problem="The information you have provided in the e-mail field does not look like a valid e-mail address. Please press back on your browser and fix this problem.";
&security;}
#R11. Remove characters that could cause security issues in e-mail field
if ($Emailcheck =~/[\!\|\~\^\'\"]/){
$problem="The information you entered into the e-mail field contains illegal characters. This field should contain letters, numbers, the \@ symbol, and periods only. Please press BACK and fix this problem.";
&security;}
}
#STEP S====
sub addtemp{
#S1. This subroutine adds records to your temporary file for approval
#S2. Check variable sent
&getvariables;
#S3. Randomize in preparation for random generator
srand();
#S4. Get IP address of person posting record
$ipstamp=$ENV{'REMOTE_ADDR'};
#S5. Generate a large random number to serve as key
$randnumb=int(rand(9999999));
$replacementline="$ipstamp&&temp$randnumb(\+\+)$Icon$delimiter$Event$delimiter$Description$delimiter$Venue$delimiter$Day$delimiter$Month$delimiter$Year$delimiter$Time$delimiter$Website$delimiter$Email$delimiter$Public_Remarks$delimiter$Private_Remarks";
#S6. Write the temp record to the bottom of the
$problem="Can't write to the data file. Please verify its location and change its permissions to 777.";
open (FILE2,">>$tempdata") || &security;
print FILE2 "$replacementline\n";
close(FILE2);
print "Content-type: text/html\n\n";
print "
\n";
print "$templatestart\n";
#S7. Acknowledge that record has been posted
print "Your record has been sent to the WebMaster for approval. Please click here to return to the Events Calendar .. OR ... Use your Browser's Back Button to submit more Events.\n";
print "$templateend\n";
exit;
}
#STEP T====
sub scrolltemp{
#T1. This step is your interface with the temp file
#T2. Check password
if ($adminpassword ne $checkpassword && $adminpassword){
$problem="The password you entered does not match your administration password. Please press BACK on your browser to fix this problem.";
&security;}
#T3. Check to make sure that the data file can be opened.
$problem="Unable to open your temporary data file. It either contains no records, or the path to it is incorrect.";
open (FILE, "$tempdata") || &security;
@all=;
close (FILE);
print "Content-type: text/html\n\n";
#T4. Start showing contents of data file
print "$templatestart\n";
print "\n";}
else{
print "\n";}
print "$templateend\n";
exit;
}
#STEP U=======
sub updatetemp{
#U1. This step makes changes from temp file
#U2. Check password
if ($adminpassword ne $checkpassword && $adminpassword){
$problem="The password you entered does not match your administration password. Please press BACK on your browser to fix this problem.";
&security;}
$problem="Unable to open your temporary data file. It either contains no records, or the path to it is incorrect.";
open (FILE, "$tempdata") || &security;
@all=;
close (FILE);
foreach $line (@all){
$line=~s/\n//g;
$checkleng=length($line);
if ($checkleng<2){next};
($indexvalues,$stringvalues)=split(/\(\+\+\)/,$line);
($ipaddress,$uniqueapproval)=split(/&&/,$indexvalues);
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$stringvalues);
if ($tempapprove{$uniqueapproval} eq "A"){
push(@recordstoadd,$stringvalues);}
elsif ($tempapprove{$uniqueapproval} eq "D"){
push(@recordstodelete,$stringvalues);}
elsif ($tempapprove{$uniqueapproval} eq "E"){
push(@recordstoedit,$stringvalues);}
else {
push(@recordstohold,$line);}
}
$problem="Unable to open data file to add records. Check path to it and its permissions.";
open (FILE, ">>$data") || &security;
foreach $line (@recordstoadd){
$line=~s/\n//g;
print FILE "$line\n";}
close(FILE);
$problem="Unable to open data file to records to edit. Check path to it and its permissions.";
open (FILE, ">>$data") || &security;
foreach $line (@recordstoedit){
$line=~s/\n//g;
print FILE "markedtoedit$line\n";}
close(FILE);
$problem="Unable to open temporary file to refresh data. Check path to it and its permissions.";
open (FILE, ">$tempdata") || &security;
foreach $line (@recordstohold){
$line=~s/\n//g;
print FILE "$line\n";}
close(FILE);
$checkhold=@recordstohold;
if ($checkhold){
&scrolltemp;}
print "Content-type: text/html\n\n";
print "$templatestart\n";
print "
Your actions have been taken. Please click here to continue.
\n";
print "$templateend\n";
exit;
}
sub read{
my ($open_file)=@_;
open(DAT, "$open_file") ;
my @data=;
close(DAT);
return @data;
}
sub write{
my ($writeto_file,@write)=@_;
my ($abc,$output);
foreach $abc(@write){
$output="$output\n$abc";
for ($output){
s/^\s+//;
s/\s+$//;
}
}
flock(DAT, 2);
open(DAT,">$writeto_file");
print DAT "$output\n";
close(DAT);
flock(DAT, 8);
}
sub do_diff_check{
my(@today) = localtime(time);
$today[5]=$today[5]+1900;
$today[4]=$today[4]+1;
if($today[4]<10){
$today[4]="0$today[4]";
}
if($today[3]<10){
$today[3]="0$today[3]";
}
my $today_date="$today[5]$today[4]$today[3]";
my @data_temp=&read($data);
foreach my $line(@data_temp){
my(@fields)=split(/\t/,$line);
my $temp_date="$fields[6]$fields[5]$fields[4]";
if($temp_date < $today_date){
$diff_marker=1;
last;
}
}
my (@output);
if($diff_marker){
foreach my $line(@data_temp){
my(@fields)=split(/\t/,$line);
my $temp_date="$fields[6]$fields[5]$fields[4]";
if($temp_date >=$today_date){
push(@output,$line);
}
}
&write($data,@output);
print "$line\n";
}
}#!/usr/bin/perl
use CGI;
$query = new CGI;
#You need to modify this script at all parts of Step B
#Script Description
#Unique script ID: yel/coc/f/yel-5b2d
#Created on: 12/19/2001
#Last edited on: 12/19/2001
#Script class: D
#STEP A======
#A1. The following lines get and process data passed
#through the URL, do not modify
$stringpassed=$ENV{'QUERY_STRING'};
#A2. Replace all plusses with spaces for data passed via URL
$stringpassed=~s/\+/ /g;
#STEP B======
######################################################
# START OF CONFIGURATION
######################################################
#B1. REQUIRED: The location of event data file on your server.
$data="/home/mrgforce/public_html/usaent/cgi/ep/eventpublisher.txt";
#B1b. REQUIRED: The location of your TEMPORARY event data file on your server.
$tempdata="/home/mrgforce/public_html/usaent/cgi/ep/eventpublisher.tempdata";
#B1c. OPTIONAL: You can format the opening and closing HTML of your admin mode
$openinghtml="/home/mrgforce/public_html/usaent/ep/icons/template.htm";
$thisurl="http://www.usaentertainment.com/cgi/eventpublisher_pro-sm-today.cgi";
#B4. REQUIRED TO ADD, DELETE, OR MODIFY.
$adminpassword="tbegrmg123";
$forwardingURL="http://www.usaentertainment.com/cgi/eventpublisher_pro-sm-today.cgi";
$baseurltoIcon="http://www.usaentertainment.com/ep/icons/";
$maximumpage=150;
#B18. Font settings of the event display
$fontface ="Verdana, Arial"; ### Recommended: "Verdana, Arial"
$fontsize= "1"; ### Used for event title and description only ###
$fonttitlecolor = "#990000";
$fontsubtitlecolor ="#000080"; ### Used for event sub titles such as "Venue", "Date" ....
#######################
# END OF CONFIGURATION
#######################
$maximum=1500;
@variablenames = $query->param;
foreach $variable (@variablenames){
$value=$query->param($variable);
$tempapprove{$variable}="$value";}
#STEP D================================
#You should not need to modify this section at all
#D1. Check to see if opening html file is on server
if (-e "$openinghtml"){
#D2. If so, open it and write opening and closing text to different strings
#to be used throughout the script
$problem="Can't open template file. Make sure you are referencing the file and not just a directory.";
open(OPENING, "$openinghtml") || &security;
@wholefile=;
close(OPENING);
$fulltemplate=join("\n",@wholefile);
($templatestart,$templateend)=split(/\+\+\+/,$fulltemplate);}
else{
#D3. If template file not found, use this for now
$templatestart="";
$templateend="";}
$delimiter="\t";
#D6. Get Password Entered by User
$checkpassword=$query->param('checkpassword');
#D7. Figure out what action user wants to take.
$actiontotake=$query->param('actiontotake');
$linenumberpass=$query->param('linenumberpass');
#D8. If user wants to delete record, and has already
#verified password, then go to the makechange subroutine
if ($actiontotake eq "Delete Record"){
$recordaction="Deleted";
&makechange;
exit;}
#D9. If user wants to edit record, and has already
#verified password, then go to the makechange subroutine
if ($actiontotake eq "Edit Record"){
$recordaction="Edited";
&makechange;
exit;}
#D10. If user wants to edit record, to go subroutine to verify
if ($actiontotake eq "Edit"){
&edit;
exit;}
#D11. If user wants to delete record, to go subroutine to verify
if ($actiontotake eq "Delete"){
&delete;
exit;}
#D12. If user wants to add record, go to add subroutine
if ($actiontotake eq "Add"){
&addrecord;
exit;}
#D13. If user wants to add record to temporary file
if ($actiontotake eq "Addtemp"){
&addtemp;
exit;}
#D14. If owner wants to evaluate records in temp file
if ($actiontotake eq "Scrolltemp"){
&scrolltemp;
exit;}
#D15. If user wants to update temp file
if ($actiontotake eq "Updatetemp"){
&updatetemp;
exit;}
#STEP E================================
#E1. Get the data passed from user
#PRO
$Icon=$query->param('Icon');
$Iconwork=lc($Icon);
$Iconwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Iconwork eq "select"){
$Iconwork="";
$Icon="";}
$Iconpass="$Icon";
#E1. Get the data passed from user
$Event=$query->param('Event');
$Eventwork=lc($Event);
#PRO
$Eventwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Eventwork eq "select"){
$Eventwork="";
$Event="";}
$Eventpass="$Event";
#E1. Get the data passed from user
$Description=$query->param('Description');
$Descriptionwork=lc($Description);
#PRO
$Descriptionwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Descriptionwork eq "select"){
$Descriptionwork="";
$Description="";}
$Descriptionpass="$Description";
#E1. Get the data passed from user
$Venue=$query->param('Venue');
$Venuework=lc($Venue);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Venuework=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Venuework eq "select"){
$Venuework="";
$Venue="";}
$Venuepass="$Venue";
#E1. Get the data passed from user
$Month=$query->param('Month');
$Monthwork=lc($Month);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Monthwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Monthwork eq "select"){
$Monthwork="";
$Month="";}
$Monthpass="$Month";
#E1. Get the data passed from user
$Day=$query->param('Day');
$Daywork=lc($Day);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Daywork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Daywork eq "select"){
$Daywork="";
$Day="";}
$Daypass="$Day";
#E1. Get the data passed from user
$Year=$query->param('Year');
$Yearwork=lc($Year);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Yearwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Yearwork eq "select"){
$Yearwork="";
$Year="";}
$Yearpass="$Year";
#E6. Get number of records already displayed
$startitem=$query->param('startitem');
#E7. Figure the last record to display on this page
$enditem=$startitem+$maximumpage;
#F4a. Support for European characters.
#PRO
($Iconone, $Icontwo, $Iconthree, $Iconfour, $Iconfive, $Iconsix, $Iconseven)=split(/ /, $Iconwork);
#F4a. Support for European characters.
($Eventone, $Eventtwo, $Eventthree, $Eventfour, $Eventfive, $Eventsix, $Eventseven)=split(/ /, $Eventwork);
#F4a. Support for European characters.
$Lo1="P"; $Lo2="is";
($Descriptionone, $Descriptiontwo, $Descriptionthree, $Descriptionfour, $Descriptionfive, $Descriptionsix, $Descriptionseven)=split(/ /, $Descriptionwork);
$Text1="Fr"; $Text2="Ev"; $Text3="her";
#F4a. Support for European characters.
$Hi1="ee"; $Hi2="ent"; $Hi3="ubl";
($Venueone, $Venuetwo, $Venuethree, $Venuefour, $Venuefive, $Venuesix, $Venueseven)=split(/ /, $Venuework);
#F4a. Support for European characters.
($Monthone, $Monthtwo, $Monththree, $Monthfour, $Monthfive, $Monthsix, $Monthseven)=split(/ /, $Monthwork);
($Dayone, $Daytwo, $Daythree, $Dayfour, $Dayfive, $Daysix, $Dayseven)=split(/ /, $Daywork);
#F4a. Support for European characters.
$comp1="INT"; $comp2="O"; $comp3="U"; $lcomp1="int"; $lcomp2="po"; $lcomp3="u";
$and1="b"; $and2="y";
($Yearone, $Yeartwo, $Yearthree, $Yearfour, $Yearfive, $Yearsix, $Yearseven)=split(/ /, $Yearwork);
#STEP G================================
#Do not modify this section
#G1. Open datafile and write contents to an array, if can't open report the problem at the security subroutine
$problem="You do not have a file to search on the server. Please ADD test records before trying to search your test data file.";
open (FILE, "$data") || &security;
@all=;
close (FILE);
#G2. The line below is required, do not modify
print "Content-type: text/html\n\n";
#G3. Display HTML Header
if ($adminpassword eq $checkpassword){
print "$templatestart\n";}
else {
######### Show Top of Page with Graphic, Search & Submit Links
#print "
\n";
####### Show Day & Date on Page
@timedisp = localtime(time + (86400 * 1));
@months = qw(January February March April May June July August September October November December);
@dayofweek = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday);
$monthdisp = $months[$timedisp[4]];
$daydisp = $dayofweek[$timedisp[6]];
$monthtemp = @timedisp[4]+1;
$daytemp = @timedisp[3];
$Month = $monthtemp;
$Day = $daytemp;
$Monthpass="$Month";
$Daypass="$Day";
print"\n";
#print "
Click Here for the Complete Calendar \n";
}
#print "";}
#STEP H==========
#H1. Read each line of the data file, compare with search words
foreach $line (@all){
$line=~s/\n//g;
$loopsaround++;
$checkleng=length($line);
if ($checkleng<2){next};
$linetemp1=lc($line);
#H1a. Support for European characters.
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetemp1);
#H9. This line specifies the fields to sort results by
$line="$Year$Month$Day$Event$delimiter$loopsaround$delimiter$line";
#H9.5 This line removes stray leading spaces before sorting your results
$line=~s/^ +//;
$increcount=0;
#PRO
#H12. Look for matches in field named Icon
if (($Icon =~/\b$Iconone/ && $Icon =~/\b$Icontwo/ && $Icon =~/\b$Iconthree/ && $Icon =~/\b$Iconfour/ && $Icon =~/\b$Iconfive/ && $Icon=~/\b$Iconsix/ && $Icon=~/\b$Iconseven/) || !$Iconwork) {
$increcount++;}
#H12. Look for matches in field named Event
if (($Event =~/\b$Eventone/ && $Event =~/\b$Eventtwo/ && $Event =~/\b$Eventthree/ && $Event =~/\b$Eventfour/ && $Event =~/\b$Eventfive/ && $Event=~/\b$Eventsix/ && $Event=~/\b$Eventseven/) || !$Eventwork) {
$increcount++;}
#H12. Look for matches in field named Description
if (($Description =~/\b$Descriptionone/ && $Description =~/\b$Descriptiontwo/ && $Description =~/\b$Descriptionthree/ && $Description =~/\b$Descriptionfour/ && $Description =~/\b$Descriptionfive/ && $Description=~/\b$Descriptionsix/ && $Description=~/\b$Descriptionseven/) || !$Descriptionwork) {
$increcount++;}
#H12. Look for matches in field named Venue
if (($Venue =~/\b$Venueone/ && $Venue =~/\b$Venuetwo/ && $Venue =~/\b$Venuethree/ && $Venue =~/\b$Venuefour/ && $Venue =~/\b$Venuefive/ && $Venue=~/\b$Venuesix/ && $Venue=~/\b$Venueseven/) || !$Venuework) {
$increcount++;}
#H12. Look for matches in fields named Month & Day
if ($Monthpass == "" && $Daypass == "") {
$increcount++;}
elsif ($Monthpass == $Month && $Daypass == "") {
$increcount++;}
elsif ($Monthpass == "" && $Daypass == $Day) {
$increcount++;}
elsif ($Monthpass == $Month && $Daypass == $Day && $Year == ($timedisp[5] + 1900)) {
$increcount++;}
#H12. Look for matches in field named Year
if (($Year =~/\b$Yearone/ && $Year =~/\b$Yeartwo/ && $Year =~/\b$Yearthree/ && $Year =~/\b$Yearfour/ && $Year =~/\b$Yearfive/ && $Year=~/\b$Yearsix/ && $Year=~/\b$Yearseven/) || !$Yearwork) {
$increcount++;}
if ($line=~/markedtoedit/ && $actiontotake eq "markedtoedit"){
$line=~s/markedtoedit//g;
push (@keepers2,$line);}
$line=~s/markedtoedit//g;
if ($increcount==6){
push (@keepers,$line);}}
#STEP J=======
if ($actiontotake eq "markedtoedit"){
@keepers=@keepers2;}
#J1. Sort matches stored in array.
@keepers=sort(@keepers);
#J2. Get and display number of matches found
$length1=@keepers;
#J3. If the number of matches is less than enditem, adjust
if ($length1<$enditem){
$enditem=$length1;
$displaystat="Y";}
#J4. The first field about to display
$disstart=$startitem+1;
##### Show Total Posted
#J5. Show user total number of matches found & display on screen
#if ($length1){
#print "Total Events Posted For Today ... $length1<\/font>\n";
#} else {
#print "
No Local Events Found.<\/B> Press your Browsers Back Button and try again.<\/P>\n";}
#STEP K=====
#K1. Do some HTML formatting before showing results
print "
\n";
#K4. Keep track of results processed on this page
foreach $line (@keepers){
#K5. Delete stray hard returns
$line=~s/\n//g;
#K6. Keep track of records displayed
$countline1++;
#K7. Decide whether or not this record goes on this page
if ($countline1>$startitem && $countline1<=$enditem){
#K8. Open each line of sorted array for displaying
($sortfield,$loopsaround,$Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$line);
if ($Month eq "01"){
$Month2 = "January";}
if ($Month eq "02"){
$Month2 = "February";}
if ($Month eq "03"){
$Month2 = "March";}
if ($Month eq "04"){
$Month2 = "April";}
if ($Month eq "05"){
$Month2 = "May";}
if ($Month eq "06"){
$Month2 = "June";}
if ($Month eq "07"){
$Month2 = "July";}
if ($Month eq "08"){
$Month2 = "August";}
if ($Month eq "09"){
$Month2 = "September";}
if ($Month eq "10"){
$Month2 = "October";}
if ($Month eq "11"){
$Month2 = "November";}
if ($Month eq "12"){
$Month2 = "December";}
#K15. Formatting for ad separating line.
#print "
\n";
#K15. Formatting for field Day. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Day){
#print "
Date:
$daydisp .. $Month2 $Day, #$Year
\n";}
#K15. Formatting for field Event. If you add any HTML, make sure you
#if ($Icon){
print "
$Month\/$Day -
$Event ... $Time @ $Venue
\n";
#else {
#print "
$Event
\n";}
#K15. Formatting for field Venue. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Venue){
#print "
\n";}
#K15. Formatting for field Time. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Time){
#print "
Time:
$Time
\n";}
#K15. Formatting for field Website. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Website){
#print "
\n";}
#K15. Formatting for field Email. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Email){
#print "
\n";}
#K15. Formatting for field Description.
#if ($Description){
#print "
$Description
\n";}
#print "
Info:
$Description
\n";}
#K15. Formatting for field Public_Remarks.
#if ($Public_Remarks){
#print "
$Public_Remarks
\n";}
#K11. Check passwords before showing edit and delete buttons
#if ($adminpassword eq $checkpassword){
#print "
\n";}
#STEP L====
#L1. If total displayed equals maximum you set, then exit
if ($countline1 == $maximum && $maximum){
$problem2="Your search was terminated because there were more than $maximum matching records found, please be more specific in your search";
last;}
#L2. If script just got to last match then exit program
if ($length1 == $countline1){
last;}
#L3. If script is at the end of a page then show NEXT button
if ($countline1 == $enditem && $displaystat ne "Y" && $maximum>$countline1){
$stopit="Y";
last;
}
}}
print "
\n";
$fcc="f"; $fcd="1"; $fce="w"; $fcf="tp"; $fcg="dn"; $fci="e";
$checkfcc="ne"; $checkfcd="t"; $checkfcf="s"; $checkfcg="ef"; $checkfci="ank"; $checkfcj="_bl";
$mer1="";
$mer3=" ";
# Formatting for separating line at bottom above Next Button.
#print "
\n";
#L4. Display NEXT MATCHES button
if ($stopit eq "Y"){
print "\n";
#L5. Pass hidden variables so script will know how to display next page
#PRO
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";}
$errormode ="$mer1";
#if (($stopit eq "Y") and ($adminpassword eq $checkpassword)){
######### Next Button
#if ($stopit eq "Y"){
#print " \n";
######### Copyright
#print "Copyright © 1998-2006 ... All Rights Reserved \n";
#print "TAMPABAYENTERTAINMENT.COM \n";
#print "A Member of the OLTB.COM Information Network
#A Division of USAEntertainment.Com ... and ... \n";
#print "TampaBayMusicScene.Com \n";
#}
#elsif ($stopit ne "Y"){
######### Copyright
#print "Copyright © 1998-2006 ... All Rights Reserved \n";
#print "TAMPABAYENTERTAINMENT.COM \n";
#print "A Member of the OLTB.COM Information Network
#A Division of USAEntertainment.Com ... and ... \n";
#print "TampaBayMusicScene.Com \n";
#}
#L6. Show problems
if ((!$mer1) or (!$mer2) or (!$mer3)){
&low;}
if ($problem2){
print "$problem2";}
else {
print "$mer3";
}
#L8. If opening.htm was found, show its closing html codes
if (!$errormode) {
&low;}
srand();
$checkval=int(rand(30));
if ($checkval==3){
print "";}
if ($adminpassword eq $checkpassword){
print "$templateend\n";}
else {
print "";}
exit;
#STEP M=====
sub security{
#M1. This is the subroutine that reports all problems
print "Content-type: text/html\n\n";
print "$templatestart\n";
print "
Data Error
\n";
print "Please correct the following error:
$problem
\n";
print "$templateend\n";
exit;
}
sub low{
#M1. This is the subroutine that reports all problems
print "$templatestart\n";
print "
Data Error
\n";
print "Error:
Script Corrupted!
\n";
print "$templateend\n";
exit;
}
#STEP N=====
sub edit{
#N1. Open data file and read it
$problem="Can't open data file to read from it at edit subroutine";
open (FILE,"$data") || &security;
@all=;
close (FILE);
#N2. Read each line of the data file
foreach $line (@all){
$line=~s/\n//g;
($copyIcon,$copyEvent,$copyDescription,$copyVenue,$copyDay,$copyMonth,$copyYear,$copyTime,$copyWebsite,$copyEmail,$copyPublic_Remarks,$copyPrivate_Remarks,$skipthisfield)=split (/$delimiter/,$line);
$keepcount++;
#N3. Find the line user wants to modify
if ($keepcount==$linenumberpass){
$linetokeep=$line;
$linetokeep=~s/markedtoedit//g;
last;
}
}
#N4. Check password sent via hidden field
if ($adminpassword ne $checkpassword){
$problem="Your password does not match the master password, please re-enter.";
&security;}
#N6. Split matching line into its respective variables
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetokeep);
#Required Header, do not delete
print "Content-type: text/html\n\n";
#N8. If can't find opening html, display default header
print "$templatestart\n";
print "
Admin Mode: Edit this Record\n";
print "
\n";
print "$templateend\n";
exit;
}
#STEP O====
sub delete{
#O1. Open data file and read it
$problem="Can't open data file to read from it at delete subroutine";
open (FILE,"$data") || &security;
@all=;
close (FILE);
#O2. Read each line of the file
foreach $line (@all){
$line=~s/\n//g;
($copyIcon,$copyEvent,$copyDescription,$copyVenue,$copyDay,$copyMonth,$copyYear,$copyTime,$copyWebsite,$copyEmail,$copyPublic_Remarks,$copyPrivate_Remarks,$skipthisfield)=split (/$delimiter/,$line);
$keepcount++;
#O3. Find line to delete
if ($keepcount==$linenumberpass){
$linetokeep=$line;
$linetokeep=~s/markedtoedit//g;
last;
}
}
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetokeep);
#O4. Check password sent via hidden field
if ($adminpassword ne $checkpassword){
$problem="Your password does not match the master password.";
&security;}
#O6. Required Header, do not delete
print "Content-type: text/html\n\n";
print "$templatestart\n";
print "
Admin Mode: Delete this Record?\n";
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetokeep);
#O7. Show validation HTML
print "
\n";
#If opening.htm was not found, show default closing html codes
print "$templateend\n";
exit;
}
#STEP P======
sub makechange{
#P1. Go to get variable subroutine and make sure add preferences apply
if ($recordaction eq "Edited"){
&getvariables;}
#P2. This step either replaces or empties the existing line
if ($recordaction eq "Deleted"){
$replacementline="";}
else{
$replacementline="$Icon$delimiter$Event$delimiter$Description$delimiter$Venue$delimiter$Day$delimiter$Month$delimiter$Year$delimiter$Time$delimiter$Website$delimiter$Email$delimiter$Public_Remarks$delimiter$Private_Remarks";}
$problem="Can't open data file to read from it";
open (FILE,"$data") || &security;
@all=;
close (FILE);
$linenumberpass--;
$all[$linenumberpass]=$replacementline;
$problem="Can't open temporary file. You need to chmod 777 the directory your data file is in. See the help files under Permissions for Class B Scripts.";
#P6. Write the entire changed file to a temporary file
open (FILE2,">$data.tmp") || &security;
foreach $line (@all){
$line=~s/\n//g;
print FILE2 "$line\n";}
close(FILE2);
#P7. Rename the temp file to your master data file
$problem="Can't rename file after making change";
rename("$data.tmp", "$data") || &security;
print "Content-type: text/html\n\n";
#P8. If can't find opening html, display default header
print "$templatestart\n";
print "Your record has been $recordaction. Please click here to continue.\n";
close (FILE);
#If opening.htm was not found, show default closing html codes
print "$templateend\n";
exit;
}
#STEP Q===
#This subroutine adds records to your database
sub addrecord{
#Q1. Check password
if ($adminpassword ne $checkpassword && $adminpassword){
$problem="The password you entered does not match your administration password. Please press BACK on your browser to fix this problem.";
&security;}
&getvariables;
$replacementline="$Icon$delimiter$Event$delimiter$Description$delimiter$Venue$delimiter$Day$delimiter$Month$delimiter$Year$delimiter$Time$delimiter$Website$delimiter$Email$delimiter$Public_Remarks$delimiter$Private_Remarks";
#Q3. Write the new record to the bottom of the data file
$problem="Can't write to the data file. Please verify its location and change its permissions to 777.";
open (FILE2,">>$data") || &security;
print FILE2 "$replacementline\n";
close(FILE2);
print "Content-type: text/html\n\n";
#Q4. If can't find opening html, display default header
print "$templatestart\n";
print "Your record has been added. Please click here to continue.\n";
#If opening.htm was not found, show default closing html codes
print "$templateend\n";
exit;
}
#STEP R===
sub getvariables{
#R1. This step checks your variables before adding/editing them
$Icon=$query->param('Icon');
$Event=$query->param('Event');
$Description=$query->param('Description');
$Private_Remarks=$query->param('Private_Remarks');
$Venue=$query->param('Venue');
if ($Venue eq "Choose From The Many Venues Listed Here ... Or Enter the Info Below"){
$Venue=$Private_Remarks;}
$Day=$query->param('Day');
$Month=$query->param('Month');
$Year=$query->param('Year');
$Time=$query->param('Time');
$Website=$query->param('Website');
$Email=$query->param('Email');
$Public_Remarks=$query->param('Public_Remarks');
#R3. Replace hard returns with , cut carriage returns
$Icon=~s/\n/ /g;
$Icon=~s/\r//g;
if ($Icon eq "Select"){
$Icon="";}
#R3. Replace hard returns with , cut carriage returns
$Event=~s/\n/ /g;
$Event=~s/\r//g;
if ($Event eq "Select"){
$Event="";}
#R3. Replace hard returns with , cut carriage returns
$Description=~s/\n/ /g;
$Description=~s/\r//g;
if ($Description eq "Select"){
$Description="";}
#R3. Replace hard returns with , cut carriage returns
$Venue=~s/\n/ /g;
$Venue=~s/\r//g;
if ($Venue eq "Select"){
$Venue="";}
#R3. Replace hard returns with , cut carriage returns
$Day=~s/\n/ /g;
$Day=~s/\r//g;
if ($Day eq "Select"){
$Day="";}
#R3. Replace hard returns with , cut carriage returns
$Month=~s/\n/ /g;
$Month=~s/\r//g;
if ($Month eq "Select"){
$Month="";}
#R3. Replace hard returns with , cut carriage returns
$Year=~s/\n/ /g;
$Year=~s/\r//g;
if ($Year eq "Select"){
$Year="";}
#R3. Replace hard returns with , cut carriage returns
$Time=~s/\n/ /g;
$Time=~s/\r//g;
if ($Time eq "Select"){
$Time="";}
#R3. Replace hard returns with , cut carriage returns
$Website=~s/\n/ /g;
$Website=~s/\r//g;
if ($Website eq "Select"){
$Website="";}
#R3. Replace hard returns with , cut carriage returns
$Email=~s/\n/ /g;
$Email=~s/\r//g;
if ($Email eq "Select"){
$Email="";}
#R3. Replace hard returns with , cut carriage returns
$Public_Remarks=~s/\n/ /g;
$Public_Remarks=~s/\r//g;
if ($Public_Remarks eq "Select"){
$Public_Remarks="";}
#R3. Replace hard returns with , cut carriage returns
$Private_Remarks=~s/\n/ /g;
$Private_Remarks=~s/\r//g;
if ($Private_Remarks eq "Select"){
$Private_Remarks="";}
#R4. You have marked Event as a field that must contain at least 2
$Eventcheck=$Event;
$Eventcheck=~s/ +/ /g;
$Eventcheck=length($Eventcheck);
if ($Eventcheck<2){
$problem="Please press back on your browser and provide more information for the .. Event .. field.";
&security;}
#R4. You have marked Description as a field that must contain at least 2
$Venuecheck=$Venue;
$Venuecheck=~s/ +/ /g;
$Venuecheck=length($Venuecheck);
if ($Venuecheck<2){
$problem="Please press the Back Button on your browser and provide more information for the .. Venue .. Field. It is either not indicated in the dropdown box or not indicated in the additional field provided";
&security;}
#R4. You have marked Day as a field that must contain at least 1
$Daycheck=$Day;
$Daycheck=~s/ +/ /g;
$Daycheck=length($Daycheck);
if ($Daycheck<1){
$problem="Please press back on your browser and provide more information for the .. Day .. field.";
&security;}
#R4. You have marked Month as a field that must contain at least 1
#non-blank characters before allowing the field to be added. You can change the
#requirement below, or comment out all 6 lines below step to skip validation
$Monthcheck=$Month;
$Monthcheck=~s/ +/ /g;
$Monthcheck=length($Monthcheck);
if ($Monthcheck<1){
$problem="Please press back on your browser and provide more information for the .. Month .. field.";
&security;}
#R4. You have marked Year as a field that must contain at least 2
#non-blank characters before allowing the field to be added. You can change the
#requirement below, or comment out all 6 lines below step to skip validation
$Yearcheck=$Year;
$Yearcheck=~s/ +/ /g;
$Yearcheck=length($Yearcheck);
if ($Yearcheck<2){
$problem="Please press back on your browser and provide more information for the .. Year .. field.";
&security;}
#R4. You have marked Time as a field that must contain at least 2
$Timecheck=$Time;
$Timecheck=~s/ +/ /g;
$Timecheck=length($Timecheck);
if ($Timecheck<2){
$problem="Please press back on your browser and provide more information for the .. Time .. field - at least 2 letters or numbers.";
&security;}
#R10. You have marked Email as a field that must contain a valid e-mail
#Address, OR, be empty. To remove requirement, comment out 9 lines below
$Emailcheck=$Email;
($firstpart,$secondpart)=split(/\@/,$Emailcheck);
if ($Email && (!$firstpart || !$secondpart || $secondpart!~/\./)){
$problem="The information you have provided in the e-mail field does not look like a valid e-mail address. Please press back on your browser and fix this problem.";
&security;}
#R11. Remove characters that could cause security issues in e-mail field
if ($Emailcheck =~/[\!\|\~\^\'\"]/){
$problem="The information you entered into the e-mail field contains illegal characters. This field should contain letters, numbers, the \@ symbol, and periods only. Please press BACK and fix this problem.";
&security;}
}
#STEP S====
sub addtemp{
#S1. This subroutine adds records to your temporary file for approval
#S2. Check variable sent
&getvariables;
#S3. Randomize in preparation for random generator
srand();
#S4. Get IP address of person posting record
$ipstamp=$ENV{'REMOTE_ADDR'};
#S5. Generate a large random number to serve as key
$randnumb=int(rand(9999999));
$replacementline="$ipstamp&&temp$randnumb(\+\+)$Icon$delimiter$Event$delimiter$Description$delimiter$Venue$delimiter$Day$delimiter$Month$delimiter$Year$delimiter$Time$delimiter$Website$delimiter$Email$delimiter$Public_Remarks$delimiter$Private_Remarks";
#S6. Write the temp record to the bottom of the
$problem="Can't write to the data file. Please verify its location and change its permissions to 777.";
open (FILE2,">>$tempdata") || &security;
print FILE2 "$replacementline\n";
close(FILE2);
print "Content-type: text/html\n\n";
print "
\n";
print "$templatestart\n";
#S7. Acknowledge that record has been posted
print "Your record has been sent to the WebMaster for approval. Please click here to return to the Events Calendar .. OR ... Use your Browser's Back Button to submit more Events.\n";
print "$templateend\n";
exit;
}
#STEP T====
sub scrolltemp{
#T1. This step is your interface with the temp file
#T2. Check password
if ($adminpassword ne $checkpassword && $adminpassword){
$problem="The password you entered does not match your administration password. Please press BACK on your browser to fix this problem.";
&security;}
#T3. Check to make sure that the data file can be opened.
$problem="Unable to open your temporary data file. It either contains no records, or the path to it is incorrect.";
open (FILE, "$tempdata") || &security;
@all=;
close (FILE);
print "Content-type: text/html\n\n";
#T4. Start showing contents of data file
print "$templatestart\n";
print "\n";}
else{
print "\n";}
print "$templateend\n";
exit;
}
#STEP U=======
sub updatetemp{
#U1. This step makes changes from temp file
#U2. Check password
if ($adminpassword ne $checkpassword && $adminpassword){
$problem="The password you entered does not match your administration password. Please press BACK on your browser to fix this problem.";
&security;}
$problem="Unable to open your temporary data file. It either contains no records, or the path to it is incorrect.";
open (FILE, "$tempdata") || &security;
@all=;
close (FILE);
foreach $line (@all){
$line=~s/\n//g;
$checkleng=length($line);
if ($checkleng<2){next};
($indexvalues,$stringvalues)=split(/\(\+\+\)/,$line);
($ipaddress,$uniqueapproval)=split(/&&/,$indexvalues);
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$stringvalues);
if ($tempapprove{$uniqueapproval} eq "A"){
push(@recordstoadd,$stringvalues);}
elsif ($tempapprove{$uniqueapproval} eq "D"){
push(@recordstodelete,$stringvalues);}
elsif ($tempapprove{$uniqueapproval} eq "E"){
push(@recordstoedit,$stringvalues);}
else {
push(@recordstohold,$line);}
}
$problem="Unable to open data file to add records. Check path to it and its permissions.";
open (FILE, ">>$data") || &security;
foreach $line (@recordstoadd){
$line=~s/\n//g;
print FILE "$line\n";}
close(FILE);
$problem="Unable to open data file to records to edit. Check path to it and its permissions.";
open (FILE, ">>$data") || &security;
foreach $line (@recordstoedit){
$line=~s/\n//g;
print FILE "markedtoedit$line\n";}
close(FILE);
$problem="Unable to open temporary file to refresh data. Check path to it and its permissions.";
open (FILE, ">$tempdata") || &security;
foreach $line (@recordstohold){
$line=~s/\n//g;
print FILE "$line\n";}
close(FILE);
$checkhold=@recordstohold;
if ($checkhold){
&scrolltemp;}
print "Content-type: text/html\n\n";
print "$templatestart\n";
print "
Your actions have been taken. Please click here to continue.
\n";
print "$templateend\n";
exit;
}
sub read{
my ($open_file)=@_;
open(DAT, "$open_file") ;
my @data=;
close(DAT);
return @data;
}
sub write{
my ($writeto_file,@write)=@_;
my ($abc,$output);
foreach $abc(@write){
$output="$output\n$abc";
for ($output){
s/^\s+//;
s/\s+$//;
}
}
flock(DAT, 2);
open(DAT,">$writeto_file");
print DAT "$output";
close(DAT);
flock(DAT, 8);
}
sub do_diff_check{
my(@today) = localtime(time);
$today[5]=$today[5]+1900;
$today[4]=$today[4]+1;
if($today[4]<10){
$today[4]="0$today[4]";
}
if($today[3]<10){
$today[3]="0$today[3]";
}
my $today_date="$today[5]$today[4]$today[3]";
my @data_temp=&read($data);
foreach my $line(@data_temp){
my(@fields)=split(/\t/,$line);
my $temp_date="$fields[6]$fields[5]$fields[4]";
if($temp_date < $today_date){
$diff_marker=1;
last;
}
}
my (@output);
if($diff_marker){
foreach my $line(@data_temp){
my(@fields)=split(/\t/,$line);
my $temp_date="$fields[6]$fields[5]$fields[4]";
if($temp_date >=$today_date){
push(@output,$line);
}
}
&write($data,@output);
}
}#!/usr/bin/perl
use CGI;
$query = new CGI;
#You need to modify this script at all parts of Step B
#Script Description
#Unique script ID: yel/coc/f/yel-5b2d
#Created on: 12/19/2001
#Last edited on: 12/19/2001
#Script class: D
#STEP A======
#A1. The following lines get and process data passed
#through the URL, do not modify
$stringpassed=$ENV{'QUERY_STRING'};
#A2. Replace all plusses with spaces for data passed via URL
$stringpassed=~s/\+/ /g;
#STEP B======
######################################################
# START OF CONFIGURATION
######################################################
#B1. REQUIRED: The location of event data file on your server.
$data="/home/mrgforce/public_html/usaent/cgi/ep/eventpublisher.txt";
#B1b. REQUIRED: The location of your TEMPORARY event data file on your server.
$tempdata="/home/mrgforce/public_html/usaent/cgi/ep/eventpublisher.tempdata";
#B1c. OPTIONAL: You can format the opening and closing HTML of your admin mode
$openinghtml="/home/mrgforce/public_html/usaent/ep/icons/template.htm";
$thisurl="http://www.usaentertainment.com/cgi/eventpublisher_pro-sm-today.cgi";
#B4. REQUIRED TO ADD, DELETE, OR MODIFY.
$adminpassword="tbegrmg123";
$forwardingURL="http://www.usaentertainment.com/cgi/eventpublisher_pro-sm-today.cgi";
$baseurltoIcon="http://www.usaentertainment.com/ep/icons/";
$maximumpage=150;
#B18. Font settings of the event display
$fontface ="Verdana, Arial"; ### Recommended: "Verdana, Arial"
$fontsize= "1"; ### Used for event title and description only ###
$fonttitlecolor = "#990000";
$fontsubtitlecolor ="#000080"; ### Used for event sub titles such as "Venue", "Date" ....
#######################
# END OF CONFIGURATION
#######################
$maximum=1500;
@variablenames = $query->param;
foreach $variable (@variablenames){
$value=$query->param($variable);
$tempapprove{$variable}="$value";}
#STEP D================================
#You should not need to modify this section at all
#D1. Check to see if opening html file is on server
if (-e "$openinghtml"){
#D2. If so, open it and write opening and closing text to different strings
#to be used throughout the script
$problem="Can't open template file. Make sure you are referencing the file and not just a directory.";
open(OPENING, "$openinghtml") || &security;
@wholefile=;
close(OPENING);
$fulltemplate=join("\n",@wholefile);
($templatestart,$templateend)=split(/\+\+\+/,$fulltemplate);}
else{
#D3. If template file not found, use this for now
$templatestart="";
$templateend="";}
$delimiter="\t";
#D6. Get Password Entered by User
$checkpassword=$query->param('checkpassword');
#D7. Figure out what action user wants to take.
$actiontotake=$query->param('actiontotake');
$linenumberpass=$query->param('linenumberpass');
#D8. If user wants to delete record, and has already
#verified password, then go to the makechange subroutine
if ($actiontotake eq "Delete Record"){
$recordaction="Deleted";
&makechange;
exit;}
#D9. If user wants to edit record, and has already
#verified password, then go to the makechange subroutine
if ($actiontotake eq "Edit Record"){
$recordaction="Edited";
&makechange;
exit;}
#D10. If user wants to edit record, to go subroutine to verify
if ($actiontotake eq "Edit"){
&edit;
exit;}
#D11. If user wants to delete record, to go subroutine to verify
if ($actiontotake eq "Delete"){
&delete;
exit;}
#D12. If user wants to add record, go to add subroutine
if ($actiontotake eq "Add"){
&addrecord;
exit;}
#D13. If user wants to add record to temporary file
if ($actiontotake eq "Addtemp"){
&addtemp;
exit;}
#D14. If owner wants to evaluate records in temp file
if ($actiontotake eq "Scrolltemp"){
&scrolltemp;
exit;}
#D15. If user wants to update temp file
if ($actiontotake eq "Updatetemp"){
&updatetemp;
exit;}
#STEP E================================
#E1. Get the data passed from user
#PRO
$Icon=$query->param('Icon');
$Iconwork=lc($Icon);
$Iconwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Iconwork eq "select"){
$Iconwork="";
$Icon="";}
$Iconpass="$Icon";
#E1. Get the data passed from user
$Event=$query->param('Event');
$Eventwork=lc($Event);
#PRO
$Eventwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Eventwork eq "select"){
$Eventwork="";
$Event="";}
$Eventpass="$Event";
#E1. Get the data passed from user
$Description=$query->param('Description');
$Descriptionwork=lc($Description);
#PRO
$Descriptionwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Descriptionwork eq "select"){
$Descriptionwork="";
$Description="";}
$Descriptionpass="$Description";
#E1. Get the data passed from user
$Venue=$query->param('Venue');
$Venuework=lc($Venue);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Venuework=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Venuework eq "select"){
$Venuework="";
$Venue="";}
$Venuepass="$Venue";
#E1. Get the data passed from user
$Month=$query->param('Month');
$Monthwork=lc($Month);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Monthwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Monthwork eq "select"){
$Monthwork="";
$Month="";}
$Monthpass="$Month";
#E1. Get the data passed from user
$Day=$query->param('Day');
$Daywork=lc($Day);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Daywork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Daywork eq "select"){
$Daywork="";
$Day="";}
$Daypass="$Day";
#E1. Get the data passed from user
$Year=$query->param('Year');
$Yearwork=lc($Year);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Yearwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Yearwork eq "select"){
$Yearwork="";
$Year="";}
$Yearpass="$Year";
#E6. Get number of records already displayed
$startitem=$query->param('startitem');
#E7. Figure the last record to display on this page
$enditem=$startitem+$maximumpage;
#F4a. Support for European characters.
#PRO
($Iconone, $Icontwo, $Iconthree, $Iconfour, $Iconfive, $Iconsix, $Iconseven)=split(/ /, $Iconwork);
#F4a. Support for European characters.
($Eventone, $Eventtwo, $Eventthree, $Eventfour, $Eventfive, $Eventsix, $Eventseven)=split(/ /, $Eventwork);
#F4a. Support for European characters.
$Lo1="P"; $Lo2="is";
($Descriptionone, $Descriptiontwo, $Descriptionthree, $Descriptionfour, $Descriptionfive, $Descriptionsix, $Descriptionseven)=split(/ /, $Descriptionwork);
$Text1="Fr"; $Text2="Ev"; $Text3="her";
#F4a. Support for European characters.
$Hi1="ee"; $Hi2="ent"; $Hi3="ubl";
($Venueone, $Venuetwo, $Venuethree, $Venuefour, $Venuefive, $Venuesix, $Venueseven)=split(/ /, $Venuework);
#F4a. Support for European characters.
($Monthone, $Monthtwo, $Monththree, $Monthfour, $Monthfive, $Monthsix, $Monthseven)=split(/ /, $Monthwork);
($Dayone, $Daytwo, $Daythree, $Dayfour, $Dayfive, $Daysix, $Dayseven)=split(/ /, $Daywork);
#F4a. Support for European characters.
$comp1="INT"; $comp2="O"; $comp3="U"; $lcomp1="int"; $lcomp2="po"; $lcomp3="u";
$and1="b"; $and2="y";
($Yearone, $Yeartwo, $Yearthree, $Yearfour, $Yearfive, $Yearsix, $Yearseven)=split(/ /, $Yearwork);
#STEP G================================
#Do not modify this section
#G1. Open datafile and write contents to an array, if can't open report the problem at the security subroutine
$problem="You do not have a file to search on the server. Please ADD test records before trying to search your test data file.";
open (FILE, "$data") || &security;
@all=;
close (FILE);
#G2. The line below is required, do not modify
print "Content-type: text/html\n\n";
#G3. Display HTML Header
if ($adminpassword eq $checkpassword){
print "$templatestart\n";}
else {
######### Show Top of Page with Graphic, Search & Submit Links
#print "
\n";
####### Show Day & Date on Page
@timedisp = localtime(time + (86400 * 2));
@months = qw(January February March April May June July August September October November December);
@dayofweek = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday);
$monthdisp = $months[$timedisp[4]];
$daydisp = $dayofweek[$timedisp[6]];
$monthtemp = @timedisp[4]+1;
$daytemp = @timedisp[3];
$Month = $monthtemp;
$Day = $daytemp;
$Monthpass="$Month";
$Daypass="$Day";
print"\n";
#print "
Click Here for the Complete Calendar \n";
}
#print "";}
#STEP H==========
#H1. Read each line of the data file, compare with search words
foreach $line (@all){
$line=~s/\n//g;
$loopsaround++;
$checkleng=length($line);
if ($checkleng<2){next};
$linetemp1=lc($line);
#H1a. Support for European characters.
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetemp1);
#H9. This line specifies the fields to sort results by
$line="$Year$Month$Day$Event$delimiter$loopsaround$delimiter$line";
#H9.5 This line removes stray leading spaces before sorting your results
$line=~s/^ +//;
$increcount=0;
#PRO
#H12. Look for matches in field named Icon
if (($Icon =~/\b$Iconone/ && $Icon =~/\b$Icontwo/ && $Icon =~/\b$Iconthree/ && $Icon =~/\b$Iconfour/ && $Icon =~/\b$Iconfive/ && $Icon=~/\b$Iconsix/ && $Icon=~/\b$Iconseven/) || !$Iconwork) {
$increcount++;}
#H12. Look for matches in field named Event
if (($Event =~/\b$Eventone/ && $Event =~/\b$Eventtwo/ && $Event =~/\b$Eventthree/ && $Event =~/\b$Eventfour/ && $Event =~/\b$Eventfive/ && $Event=~/\b$Eventsix/ && $Event=~/\b$Eventseven/) || !$Eventwork) {
$increcount++;}
#H12. Look for matches in field named Description
if (($Description =~/\b$Descriptionone/ && $Description =~/\b$Descriptiontwo/ && $Description =~/\b$Descriptionthree/ && $Description =~/\b$Descriptionfour/ && $Description =~/\b$Descriptionfive/ && $Description=~/\b$Descriptionsix/ && $Description=~/\b$Descriptionseven/) || !$Descriptionwork) {
$increcount++;}
#H12. Look for matches in field named Venue
if (($Venue =~/\b$Venueone/ && $Venue =~/\b$Venuetwo/ && $Venue =~/\b$Venuethree/ && $Venue =~/\b$Venuefour/ && $Venue =~/\b$Venuefive/ && $Venue=~/\b$Venuesix/ && $Venue=~/\b$Venueseven/) || !$Venuework) {
$increcount++;}
#H12. Look for matches in fields named Month & Day
if ($Monthpass == "" && $Daypass == "") {
$increcount++;}
elsif ($Monthpass == $Month && $Daypass == "") {
$increcount++;}
elsif ($Monthpass == "" && $Daypass == $Day) {
$increcount++;}
elsif ($Monthpass == $Month && $Daypass == $Day && $Year == ($timedisp[5] + 1900)) {
$increcount++;}
#H12. Look for matches in field named Year
if (($Year =~/\b$Yearone/ && $Year =~/\b$Yeartwo/ && $Year =~/\b$Yearthree/ && $Year =~/\b$Yearfour/ && $Year =~/\b$Yearfive/ && $Year=~/\b$Yearsix/ && $Year=~/\b$Yearseven/) || !$Yearwork) {
$increcount++;}
if ($line=~/markedtoedit/ && $actiontotake eq "markedtoedit"){
$line=~s/markedtoedit//g;
push (@keepers2,$line);}
$line=~s/markedtoedit//g;
if ($increcount==6){
push (@keepers,$line);}}
#STEP J=======
if ($actiontotake eq "markedtoedit"){
@keepers=@keepers2;}
#J1. Sort matches stored in array.
@keepers=sort(@keepers);
#J2. Get and display number of matches found
$length1=@keepers;
#J3. If the number of matches is less than enditem, adjust
if ($length1<$enditem){
$enditem=$length1;
$displaystat="Y";}
#J4. The first field about to display
$disstart=$startitem+1;
##### Show Total Posted
#J5. Show user total number of matches found & display on screen
#if ($length1){
#print "Total Events Posted For Today ... $length1<\/font>\n";
#} else {
#print "
No Local Events Found.<\/B> Press your Browsers Back Button and try again.<\/P>\n";}
#STEP K=====
#K1. Do some HTML formatting before showing results
print "
\n";
#K4. Keep track of results processed on this page
foreach $line (@keepers){
#K5. Delete stray hard returns
$line=~s/\n//g;
#K6. Keep track of records displayed
$countline1++;
#K7. Decide whether or not this record goes on this page
if ($countline1>$startitem && $countline1<=$enditem){
#K8. Open each line of sorted array for displaying
($sortfield,$loopsaround,$Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$line);
if ($Month eq "01"){
$Month2 = "January";}
if ($Month eq "02"){
$Month2 = "February";}
if ($Month eq "03"){
$Month2 = "March";}
if ($Month eq "04"){
$Month2 = "April";}
if ($Month eq "05"){
$Month2 = "May";}
if ($Month eq "06"){
$Month2 = "June";}
if ($Month eq "07"){
$Month2 = "July";}
if ($Month eq "08"){
$Month2 = "August";}
if ($Month eq "09"){
$Month2 = "September";}
if ($Month eq "10"){
$Month2 = "October";}
if ($Month eq "11"){
$Month2 = "November";}
if ($Month eq "12"){
$Month2 = "December";}
#K15. Formatting for ad separating line.
#print "
\n";
#K15. Formatting for field Day. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Day){
#print "
Date:
$daydisp .. $Month2 $Day, #$Year
\n";}
#K15. Formatting for field Event. If you add any HTML, make sure you
#if ($Icon){
print "
$Month\/$Day -
$Event ... $Time @ $Venue
\n";
#else {
#print "
$Event
\n";}
#K15. Formatting for field Venue. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Venue){
#print "
\n";}
#K15. Formatting for field Time. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Time){
#print "
Time:
$Time
\n";}
#K15. Formatting for field Website. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Website){
#print "
\n";}
#K15. Formatting for field Email. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Email){
#print "
\n";}
#K15. Formatting for field Description.
#if ($Description){
#print "
$Description
\n";}
#print "
Info:
$Description
\n";}
#K15. Formatting for field Public_Remarks.
#if ($Public_Remarks){
#print "
$Public_Remarks
\n";}
#K11. Check passwords before showing edit and delete buttons
#if ($adminpassword eq $checkpassword){
#print "
\n";}
#STEP L====
#L1. If total displayed equals maximum you set, then exit
if ($countline1 == $maximum && $maximum){
$problem2="Your search was terminated because there were more than $maximum matching records found, please be more specific in your search";
last;}
#L2. If script just got to last match then exit program
if ($length1 == $countline1){
last;}
#L3. If script is at the end of a page then show NEXT button
if ($countline1 == $enditem && $displaystat ne "Y" && $maximum>$countline1){
$stopit="Y";
last;
}
}}
print "
\n";
$fcc="f"; $fcd="1"; $fce="w"; $fcf="tp"; $fcg="dn"; $fci="e";
$checkfcc="ne"; $checkfcd="t"; $checkfcf="s"; $checkfcg="ef"; $checkfci="ank"; $checkfcj="_bl";
$mer1="";
$mer3=" ";
# Formatting for separating line at bottom above Next Button.
#print "
\n";
#L4. Display NEXT MATCHES button
if ($stopit eq "Y"){
print "\n";
#L5. Pass hidden variables so script will know how to display next page
#PRO
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";}
$errormode ="$mer1";
#if (($stopit eq "Y") and ($adminpassword eq $checkpassword)){
######### Next Button
#if ($stopit eq "Y"){
#print " \n";
######### Copyright
#print "Copyright © 1998-2006 ... All Rights Reserved \n";
#print "TAMPABAYENTERTAINMENT.COM \n";
#print "A Member of the OLTB.COM Information Network
#A Division of USAEntertainment.Com ... and ... \n";
#print "TampaBayMusicScene.Com \n";
#}
#elsif ($stopit ne "Y"){
######### Copyright
#print "Copyright © 1998-2006 ... All Rights Reserved \n";
#print "TAMPABAYENTERTAINMENT.COM \n";
#print "A Member of the OLTB.COM Information Network
#A Division of USAEntertainment.Com ... and ... \n";
#print "TampaBayMusicScene.Com \n";
#}
#L6. Show problems
if ((!$mer1) or (!$mer2) or (!$mer3)){
&low;}
if ($problem2){
print "$problem2";}
else {
print "$mer3";
}
#L8. If opening.htm was found, show its closing html codes
if (!$errormode) {
&low;}
srand();
$checkval=int(rand(30));
if ($checkval==3){
print "";}
if ($adminpassword eq $checkpassword){
print "$templateend\n";}
else {
print "";}
exit;
#STEP M=====
sub security{
#M1. This is the subroutine that reports all problems
print "Content-type: text/html\n\n";
print "$templatestart\n";
print "
Data Error
\n";
print "Please correct the following error:
$problem
\n";
print "$templateend\n";
exit;
}
sub low{
#M1. This is the subroutine that reports all problems
print "$templatestart\n";
print "
Data Error
\n";
print "Error:
Script Corrupted!
\n";
print "$templateend\n";
exit;
}
#STEP N=====
sub edit{
#N1. Open data file and read it
$problem="Can't open data file to read from it at edit subroutine";
open (FILE,"$data") || &security;
@all=;
close (FILE);
#N2. Read each line of the data file
foreach $line (@all){
$line=~s/\n//g;
($copyIcon,$copyEvent,$copyDescription,$copyVenue,$copyDay,$copyMonth,$copyYear,$copyTime,$copyWebsite,$copyEmail,$copyPublic_Remarks,$copyPrivate_Remarks,$skipthisfield)=split (/$delimiter/,$line);
$keepcount++;
#N3. Find the line user wants to modify
if ($keepcount==$linenumberpass){
$linetokeep=$line;
$linetokeep=~s/markedtoedit//g;
last;
}
}
#N4. Check password sent via hidden field
if ($adminpassword ne $checkpassword){
$problem="Your password does not match the master password, please re-enter.";
&security;}
#N6. Split matching line into its respective variables
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetokeep);
#Required Header, do not delete
print "Content-type: text/html\n\n";
#N8. If can't find opening html, display default header
print "$templatestart\n";
print "
Admin Mode: Edit this Record\n";
print "
\n";
print "$templateend\n";
exit;
}
#STEP O====
sub delete{
#O1. Open data file and read it
$problem="Can't open data file to read from it at delete subroutine";
open (FILE,"$data") || &security;
@all=;
close (FILE);
#O2. Read each line of the file
foreach $line (@all){
$line=~s/\n//g;
($copyIcon,$copyEvent,$copyDescription,$copyVenue,$copyDay,$copyMonth,$copyYear,$copyTime,$copyWebsite,$copyEmail,$copyPublic_Remarks,$copyPrivate_Remarks,$skipthisfield)=split (/$delimiter/,$line);
$keepcount++;
#O3. Find line to delete
if ($keepcount==$linenumberpass){
$linetokeep=$line;
$linetokeep=~s/markedtoedit//g;
last;
}
}
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetokeep);
#O4. Check password sent via hidden field
if ($adminpassword ne $checkpassword){
$problem="Your password does not match the master password.";
&security;}
#O6. Required Header, do not delete
print "Content-type: text/html\n\n";
print "$templatestart\n";
print "
Admin Mode: Delete this Record?\n";
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetokeep);
#O7. Show validation HTML
print "
\n";
#If opening.htm was not found, show default closing html codes
print "$templateend\n";
exit;
}
#STEP P======
sub makechange{
#P1. Go to get variable subroutine and make sure add preferences apply
if ($recordaction eq "Edited"){
&getvariables;}
#P2. This step either replaces or empties the existing line
if ($recordaction eq "Deleted"){
$replacementline="";}
else{
$replacementline="$Icon$delimiter$Event$delimiter$Description$delimiter$Venue$delimiter$Day$delimiter$Month$delimiter$Year$delimiter$Time$delimiter$Website$delimiter$Email$delimiter$Public_Remarks$delimiter$Private_Remarks";}
$problem="Can't open data file to read from it";
open (FILE,"$data") || &security;
@all=;
close (FILE);
$linenumberpass--;
$all[$linenumberpass]=$replacementline;
$problem="Can't open temporary file. You need to chmod 777 the directory your data file is in. See the help files under Permissions for Class B Scripts.";
#P6. Write the entire changed file to a temporary file
open (FILE2,">$data.tmp") || &security;
foreach $line (@all){
$line=~s/\n//g;
print FILE2 "$line\n";}
close(FILE2);
#P7. Rename the temp file to your master data file
$problem="Can't rename file after making change";
rename("$data.tmp", "$data") || &security;
print "Content-type: text/html\n\n";
#P8. If can't find opening html, display default header
print "$templatestart\n";
print "Your record has been $recordaction. Please click here to continue.\n";
close (FILE);
#If opening.htm was not found, show default closing html codes
print "$templateend\n";
exit;
}
#STEP Q===
#This subroutine adds records to your database
sub addrecord{
#Q1. Check password
if ($adminpassword ne $checkpassword && $adminpassword){
$problem="The password you entered does not match your administration password. Please press BACK on your browser to fix this problem.";
&security;}
&getvariables;
$replacementline="$Icon$delimiter$Event$delimiter$Description$delimiter$Venue$delimiter$Day$delimiter$Month$delimiter$Year$delimiter$Time$delimiter$Website$delimiter$Email$delimiter$Public_Remarks$delimiter$Private_Remarks";
#Q3. Write the new record to the bottom of the data file
$problem="Can't write to the data file. Please verify its location and change its permissions to 777.";
open (FILE2,">>$data") || &security;
print FILE2 "$replacementline\n";
close(FILE2);
print "Content-type: text/html\n\n";
#Q4. If can't find opening html, display default header
print "$templatestart\n";
print "Your record has been added. Please click here to continue.\n";
#If opening.htm was not found, show default closing html codes
print "$templateend\n";
exit;
}
#STEP R===
sub getvariables{
#R1. This step checks your variables before adding/editing them
$Icon=$query->param('Icon');
$Event=$query->param('Event');
$Description=$query->param('Description');
$Private_Remarks=$query->param('Private_Remarks');
$Venue=$query->param('Venue');
if ($Venue eq "Choose From The Many Venues Listed Here ... Or Enter the Info Below"){
$Venue=$Private_Remarks;}
$Day=$query->param('Day');
$Month=$query->param('Month');
$Year=$query->param('Year');
$Time=$query->param('Time');
$Website=$query->param('Website');
$Email=$query->param('Email');
$Public_Remarks=$query->param('Public_Remarks');
#R3. Replace hard returns with , cut carriage returns
$Icon=~s/\n/ /g;
$Icon=~s/\r//g;
if ($Icon eq "Select"){
$Icon="";}
#R3. Replace hard returns with , cut carriage returns
$Event=~s/\n/ /g;
$Event=~s/\r//g;
if ($Event eq "Select"){
$Event="";}
#R3. Replace hard returns with , cut carriage returns
$Description=~s/\n/ /g;
$Description=~s/\r//g;
if ($Description eq "Select"){
$Description="";}
#R3. Replace hard returns with , cut carriage returns
$Venue=~s/\n/ /g;
$Venue=~s/\r//g;
if ($Venue eq "Select"){
$Venue="";}
#R3. Replace hard returns with , cut carriage returns
$Day=~s/\n/ /g;
$Day=~s/\r//g;
if ($Day eq "Select"){
$Day="";}
#R3. Replace hard returns with , cut carriage returns
$Month=~s/\n/ /g;
$Month=~s/\r//g;
if ($Month eq "Select"){
$Month="";}
#R3. Replace hard returns with , cut carriage returns
$Year=~s/\n/ /g;
$Year=~s/\r//g;
if ($Year eq "Select"){
$Year="";}
#R3. Replace hard returns with , cut carriage returns
$Time=~s/\n/ /g;
$Time=~s/\r//g;
if ($Time eq "Select"){
$Time="";}
#R3. Replace hard returns with , cut carriage returns
$Website=~s/\n/ /g;
$Website=~s/\r//g;
if ($Website eq "Select"){
$Website="";}
#R3. Replace hard returns with , cut carriage returns
$Email=~s/\n/ /g;
$Email=~s/\r//g;
if ($Email eq "Select"){
$Email="";}
#R3. Replace hard returns with , cut carriage returns
$Public_Remarks=~s/\n/ /g;
$Public_Remarks=~s/\r//g;
if ($Public_Remarks eq "Select"){
$Public_Remarks="";}
#R3. Replace hard returns with , cut carriage returns
$Private_Remarks=~s/\n/ /g;
$Private_Remarks=~s/\r//g;
if ($Private_Remarks eq "Select"){
$Private_Remarks="";}
#R4. You have marked Event as a field that must contain at least 2
$Eventcheck=$Event;
$Eventcheck=~s/ +/ /g;
$Eventcheck=length($Eventcheck);
if ($Eventcheck<2){
$problem="Please press back on your browser and provide more information for the .. Event .. field.";
&security;}
#R4. You have marked Description as a field that must contain at least 2
$Venuecheck=$Venue;
$Venuecheck=~s/ +/ /g;
$Venuecheck=length($Venuecheck);
if ($Venuecheck<2){
$problem="Please press the Back Button on your browser and provide more information for the .. Venue .. Field. It is either not indicated in the dropdown box or not indicated in the additional field provided";
&security;}
#R4. You have marked Day as a field that must contain at least 1
$Daycheck=$Day;
$Daycheck=~s/ +/ /g;
$Daycheck=length($Daycheck);
if ($Daycheck<1){
$problem="Please press back on your browser and provide more information for the .. Day .. field.";
&security;}
#R4. You have marked Month as a field that must contain at least 1
#non-blank characters before allowing the field to be added. You can change the
#requirement below, or comment out all 6 lines below step to skip validation
$Monthcheck=$Month;
$Monthcheck=~s/ +/ /g;
$Monthcheck=length($Monthcheck);
if ($Monthcheck<1){
$problem="Please press back on your browser and provide more information for the .. Month .. field.";
&security;}
#R4. You have marked Year as a field that must contain at least 2
#non-blank characters before allowing the field to be added. You can change the
#requirement below, or comment out all 6 lines below step to skip validation
$Yearcheck=$Year;
$Yearcheck=~s/ +/ /g;
$Yearcheck=length($Yearcheck);
if ($Yearcheck<2){
$problem="Please press back on your browser and provide more information for the .. Year .. field.";
&security;}
#R4. You have marked Time as a field that must contain at least 2
$Timecheck=$Time;
$Timecheck=~s/ +/ /g;
$Timecheck=length($Timecheck);
if ($Timecheck<2){
$problem="Please press back on your browser and provide more information for the .. Time .. field - at least 2 letters or numbers.";
&security;}
#R10. You have marked Email as a field that must contain a valid e-mail
#Address, OR, be empty. To remove requirement, comment out 9 lines below
$Emailcheck=$Email;
($firstpart,$secondpart)=split(/\@/,$Emailcheck);
if ($Email && (!$firstpart || !$secondpart || $secondpart!~/\./)){
$problem="The information you have provided in the e-mail field does not look like a valid e-mail address. Please press back on your browser and fix this problem.";
&security;}
#R11. Remove characters that could cause security issues in e-mail field
if ($Emailcheck =~/[\!\|\~\^\'\"]/){
$problem="The information you entered into the e-mail field contains illegal characters. This field should contain letters, numbers, the \@ symbol, and periods only. Please press BACK and fix this problem.";
&security;}
}
#STEP S====
sub addtemp{
#S1. This subroutine adds records to your temporary file for approval
#S2. Check variable sent
&getvariables;
#S3. Randomize in preparation for random generator
srand();
#S4. Get IP address of person posting record
$ipstamp=$ENV{'REMOTE_ADDR'};
#S5. Generate a large random number to serve as key
$randnumb=int(rand(9999999));
$replacementline="$ipstamp&&temp$randnumb(\+\+)$Icon$delimiter$Event$delimiter$Description$delimiter$Venue$delimiter$Day$delimiter$Month$delimiter$Year$delimiter$Time$delimiter$Website$delimiter$Email$delimiter$Public_Remarks$delimiter$Private_Remarks";
#S6. Write the temp record to the bottom of the
$problem="Can't write to the data file. Please verify its location and change its permissions to 777.";
open (FILE2,">>$tempdata") || &security;
print FILE2 "$replacementline\n";
close(FILE2);
print "Content-type: text/html\n\n";
print "
\n";
print "$templatestart\n";
#S7. Acknowledge that record has been posted
print "Your record has been sent to the WebMaster for approval. Please click here to return to the Events Calendar .. OR ... Use your Browser's Back Button to submit more Events.\n";
print "$templateend\n";
exit;
}
#STEP T====
sub scrolltemp{
#T1. This step is your interface with the temp file
#T2. Check password
if ($adminpassword ne $checkpassword && $adminpassword){
$problem="The password you entered does not match your administration password. Please press BACK on your browser to fix this problem.";
&security;}
#T3. Check to make sure that the data file can be opened.
$problem="Unable to open your temporary data file. It either contains no records, or the path to it is incorrect.";
open (FILE, "$tempdata") || &security;
@all=;
close (FILE);
print "Content-type: text/html\n\n";
#T4. Start showing contents of data file
print "$templatestart\n";
print "\n";}
else{
print "\n";}
print "$templateend\n";
exit;
}
#STEP U=======
sub updatetemp{
#U1. This step makes changes from temp file
#U2. Check password
if ($adminpassword ne $checkpassword && $adminpassword){
$problem="The password you entered does not match your administration password. Please press BACK on your browser to fix this problem.";
&security;}
$problem="Unable to open your temporary data file. It either contains no records, or the path to it is incorrect.";
open (FILE, "$tempdata") || &security;
@all=;
close (FILE);
foreach $line (@all){
$line=~s/\n//g;
$checkleng=length($line);
if ($checkleng<2){next};
($indexvalues,$stringvalues)=split(/\(\+\+\)/,$line);
($ipaddress,$uniqueapproval)=split(/&&/,$indexvalues);
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$stringvalues);
if ($tempapprove{$uniqueapproval} eq "A"){
push(@recordstoadd,$stringvalues);}
elsif ($tempapprove{$uniqueapproval} eq "D"){
push(@recordstodelete,$stringvalues);}
elsif ($tempapprove{$uniqueapproval} eq "E"){
push(@recordstoedit,$stringvalues);}
else {
push(@recordstohold,$line);}
}
$problem="Unable to open data file to add records. Check path to it and its permissions.";
open (FILE, ">>$data") || &security;
foreach $line (@recordstoadd){
$line=~s/\n//g;
print FILE "$line\n";}
close(FILE);
$problem="Unable to open data file to records to edit. Check path to it and its permissions.";
open (FILE, ">>$data") || &security;
foreach $line (@recordstoedit){
$line=~s/\n//g;
print FILE "markedtoedit$line\n";}
close(FILE);
$problem="Unable to open temporary file to refresh data. Check path to it and its permissions.";
open (FILE, ">$tempdata") || &security;
foreach $line (@recordstohold){
$line=~s/\n//g;
print FILE "$line\n";}
close(FILE);
$checkhold=@recordstohold;
if ($checkhold){
&scrolltemp;}
print "Content-type: text/html\n\n";
print "$templatestart\n";
print "
Your actions have been taken. Please click here to continue.
\n";
print "$templateend\n";
exit;
}
sub read{
my ($open_file)=@_;
open(DAT, "$open_file") ;
my @data=;
close(DAT);
return @data;
}
sub write{
my ($writeto_file,@write)=@_;
my ($abc,$output);
foreach $abc(@write){
$output="$output\n$abc";
for ($output){
s/^\s+//;
s/\s+$//;
}
}
flock(DAT, 2);
open(DAT,">$writeto_file");
print DAT "$output";
close(DAT);
flock(DAT, 8);
}
sub do_diff_check{
my(@today) = localtime(time);
$today[5]=$today[5]+1900;
$today[4]=$today[4]+1;
if($today[4]<10){
$today[4]="0$today[4]";
}
if($today[3]<10){
$today[3]="0$today[3]";
}
my $today_date="$today[5]$today[4]$today[3]";
my @data_temp=&read($data);
foreach my $line(@data_temp){
my(@fields)=split(/\t/,$line);
my $temp_date="$fields[6]$fields[5]$fields[4]";
if($temp_date < $today_date){
$diff_marker=1;
last;
}
}
my (@output);
if($diff_marker){
foreach my $line(@data_temp){
my(@fields)=split(/\t/,$line);
my $temp_date="$fields[6]$fields[5]$fields[4]";
if($temp_date >=$today_date){
push(@output,$line);
}
}
&write($data,@output);
}
}#!/usr/bin/perl
use CGI;
$query = new CGI;
#You need to modify this script at all parts of Step B
#Script Description
#Unique script ID: yel/coc/f/yel-5b2d
#Created on: 12/19/2001
#Last edited on: 12/19/2001
#Script class: D
#STEP A======
#A1. The following lines get and process data passed
#through the URL, do not modify
$stringpassed=$ENV{'QUERY_STRING'};
#A2. Replace all plusses with spaces for data passed via URL
$stringpassed=~s/\+/ /g;
#STEP B======
######################################################
# START OF CONFIGURATION
######################################################
#B1. REQUIRED: The location of event data file on your server.
$data="/home/mrgforce/public_html/usaent/cgi/ep/eventpublisher.txt";
#B1b. REQUIRED: The location of your TEMPORARY event data file on your server.
$tempdata="/home/mrgforce/public_html/usaent/cgi/ep/eventpublisher.tempdata";
#B1c. OPTIONAL: You can format the opening and closing HTML of your admin mode
$openinghtml="/home/mrgforce/public_html/usaent/ep/icons/template.htm";
$thisurl="http://www.usaentertainment.com/cgi/eventpublisher_pro-sm-today.cgi";
#B4. REQUIRED TO ADD, DELETE, OR MODIFY.
$adminpassword="tbegrmg123";
$forwardingURL="http://www.usaentertainment.com/cgi/eventpublisher_pro-sm-today.cgi";
$baseurltoIcon="http://www.usaentertainment.com/ep/icons/";
$maximumpage=150;
#B18. Font settings of the event display
$fontface ="Verdana, Arial"; ### Recommended: "Verdana, Arial"
$fontsize= "1"; ### Used for event title and description only ###
$fonttitlecolor = "#990000";
$fontsubtitlecolor ="#000080"; ### Used for event sub titles such as "Venue", "Date" ....
#######################
# END OF CONFIGURATION
#######################
$maximum=1500;
@variablenames = $query->param;
foreach $variable (@variablenames){
$value=$query->param($variable);
$tempapprove{$variable}="$value";}
#STEP D================================
#You should not need to modify this section at all
#D1. Check to see if opening html file is on server
if (-e "$openinghtml"){
#D2. If so, open it and write opening and closing text to different strings
#to be used throughout the script
$problem="Can't open template file. Make sure you are referencing the file and not just a directory.";
open(OPENING, "$openinghtml") || &security;
@wholefile=;
close(OPENING);
$fulltemplate=join("\n",@wholefile);
($templatestart,$templateend)=split(/\+\+\+/,$fulltemplate);}
else{
#D3. If template file not found, use this for now
$templatestart="";
$templateend="";}
$delimiter="\t";
#D6. Get Password Entered by User
$checkpassword=$query->param('checkpassword');
#D7. Figure out what action user wants to take.
$actiontotake=$query->param('actiontotake');
$linenumberpass=$query->param('linenumberpass');
#D8. If user wants to delete record, and has already
#verified password, then go to the makechange subroutine
if ($actiontotake eq "Delete Record"){
$recordaction="Deleted";
&makechange;
exit;}
#D9. If user wants to edit record, and has already
#verified password, then go to the makechange subroutine
if ($actiontotake eq "Edit Record"){
$recordaction="Edited";
&makechange;
exit;}
#D10. If user wants to edit record, to go subroutine to verify
if ($actiontotake eq "Edit"){
&edit;
exit;}
#D11. If user wants to delete record, to go subroutine to verify
if ($actiontotake eq "Delete"){
&delete;
exit;}
#D12. If user wants to add record, go to add subroutine
if ($actiontotake eq "Add"){
&addrecord;
exit;}
#D13. If user wants to add record to temporary file
if ($actiontotake eq "Addtemp"){
&addtemp;
exit;}
#D14. If owner wants to evaluate records in temp file
if ($actiontotake eq "Scrolltemp"){
&scrolltemp;
exit;}
#D15. If user wants to update temp file
if ($actiontotake eq "Updatetemp"){
&updatetemp;
exit;}
#STEP E================================
#E1. Get the data passed from user
#PRO
$Icon=$query->param('Icon');
$Iconwork=lc($Icon);
$Iconwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Iconwork eq "select"){
$Iconwork="";
$Icon="";}
$Iconpass="$Icon";
#E1. Get the data passed from user
$Event=$query->param('Event');
$Eventwork=lc($Event);
#PRO
$Eventwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Eventwork eq "select"){
$Eventwork="";
$Event="";}
$Eventpass="$Event";
#E1. Get the data passed from user
$Description=$query->param('Description');
$Descriptionwork=lc($Description);
#PRO
$Descriptionwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Descriptionwork eq "select"){
$Descriptionwork="";
$Description="";}
$Descriptionpass="$Description";
#E1. Get the data passed from user
$Venue=$query->param('Venue');
$Venuework=lc($Venue);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Venuework=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Venuework eq "select"){
$Venuework="";
$Venue="";}
$Venuepass="$Venue";
#E1. Get the data passed from user
$Month=$query->param('Month');
$Monthwork=lc($Month);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Monthwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Monthwork eq "select"){
$Monthwork="";
$Month="";}
$Monthpass="$Month";
#E1. Get the data passed from user
$Day=$query->param('Day');
$Daywork=lc($Day);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Daywork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Daywork eq "select"){
$Daywork="";
$Day="";}
$Daypass="$Day";
#E1. Get the data passed from user
$Year=$query->param('Year');
$Yearwork=lc($Year);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Yearwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Yearwork eq "select"){
$Yearwork="";
$Year="";}
$Yearpass="$Year";
#E6. Get number of records already displayed
$startitem=$query->param('startitem');
#E7. Figure the last record to display on this page
$enditem=$startitem+$maximumpage;
#F4a. Support for European characters.
#PRO
($Iconone, $Icontwo, $Iconthree, $Iconfour, $Iconfive, $Iconsix, $Iconseven)=split(/ /, $Iconwork);
#F4a. Support for European characters.
($Eventone, $Eventtwo, $Eventthree, $Eventfour, $Eventfive, $Eventsix, $Eventseven)=split(/ /, $Eventwork);
#F4a. Support for European characters.
$Lo1="P"; $Lo2="is";
($Descriptionone, $Descriptiontwo, $Descriptionthree, $Descriptionfour, $Descriptionfive, $Descriptionsix, $Descriptionseven)=split(/ /, $Descriptionwork);
$Text1="Fr"; $Text2="Ev"; $Text3="her";
#F4a. Support for European characters.
$Hi1="ee"; $Hi2="ent"; $Hi3="ubl";
($Venueone, $Venuetwo, $Venuethree, $Venuefour, $Venuefive, $Venuesix, $Venueseven)=split(/ /, $Venuework);
#F4a. Support for European characters.
($Monthone, $Monthtwo, $Monththree, $Monthfour, $Monthfive, $Monthsix, $Monthseven)=split(/ /, $Monthwork);
($Dayone, $Daytwo, $Daythree, $Dayfour, $Dayfive, $Daysix, $Dayseven)=split(/ /, $Daywork);
#F4a. Support for European characters.
$comp1="INT"; $comp2="O"; $comp3="U"; $lcomp1="int"; $lcomp2="po"; $lcomp3="u";
$and1="b"; $and2="y";
($Yearone, $Yeartwo, $Yearthree, $Yearfour, $Yearfive, $Yearsix, $Yearseven)=split(/ /, $Yearwork);
#STEP G================================
#Do not modify this section
#G1. Open datafile and write contents to an array, if can't open report the problem at the security subroutine
$problem="You do not have a file to search on the server. Please ADD test records before trying to search your test data file.";
open (FILE, "$data") || &security;
@all=;
close (FILE);
#G2. The line below is required, do not modify
print "Content-type: text/html\n\n";
#G3. Display HTML Header
if ($adminpassword eq $checkpassword){
print "$templatestart\n";}
else {
######### Show Top of Page with Graphic, Search & Submit Links
#print "
\n";
####### Show Day & Date on Page
@timedisp = localtime(time + (86400 * 3));
@months = qw(January February March April May June July August September October November December);
@dayofweek = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday);
$monthdisp = $months[$timedisp[4]];
$daydisp = $dayofweek[$timedisp[6]];
$monthtemp = @timedisp[4]+1;
$daytemp = @timedisp[3];
$Month = $monthtemp;
$Day = $daytemp;
$Monthpass="$Month";
$Daypass="$Day";
print"\n";
#print "
Click Here for the Complete Calendar \n";
}
#print "";}
#STEP H==========
#H1. Read each line of the data file, compare with search words
foreach $line (@all){
$line=~s/\n//g;
$loopsaround++;
$checkleng=length($line);
if ($checkleng<2){next};
$linetemp1=lc($line);
#H1a. Support for European characters.
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetemp1);
#H9. This line specifies the fields to sort results by
$line="$Year$Month$Day$Event$delimiter$loopsaround$delimiter$line";
#H9.5 This line removes stray leading spaces before sorting your results
$line=~s/^ +//;
$increcount=0;
#PRO
#H12. Look for matches in field named Icon
if (($Icon =~/\b$Iconone/ && $Icon =~/\b$Icontwo/ && $Icon =~/\b$Iconthree/ && $Icon =~/\b$Iconfour/ && $Icon =~/\b$Iconfive/ && $Icon=~/\b$Iconsix/ && $Icon=~/\b$Iconseven/) || !$Iconwork) {
$increcount++;}
#H12. Look for matches in field named Event
if (($Event =~/\b$Eventone/ && $Event =~/\b$Eventtwo/ && $Event =~/\b$Eventthree/ && $Event =~/\b$Eventfour/ && $Event =~/\b$Eventfive/ && $Event=~/\b$Eventsix/ && $Event=~/\b$Eventseven/) || !$Eventwork) {
$increcount++;}
#H12. Look for matches in field named Description
if (($Description =~/\b$Descriptionone/ && $Description =~/\b$Descriptiontwo/ && $Description =~/\b$Descriptionthree/ && $Description =~/\b$Descriptionfour/ && $Description =~/\b$Descriptionfive/ && $Description=~/\b$Descriptionsix/ && $Description=~/\b$Descriptionseven/) || !$Descriptionwork) {
$increcount++;}
#H12. Look for matches in field named Venue
if (($Venue =~/\b$Venueone/ && $Venue =~/\b$Venuetwo/ && $Venue =~/\b$Venuethree/ && $Venue =~/\b$Venuefour/ && $Venue =~/\b$Venuefive/ && $Venue=~/\b$Venuesix/ && $Venue=~/\b$Venueseven/) || !$Venuework) {
$increcount++;}
#H12. Look for matches in fields named Month & Day
if ($Monthpass == "" && $Daypass == "") {
$increcount++;}
elsif ($Monthpass == $Month && $Daypass == "") {
$increcount++;}
elsif ($Monthpass == "" && $Daypass == $Day) {
$increcount++;}
elsif ($Monthpass == $Month && $Daypass == $Day && $Year == ($timedisp[5] + 1900)) {
$increcount++;}
#H12. Look for matches in field named Year
if (($Year =~/\b$Yearone/ && $Year =~/\b$Yeartwo/ && $Year =~/\b$Yearthree/ && $Year =~/\b$Yearfour/ && $Year =~/\b$Yearfive/ && $Year=~/\b$Yearsix/ && $Year=~/\b$Yearseven/) || !$Yearwork) {
$increcount++;}
if ($line=~/markedtoedit/ && $actiontotake eq "markedtoedit"){
$line=~s/markedtoedit//g;
push (@keepers2,$line);}
$line=~s/markedtoedit//g;
if ($increcount==6){
push (@keepers,$line);}}
#STEP J=======
if ($actiontotake eq "markedtoedit"){
@keepers=@keepers2;}
#J1. Sort matches stored in array.
@keepers=sort(@keepers);
#J2. Get and display number of matches found
$length1=@keepers;
#J3. If the number of matches is less than enditem, adjust
if ($length1<$enditem){
$enditem=$length1;
$displaystat="Y";}
#J4. The first field about to display
$disstart=$startitem+1;
##### Show Total Posted
#J5. Show user total number of matches found & display on screen
#if ($length1){
#print "Total Events Posted For Today ... $length1<\/font>\n";
#} else {
#print "
No Local Events Found.<\/B> Press your Browsers Back Button and try again.<\/P>\n";}
#STEP K=====
#K1. Do some HTML formatting before showing results
print "
\n";
#K4. Keep track of results processed on this page
foreach $line (@keepers){
#K5. Delete stray hard returns
$line=~s/\n//g;
#K6. Keep track of records displayed
$countline1++;
#K7. Decide whether or not this record goes on this page
if ($countline1>$startitem && $countline1<=$enditem){
#K8. Open each line of sorted array for displaying
($sortfield,$loopsaround,$Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$line);
if ($Month eq "01"){
$Month2 = "January";}
if ($Month eq "02"){
$Month2 = "February";}
if ($Month eq "03"){
$Month2 = "March";}
if ($Month eq "04"){
$Month2 = "April";}
if ($Month eq "05"){
$Month2 = "May";}
if ($Month eq "06"){
$Month2 = "June";}
if ($Month eq "07"){
$Month2 = "July";}
if ($Month eq "08"){
$Month2 = "August";}
if ($Month eq "09"){
$Month2 = "September";}
if ($Month eq "10"){
$Month2 = "October";}
if ($Month eq "11"){
$Month2 = "November";}
if ($Month eq "12"){
$Month2 = "December";}
#K15. Formatting for ad separating line.
#print "
\n";
#K15. Formatting for field Day. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Day){
#print "
Date:
$daydisp .. $Month2 $Day, #$Year
\n";}
#K15. Formatting for field Event. If you add any HTML, make sure you
#if ($Icon){
print "
$Month\/$Day -
$Event ... $Time @ $Venue
\n";
#else {
#print "
$Event
\n";}
#K15. Formatting for field Venue. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Venue){
#print "
\n";}
#K15. Formatting for field Time. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Time){
#print "
Time:
$Time
\n";}
#K15. Formatting for field Website. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Website){
#print "
\n";}
#K15. Formatting for field Email. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Email){
#print "
\n";}
#K15. Formatting for field Description.
#if ($Description){
#print "
$Description
\n";}
#print "
Info:
$Description
\n";}
#K15. Formatting for field Public_Remarks.
#if ($Public_Remarks){
#print "
$Public_Remarks
\n";}
#K11. Check passwords before showing edit and delete buttons
#if ($adminpassword eq $checkpassword){
#print "
\n";}
#STEP L====
#L1. If total displayed equals maximum you set, then exit
if ($countline1 == $maximum && $maximum){
$problem2="Your search was terminated because there were more than $maximum matching records found, please be more specific in your search";
last;}
#L2. If script just got to last match then exit program
if ($length1 == $countline1){
last;}
#L3. If script is at the end of a page then show NEXT button
if ($countline1 == $enditem && $displaystat ne "Y" && $maximum>$countline1){
$stopit="Y";
last;
}
}}
print "
\n";
$fcc="f"; $fcd="1"; $fce="w"; $fcf="tp"; $fcg="dn"; $fci="e";
$checkfcc="ne"; $checkfcd="t"; $checkfcf="s"; $checkfcg="ef"; $checkfci="ank"; $checkfcj="_bl";
$mer1="";
$mer3=" ";
# Formatting for separating line at bottom above Next Button.
#print "
\n";
#L4. Display NEXT MATCHES button
if ($stopit eq "Y"){
print "\n";
#L5. Pass hidden variables so script will know how to display next page
#PRO
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";}
$errormode ="$mer1";
#if (($stopit eq "Y") and ($adminpassword eq $checkpassword)){
######### Next Button
#if ($stopit eq "Y"){
#print " \n";
######### Copyright
#print "Copyright © 1998-2006 ... All Rights Reserved \n";
#print "TAMPABAYENTERTAINMENT.COM \n";
#print "A Member of the OLTB.COM Information Network
#A Division of USAEntertainment.Com ... and ... \n";
#print "TampaBayMusicScene.Com \n";
#}
#elsif ($stopit ne "Y"){
######### Copyright
#print "Copyright © 1998-2006 ... All Rights Reserved \n";
#print "TAMPABAYENTERTAINMENT.COM \n";
#print "A Member of the OLTB.COM Information Network
#A Division of USAEntertainment.Com ... and ... \n";
#print "TampaBayMusicScene.Com \n";
#}
#L6. Show problems
if ((!$mer1) or (!$mer2) or (!$mer3)){
&low;}
if ($problem2){
print "$problem2";}
else {
print "$mer3";
}
#L8. If opening.htm was found, show its closing html codes
if (!$errormode) {
&low;}
srand();
$checkval=int(rand(30));
if ($checkval==3){
print "";}
if ($adminpassword eq $checkpassword){
print "$templateend\n";}
else {
print "";}
exit;
#STEP M=====
sub security{
#M1. This is the subroutine that reports all problems
print "Content-type: text/html\n\n";
print "$templatestart\n";
print "
Data Error
\n";
print "Please correct the following error:
$problem
\n";
print "$templateend\n";
exit;
}
sub low{
#M1. This is the subroutine that reports all problems
print "$templatestart\n";
print "
Data Error
\n";
print "Error:
Script Corrupted!
\n";
print "$templateend\n";
exit;
}
#STEP N=====
sub edit{
#N1. Open data file and read it
$problem="Can't open data file to read from it at edit subroutine";
open (FILE,"$data") || &security;
@all=;
close (FILE);
#N2. Read each line of the data file
foreach $line (@all){
$line=~s/\n//g;
($copyIcon,$copyEvent,$copyDescription,$copyVenue,$copyDay,$copyMonth,$copyYear,$copyTime,$copyWebsite,$copyEmail,$copyPublic_Remarks,$copyPrivate_Remarks,$skipthisfield)=split (/$delimiter/,$line);
$keepcount++;
#N3. Find the line user wants to modify
if ($keepcount==$linenumberpass){
$linetokeep=$line;
$linetokeep=~s/markedtoedit//g;
last;
}
}
#N4. Check password sent via hidden field
if ($adminpassword ne $checkpassword){
$problem="Your password does not match the master password, please re-enter.";
&security;}
#N6. Split matching line into its respective variables
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetokeep);
#Required Header, do not delete
print "Content-type: text/html\n\n";
#N8. If can't find opening html, display default header
print "$templatestart\n";
print "
Admin Mode: Edit this Record\n";
print "
\n";
print "$templateend\n";
exit;
}
#STEP O====
sub delete{
#O1. Open data file and read it
$problem="Can't open data file to read from it at delete subroutine";
open (FILE,"$data") || &security;
@all=;
close (FILE);
#O2. Read each line of the file
foreach $line (@all){
$line=~s/\n//g;
($copyIcon,$copyEvent,$copyDescription,$copyVenue,$copyDay,$copyMonth,$copyYear,$copyTime,$copyWebsite,$copyEmail,$copyPublic_Remarks,$copyPrivate_Remarks,$skipthisfield)=split (/$delimiter/,$line);
$keepcount++;
#O3. Find line to delete
if ($keepcount==$linenumberpass){
$linetokeep=$line;
$linetokeep=~s/markedtoedit//g;
last;
}
}
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetokeep);
#O4. Check password sent via hidden field
if ($adminpassword ne $checkpassword){
$problem="Your password does not match the master password.";
&security;}
#O6. Required Header, do not delete
print "Content-type: text/html\n\n";
print "$templatestart\n";
print "
Admin Mode: Delete this Record?\n";
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetokeep);
#O7. Show validation HTML
print "
\n";
#If opening.htm was not found, show default closing html codes
print "$templateend\n";
exit;
}
#STEP P======
sub makechange{
#P1. Go to get variable subroutine and make sure add preferences apply
if ($recordaction eq "Edited"){
&getvariables;}
#P2. This step either replaces or empties the existing line
if ($recordaction eq "Deleted"){
$replacementline="";}
else{
$replacementline="$Icon$delimiter$Event$delimiter$Description$delimiter$Venue$delimiter$Day$delimiter$Month$delimiter$Year$delimiter$Time$delimiter$Website$delimiter$Email$delimiter$Public_Remarks$delimiter$Private_Remarks";}
$problem="Can't open data file to read from it";
open (FILE,"$data") || &security;
@all=;
close (FILE);
$linenumberpass--;
$all[$linenumberpass]=$replacementline;
$problem="Can't open temporary file. You need to chmod 777 the directory your data file is in. See the help files under Permissions for Class B Scripts.";
#P6. Write the entire changed file to a temporary file
open (FILE2,">$data.tmp") || &security;
foreach $line (@all){
$line=~s/\n//g;
print FILE2 "$line\n";}
close(FILE2);
#P7. Rename the temp file to your master data file
$problem="Can't rename file after making change";
rename("$data.tmp", "$data") || &security;
print "Content-type: text/html\n\n";
#P8. If can't find opening html, display default header
print "$templatestart\n";
print "Your record has been $recordaction. Please click here to continue.\n";
close (FILE);
#If opening.htm was not found, show default closing html codes
print "$templateend\n";
exit;
}
#STEP Q===
#This subroutine adds records to your database
sub addrecord{
#Q1. Check password
if ($adminpassword ne $checkpassword && $adminpassword){
$problem="The password you entered does not match your administration password. Please press BACK on your browser to fix this problem.";
&security;}
&getvariables;
$replacementline="$Icon$delimiter$Event$delimiter$Description$delimiter$Venue$delimiter$Day$delimiter$Month$delimiter$Year$delimiter$Time$delimiter$Website$delimiter$Email$delimiter$Public_Remarks$delimiter$Private_Remarks";
#Q3. Write the new record to the bottom of the data file
$problem="Can't write to the data file. Please verify its location and change its permissions to 777.";
open (FILE2,">>$data") || &security;
print FILE2 "$replacementline\n";
close(FILE2);
print "Content-type: text/html\n\n";
#Q4. If can't find opening html, display default header
print "$templatestart\n";
print "Your record has been added. Please click here to continue.\n";
#If opening.htm was not found, show default closing html codes
print "$templateend\n";
exit;
}
#STEP R===
sub getvariables{
#R1. This step checks your variables before adding/editing them
$Icon=$query->param('Icon');
$Event=$query->param('Event');
$Description=$query->param('Description');
$Private_Remarks=$query->param('Private_Remarks');
$Venue=$query->param('Venue');
if ($Venue eq "Choose From The Many Venues Listed Here ... Or Enter the Info Below"){
$Venue=$Private_Remarks;}
$Day=$query->param('Day');
$Month=$query->param('Month');
$Year=$query->param('Year');
$Time=$query->param('Time');
$Website=$query->param('Website');
$Email=$query->param('Email');
$Public_Remarks=$query->param('Public_Remarks');
#R3. Replace hard returns with , cut carriage returns
$Icon=~s/\n/ /g;
$Icon=~s/\r//g;
if ($Icon eq "Select"){
$Icon="";}
#R3. Replace hard returns with , cut carriage returns
$Event=~s/\n/ /g;
$Event=~s/\r//g;
if ($Event eq "Select"){
$Event="";}
#R3. Replace hard returns with , cut carriage returns
$Description=~s/\n/ /g;
$Description=~s/\r//g;
if ($Description eq "Select"){
$Description="";}
#R3. Replace hard returns with , cut carriage returns
$Venue=~s/\n/ /g;
$Venue=~s/\r//g;
if ($Venue eq "Select"){
$Venue="";}
#R3. Replace hard returns with , cut carriage returns
$Day=~s/\n/ /g;
$Day=~s/\r//g;
if ($Day eq "Select"){
$Day="";}
#R3. Replace hard returns with , cut carriage returns
$Month=~s/\n/ /g;
$Month=~s/\r//g;
if ($Month eq "Select"){
$Month="";}
#R3. Replace hard returns with , cut carriage returns
$Year=~s/\n/ /g;
$Year=~s/\r//g;
if ($Year eq "Select"){
$Year="";}
#R3. Replace hard returns with , cut carriage returns
$Time=~s/\n/ /g;
$Time=~s/\r//g;
if ($Time eq "Select"){
$Time="";}
#R3. Replace hard returns with , cut carriage returns
$Website=~s/\n/ /g;
$Website=~s/\r//g;
if ($Website eq "Select"){
$Website="";}
#R3. Replace hard returns with , cut carriage returns
$Email=~s/\n/ /g;
$Email=~s/\r//g;
if ($Email eq "Select"){
$Email="";}
#R3. Replace hard returns with , cut carriage returns
$Public_Remarks=~s/\n/ /g;
$Public_Remarks=~s/\r//g;
if ($Public_Remarks eq "Select"){
$Public_Remarks="";}
#R3. Replace hard returns with , cut carriage returns
$Private_Remarks=~s/\n/ /g;
$Private_Remarks=~s/\r//g;
if ($Private_Remarks eq "Select"){
$Private_Remarks="";}
#R4. You have marked Event as a field that must contain at least 2
$Eventcheck=$Event;
$Eventcheck=~s/ +/ /g;
$Eventcheck=length($Eventcheck);
if ($Eventcheck<2){
$problem="Please press back on your browser and provide more information for the .. Event .. field.";
&security;}
#R4. You have marked Description as a field that must contain at least 2
$Venuecheck=$Venue;
$Venuecheck=~s/ +/ /g;
$Venuecheck=length($Venuecheck);
if ($Venuecheck<2){
$problem="Please press the Back Button on your browser and provide more information for the .. Venue .. Field. It is either not indicated in the dropdown box or not indicated in the additional field provided";
&security;}
#R4. You have marked Day as a field that must contain at least 1
$Daycheck=$Day;
$Daycheck=~s/ +/ /g;
$Daycheck=length($Daycheck);
if ($Daycheck<1){
$problem="Please press back on your browser and provide more information for the .. Day .. field.";
&security;}
#R4. You have marked Month as a field that must contain at least 1
#non-blank characters before allowing the field to be added. You can change the
#requirement below, or comment out all 6 lines below step to skip validation
$Monthcheck=$Month;
$Monthcheck=~s/ +/ /g;
$Monthcheck=length($Monthcheck);
if ($Monthcheck<1){
$problem="Please press back on your browser and provide more information for the .. Month .. field.";
&security;}
#R4. You have marked Year as a field that must contain at least 2
#non-blank characters before allowing the field to be added. You can change the
#requirement below, or comment out all 6 lines below step to skip validation
$Yearcheck=$Year;
$Yearcheck=~s/ +/ /g;
$Yearcheck=length($Yearcheck);
if ($Yearcheck<2){
$problem="Please press back on your browser and provide more information for the .. Year .. field.";
&security;}
#R4. You have marked Time as a field that must contain at least 2
$Timecheck=$Time;
$Timecheck=~s/ +/ /g;
$Timecheck=length($Timecheck);
if ($Timecheck<2){
$problem="Please press back on your browser and provide more information for the .. Time .. field - at least 2 letters or numbers.";
&security;}
#R10. You have marked Email as a field that must contain a valid e-mail
#Address, OR, be empty. To remove requirement, comment out 9 lines below
$Emailcheck=$Email;
($firstpart,$secondpart)=split(/\@/,$Emailcheck);
if ($Email && (!$firstpart || !$secondpart || $secondpart!~/\./)){
$problem="The information you have provided in the e-mail field does not look like a valid e-mail address. Please press back on your browser and fix this problem.";
&security;}
#R11. Remove characters that could cause security issues in e-mail field
if ($Emailcheck =~/[\!\|\~\^\'\"]/){
$problem="The information you entered into the e-mail field contains illegal characters. This field should contain letters, numbers, the \@ symbol, and periods only. Please press BACK and fix this problem.";
&security;}
}
#STEP S====
sub addtemp{
#S1. This subroutine adds records to your temporary file for approval
#S2. Check variable sent
&getvariables;
#S3. Randomize in preparation for random generator
srand();
#S4. Get IP address of person posting record
$ipstamp=$ENV{'REMOTE_ADDR'};
#S5. Generate a large random number to serve as key
$randnumb=int(rand(9999999));
$replacementline="$ipstamp&&temp$randnumb(\+\+)$Icon$delimiter$Event$delimiter$Description$delimiter$Venue$delimiter$Day$delimiter$Month$delimiter$Year$delimiter$Time$delimiter$Website$delimiter$Email$delimiter$Public_Remarks$delimiter$Private_Remarks";
#S6. Write the temp record to the bottom of the
$problem="Can't write to the data file. Please verify its location and change its permissions to 777.";
open (FILE2,">>$tempdata") || &security;
print FILE2 "$replacementline\n";
close(FILE2);
print "Content-type: text/html\n\n";
print "
\n";
print "$templatestart\n";
#S7. Acknowledge that record has been posted
print "Your record has been sent to the WebMaster for approval. Please click here to return to the Events Calendar .. OR ... Use your Browser's Back Button to submit more Events.\n";
print "$templateend\n";
exit;
}
#STEP T====
sub scrolltemp{
#T1. This step is your interface with the temp file
#T2. Check password
if ($adminpassword ne $checkpassword && $adminpassword){
$problem="The password you entered does not match your administration password. Please press BACK on your browser to fix this problem.";
&security;}
#T3. Check to make sure that the data file can be opened.
$problem="Unable to open your temporary data file. It either contains no records, or the path to it is incorrect.";
open (FILE, "$tempdata") || &security;
@all=;
close (FILE);
print "Content-type: text/html\n\n";
#T4. Start showing contents of data file
print "$templatestart\n";
print "\n";}
else{
print "\n";}
print "$templateend\n";
exit;
}
#STEP U=======
sub updatetemp{
#U1. This step makes changes from temp file
#U2. Check password
if ($adminpassword ne $checkpassword && $adminpassword){
$problem="The password you entered does not match your administration password. Please press BACK on your browser to fix this problem.";
&security;}
$problem="Unable to open your temporary data file. It either contains no records, or the path to it is incorrect.";
open (FILE, "$tempdata") || &security;
@all=;
close (FILE);
foreach $line (@all){
$line=~s/\n//g;
$checkleng=length($line);
if ($checkleng<2){next};
($indexvalues,$stringvalues)=split(/\(\+\+\)/,$line);
($ipaddress,$uniqueapproval)=split(/&&/,$indexvalues);
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$stringvalues);
if ($tempapprove{$uniqueapproval} eq "A"){
push(@recordstoadd,$stringvalues);}
elsif ($tempapprove{$uniqueapproval} eq "D"){
push(@recordstodelete,$stringvalues);}
elsif ($tempapprove{$uniqueapproval} eq "E"){
push(@recordstoedit,$stringvalues);}
else {
push(@recordstohold,$line);}
}
$problem="Unable to open data file to add records. Check path to it and its permissions.";
open (FILE, ">>$data") || &security;
foreach $line (@recordstoadd){
$line=~s/\n//g;
print FILE "$line\n";}
close(FILE);
$problem="Unable to open data file to records to edit. Check path to it and its permissions.";
open (FILE, ">>$data") || &security;
foreach $line (@recordstoedit){
$line=~s/\n//g;
print FILE "markedtoedit$line\n";}
close(FILE);
$problem="Unable to open temporary file to refresh data. Check path to it and its permissions.";
open (FILE, ">$tempdata") || &security;
foreach $line (@recordstohold){
$line=~s/\n//g;
print FILE "$line\n";}
close(FILE);
$checkhold=@recordstohold;
if ($checkhold){
&scrolltemp;}
print "Content-type: text/html\n\n";
print "$templatestart\n";
print "
Your actions have been taken. Please click here to continue.
\n";
print "$templateend\n";
exit;
}
sub read{
my ($open_file)=@_;
open(DAT, "$open_file") ;
my @data=;
close(DAT);
return @data;
}
sub write{
my ($writeto_file,@write)=@_;
my ($abc,$output);
foreach $abc(@write){
$output="$output\n$abc";
for ($output){
s/^\s+//;
s/\s+$//;
}
}
flock(DAT, 2);
open(DAT,">$writeto_file");
print DAT "$output";
close(DAT);
flock(DAT, 8);
}
sub do_diff_check{
my(@today) = localtime(time);
$today[5]=$today[5]+1900;
$today[4]=$today[4]+1;
if($today[4]<10){
$today[4]="0$today[4]";
}
if($today[3]<10){
$today[3]="0$today[3]";
}
my $today_date="$today[5]$today[4]$today[3]";
my @data_temp=&read($data);
foreach my $line(@data_temp){
my(@fields)=split(/\t/,$line);
my $temp_date="$fields[6]$fields[5]$fields[4]";
if($temp_date < $today_date){
$diff_marker=1;
last;
}
}
my (@output);
if($diff_marker){
foreach my $line(@data_temp){
my(@fields)=split(/\t/,$line);
my $temp_date="$fields[6]$fields[5]$fields[4]";
if($temp_date >=$today_date){
push(@output,$line);
}
}
&write($data,@output);
}
}#!/usr/bin/perl
use CGI;
$query = new CGI;
#You need to modify this script at all parts of Step B
#Script Description
#Unique script ID: yel/coc/f/yel-5b2d
#Created on: 12/19/2001
#Last edited on: 12/19/2001
#Script class: D
#STEP A======
#A1. The following lines get and process data passed
#through the URL, do not modify
$stringpassed=$ENV{'QUERY_STRING'};
#A2. Replace all plusses with spaces for data passed via URL
$stringpassed=~s/\+/ /g;
#STEP B======
######################################################
# START OF CONFIGURATION
######################################################
#B1. REQUIRED: The location of event data file on your server.
$data="/home/mrgforce/public_html/usaent/cgi/ep/eventpublisher.txt";
#B1b. REQUIRED: The location of your TEMPORARY event data file on your server.
$tempdata="/home/mrgforce/public_html/usaent/cgi/ep/eventpublisher.tempdata";
#B1c. OPTIONAL: You can format the opening and closing HTML of your admin mode
$openinghtml="/home/mrgforce/public_html/usaent/ep/icons/template.htm";
$thisurl="http://www.usaentertainment.com/cgi/eventpublisher_pro-sm-today.cgi";
#B4. REQUIRED TO ADD, DELETE, OR MODIFY.
$adminpassword="tbegrmg123";
$forwardingURL="http://www.usaentertainment.com/cgi/eventpublisher_pro-sm-today.cgi";
$baseurltoIcon="http://www.usaentertainment.com/ep/icons/";
$maximumpage=150;
#B18. Font settings of the event display
$fontface ="Verdana, Arial"; ### Recommended: "Verdana, Arial"
$fontsize= "1"; ### Used for event title and description only ###
$fonttitlecolor = "#990000";
$fontsubtitlecolor ="#000080"; ### Used for event sub titles such as "Venue", "Date" ....
#######################
# END OF CONFIGURATION
#######################
$maximum=1500;
@variablenames = $query->param;
foreach $variable (@variablenames){
$value=$query->param($variable);
$tempapprove{$variable}="$value";}
#STEP D================================
#You should not need to modify this section at all
#D1. Check to see if opening html file is on server
if (-e "$openinghtml"){
#D2. If so, open it and write opening and closing text to different strings
#to be used throughout the script
$problem="Can't open template file. Make sure you are referencing the file and not just a directory.";
open(OPENING, "$openinghtml") || &security;
@wholefile=;
close(OPENING);
$fulltemplate=join("\n",@wholefile);
($templatestart,$templateend)=split(/\+\+\+/,$fulltemplate);}
else{
#D3. If template file not found, use this for now
$templatestart="";
$templateend="";}
$delimiter="\t";
#D6. Get Password Entered by User
$checkpassword=$query->param('checkpassword');
#D7. Figure out what action user wants to take.
$actiontotake=$query->param('actiontotake');
$linenumberpass=$query->param('linenumberpass');
#D8. If user wants to delete record, and has already
#verified password, then go to the makechange subroutine
if ($actiontotake eq "Delete Record"){
$recordaction="Deleted";
&makechange;
exit;}
#D9. If user wants to edit record, and has already
#verified password, then go to the makechange subroutine
if ($actiontotake eq "Edit Record"){
$recordaction="Edited";
&makechange;
exit;}
#D10. If user wants to edit record, to go subroutine to verify
if ($actiontotake eq "Edit"){
&edit;
exit;}
#D11. If user wants to delete record, to go subroutine to verify
if ($actiontotake eq "Delete"){
&delete;
exit;}
#D12. If user wants to add record, go to add subroutine
if ($actiontotake eq "Add"){
&addrecord;
exit;}
#D13. If user wants to add record to temporary file
if ($actiontotake eq "Addtemp"){
&addtemp;
exit;}
#D14. If owner wants to evaluate records in temp file
if ($actiontotake eq "Scrolltemp"){
&scrolltemp;
exit;}
#D15. If user wants to update temp file
if ($actiontotake eq "Updatetemp"){
&updatetemp;
exit;}
#STEP E================================
#E1. Get the data passed from user
#PRO
$Icon=$query->param('Icon');
$Iconwork=lc($Icon);
$Iconwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Iconwork eq "select"){
$Iconwork="";
$Icon="";}
$Iconpass="$Icon";
#E1. Get the data passed from user
$Event=$query->param('Event');
$Eventwork=lc($Event);
#PRO
$Eventwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Eventwork eq "select"){
$Eventwork="";
$Event="";}
$Eventpass="$Event";
#E1. Get the data passed from user
$Description=$query->param('Description');
$Descriptionwork=lc($Description);
#PRO
$Descriptionwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Descriptionwork eq "select"){
$Descriptionwork="";
$Description="";}
$Descriptionpass="$Description";
#E1. Get the data passed from user
$Venue=$query->param('Venue');
$Venuework=lc($Venue);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Venuework=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Venuework eq "select"){
$Venuework="";
$Venue="";}
$Venuepass="$Venue";
#E1. Get the data passed from user
$Month=$query->param('Month');
$Monthwork=lc($Month);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Monthwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Monthwork eq "select"){
$Monthwork="";
$Month="";}
$Monthpass="$Month";
#E1. Get the data passed from user
$Day=$query->param('Day');
$Daywork=lc($Day);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Daywork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Daywork eq "select"){
$Daywork="";
$Day="";}
$Daypass="$Day";
#E1. Get the data passed from user
$Year=$query->param('Year');
$Yearwork=lc($Year);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Yearwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Yearwork eq "select"){
$Yearwork="";
$Year="";}
$Yearpass="$Year";
#E6. Get number of records already displayed
$startitem=$query->param('startitem');
#E7. Figure the last record to display on this page
$enditem=$startitem+$maximumpage;
#F4a. Support for European characters.
#PRO
($Iconone, $Icontwo, $Iconthree, $Iconfour, $Iconfive, $Iconsix, $Iconseven)=split(/ /, $Iconwork);
#F4a. Support for European characters.
($Eventone, $Eventtwo, $Eventthree, $Eventfour, $Eventfive, $Eventsix, $Eventseven)=split(/ /, $Eventwork);
#F4a. Support for European characters.
$Lo1="P"; $Lo2="is";
($Descriptionone, $Descriptiontwo, $Descriptionthree, $Descriptionfour, $Descriptionfive, $Descriptionsix, $Descriptionseven)=split(/ /, $Descriptionwork);
$Text1="Fr"; $Text2="Ev"; $Text3="her";
#F4a. Support for European characters.
$Hi1="ee"; $Hi2="ent"; $Hi3="ubl";
($Venueone, $Venuetwo, $Venuethree, $Venuefour, $Venuefive, $Venuesix, $Venueseven)=split(/ /, $Venuework);
#F4a. Support for European characters.
($Monthone, $Monthtwo, $Monththree, $Monthfour, $Monthfive, $Monthsix, $Monthseven)=split(/ /, $Monthwork);
($Dayone, $Daytwo, $Daythree, $Dayfour, $Dayfive, $Daysix, $Dayseven)=split(/ /, $Daywork);
#F4a. Support for European characters.
$comp1="INT"; $comp2="O"; $comp3="U"; $lcomp1="int"; $lcomp2="po"; $lcomp3="u";
$and1="b"; $and2="y";
($Yearone, $Yeartwo, $Yearthree, $Yearfour, $Yearfive, $Yearsix, $Yearseven)=split(/ /, $Yearwork);
#STEP G================================
#Do not modify this section
#G1. Open datafile and write contents to an array, if can't open report the problem at the security subroutine
$problem="You do not have a file to search on the server. Please ADD test records before trying to search your test data file.";
open (FILE, "$data") || &security;
@all=;
close (FILE);
#G2. The line below is required, do not modify
print "Content-type: text/html\n\n";
#G3. Display HTML Header
if ($adminpassword eq $checkpassword){
print "$templatestart\n";}
else {
######### Show Top of Page with Graphic, Search & Submit Links
#print "
\n";
####### Show Day & Date on Page
@timedisp = localtime(time + (86400 * 4));
@months = qw(January February March April May June July August September October November December);
@dayofweek = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday);
$monthdisp = $months[$timedisp[4]];
$daydisp = $dayofweek[$timedisp[6]];
$monthtemp = @timedisp[4]+1;
$daytemp = @timedisp[3];
$Month = $monthtemp;
$Day = $daytemp;
$Monthpass="$Month";
$Daypass="$Day";
print"\n";
#print "
Click Here for the Complete Calendar \n";
}
#print "";}
#STEP H==========
#H1. Read each line of the data file, compare with search words
foreach $line (@all){
$line=~s/\n//g;
$loopsaround++;
$checkleng=length($line);
if ($checkleng<2){next};
$linetemp1=lc($line);
#H1a. Support for European characters.
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetemp1);
#H9. This line specifies the fields to sort results by
$line="$Year$Month$Day$Event$delimiter$loopsaround$delimiter$line";
#H9.5 This line removes stray leading spaces before sorting your results
$line=~s/^ +//;
$increcount=0;
#PRO
#H12. Look for matches in field named Icon
if (($Icon =~/\b$Iconone/ && $Icon =~/\b$Icontwo/ && $Icon =~/\b$Iconthree/ && $Icon =~/\b$Iconfour/ && $Icon =~/\b$Iconfive/ && $Icon=~/\b$Iconsix/ && $Icon=~/\b$Iconseven/) || !$Iconwork) {
$increcount++;}
#H12. Look for matches in field named Event
if (($Event =~/\b$Eventone/ && $Event =~/\b$Eventtwo/ && $Event =~/\b$Eventthree/ && $Event =~/\b$Eventfour/ && $Event =~/\b$Eventfive/ && $Event=~/\b$Eventsix/ && $Event=~/\b$Eventseven/) || !$Eventwork) {
$increcount++;}
#H12. Look for matches in field named Description
if (($Description =~/\b$Descriptionone/ && $Description =~/\b$Descriptiontwo/ && $Description =~/\b$Descriptionthree/ && $Description =~/\b$Descriptionfour/ && $Description =~/\b$Descriptionfive/ && $Description=~/\b$Descriptionsix/ && $Description=~/\b$Descriptionseven/) || !$Descriptionwork) {
$increcount++;}
#H12. Look for matches in field named Venue
if (($Venue =~/\b$Venueone/ && $Venue =~/\b$Venuetwo/ && $Venue =~/\b$Venuethree/ && $Venue =~/\b$Venuefour/ && $Venue =~/\b$Venuefive/ && $Venue=~/\b$Venuesix/ && $Venue=~/\b$Venueseven/) || !$Venuework) {
$increcount++;}
#H12. Look for matches in fields named Month & Day
if ($Monthpass == "" && $Daypass == "") {
$increcount++;}
elsif ($Monthpass == $Month && $Daypass == "") {
$increcount++;}
elsif ($Monthpass == "" && $Daypass == $Day) {
$increcount++;}
elsif ($Monthpass == $Month && $Daypass == $Day && $Year == ($timedisp[5] + 1900)) {
$increcount++;}
#H12. Look for matches in field named Year
if (($Year =~/\b$Yearone/ && $Year =~/\b$Yeartwo/ && $Year =~/\b$Yearthree/ && $Year =~/\b$Yearfour/ && $Year =~/\b$Yearfive/ && $Year=~/\b$Yearsix/ && $Year=~/\b$Yearseven/) || !$Yearwork) {
$increcount++;}
if ($line=~/markedtoedit/ && $actiontotake eq "markedtoedit"){
$line=~s/markedtoedit//g;
push (@keepers2,$line);}
$line=~s/markedtoedit//g;
if ($increcount==6){
push (@keepers,$line);}}
#STEP J=======
if ($actiontotake eq "markedtoedit"){
@keepers=@keepers2;}
#J1. Sort matches stored in array.
@keepers=sort(@keepers);
#J2. Get and display number of matches found
$length1=@keepers;
#J3. If the number of matches is less than enditem, adjust
if ($length1<$enditem){
$enditem=$length1;
$displaystat="Y";}
#J4. The first field about to display
$disstart=$startitem+1;
##### Show Total Posted
#J5. Show user total number of matches found & display on screen
#if ($length1){
#print "Total Events Posted For Today ... $length1<\/font>\n";
#} else {
#print "
No Local Events Found.<\/B> Press your Browsers Back Button and try again.<\/P>\n";}
#STEP K=====
#K1. Do some HTML formatting before showing results
print "
\n";
#K4. Keep track of results processed on this page
foreach $line (@keepers){
#K5. Delete stray hard returns
$line=~s/\n//g;
#K6. Keep track of records displayed
$countline1++;
#K7. Decide whether or not this record goes on this page
if ($countline1>$startitem && $countline1<=$enditem){
#K8. Open each line of sorted array for displaying
($sortfield,$loopsaround,$Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$line);
if ($Month eq "01"){
$Month2 = "January";}
if ($Month eq "02"){
$Month2 = "February";}
if ($Month eq "03"){
$Month2 = "March";}
if ($Month eq "04"){
$Month2 = "April";}
if ($Month eq "05"){
$Month2 = "May";}
if ($Month eq "06"){
$Month2 = "June";}
if ($Month eq "07"){
$Month2 = "July";}
if ($Month eq "08"){
$Month2 = "August";}
if ($Month eq "09"){
$Month2 = "September";}
if ($Month eq "10"){
$Month2 = "October";}
if ($Month eq "11"){
$Month2 = "November";}
if ($Month eq "12"){
$Month2 = "December";}
#K15. Formatting for ad separating line.
#print "
\n";
#K15. Formatting for field Day. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Day){
#print "
Date:
$daydisp .. $Month2 $Day, #$Year
\n";}
#K15. Formatting for field Event. If you add any HTML, make sure you
#if ($Icon){
print "
$Month\/$Day -
$Event ... $Time @ $Venue
\n";
#else {
#print "
$Event
\n";}
#K15. Formatting for field Venue. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Venue){
#print "
\n";}
#K15. Formatting for field Time. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Time){
#print "
Time:
$Time
\n";}
#K15. Formatting for field Website. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Website){
#print "
\n";}
#K15. Formatting for field Email. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Email){
#print "
\n";}
#K15. Formatting for field Description.
#if ($Description){
#print "
$Description
\n";}
#print "
Info:
$Description
\n";}
#K15. Formatting for field Public_Remarks.
#if ($Public_Remarks){
#print "
$Public_Remarks
\n";}
#K11. Check passwords before showing edit and delete buttons
#if ($adminpassword eq $checkpassword){
#print "
\n";}
#STEP L====
#L1. If total displayed equals maximum you set, then exit
if ($countline1 == $maximum && $maximum){
$problem2="Your search was terminated because there were more than $maximum matching records found, please be more specific in your search";
last;}
#L2. If script just got to last match then exit program
if ($length1 == $countline1){
last;}
#L3. If script is at the end of a page then show NEXT button
if ($countline1 == $enditem && $displaystat ne "Y" && $maximum>$countline1){
$stopit="Y";
last;
}
}}
print "
\n";
$fcc="f"; $fcd="1"; $fce="w"; $fcf="tp"; $fcg="dn"; $fci="e";
$checkfcc="ne"; $checkfcd="t"; $checkfcf="s"; $checkfcg="ef"; $checkfci="ank"; $checkfcj="_bl";
$mer1="";
$mer3=" ";
# Formatting for separating line at bottom above Next Button.
#print "
\n";
#L4. Display NEXT MATCHES button
if ($stopit eq "Y"){
print "\n";
#L5. Pass hidden variables so script will know how to display next page
#PRO
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";}
$errormode ="$mer1";
#if (($stopit eq "Y") and ($adminpassword eq $checkpassword)){
######### Next Button
#if ($stopit eq "Y"){
#print " \n";
######### Copyright
#print "Copyright © 1998-2006 ... All Rights Reserved \n";
#print "TAMPABAYENTERTAINMENT.COM \n";
#print "A Member of the OLTB.COM Information Network
#A Division of USAEntertainment.Com ... and ... \n";
#print "TampaBayMusicScene.Com \n";
#}
#elsif ($stopit ne "Y"){
######### Copyright
#print "Copyright © 1998-2006 ... All Rights Reserved \n";
#print "TAMPABAYENTERTAINMENT.COM \n";
#print "A Member of the OLTB.COM Information Network
#A Division of USAEntertainment.Com ... and ... \n";
#print "TampaBayMusicScene.Com \n";
#}
#L6. Show problems
if ((!$mer1) or (!$mer2) or (!$mer3)){
&low;}
if ($problem2){
print "$problem2";}
else {
print "$mer3";
}
#L8. If opening.htm was found, show its closing html codes
if (!$errormode) {
&low;}
srand();
$checkval=int(rand(30));
if ($checkval==3){
print "";}
if ($adminpassword eq $checkpassword){
print "$templateend\n";}
else {
print "";}
exit;
#STEP M=====
sub security{
#M1. This is the subroutine that reports all problems
print "Content-type: text/html\n\n";
print "$templatestart\n";
print "
Data Error
\n";
print "Please correct the following error:
$problem
\n";
print "$templateend\n";
exit;
}
sub low{
#M1. This is the subroutine that reports all problems
print "$templatestart\n";
print "
Data Error
\n";
print "Error:
Script Corrupted!
\n";
print "$templateend\n";
exit;
}
#STEP N=====
sub edit{
#N1. Open data file and read it
$problem="Can't open data file to read from it at edit subroutine";
open (FILE,"$data") || &security;
@all=;
close (FILE);
#N2. Read each line of the data file
foreach $line (@all){
$line=~s/\n//g;
($copyIcon,$copyEvent,$copyDescription,$copyVenue,$copyDay,$copyMonth,$copyYear,$copyTime,$copyWebsite,$copyEmail,$copyPublic_Remarks,$copyPrivate_Remarks,$skipthisfield)=split (/$delimiter/,$line);
$keepcount++;
#N3. Find the line user wants to modify
if ($keepcount==$linenumberpass){
$linetokeep=$line;
$linetokeep=~s/markedtoedit//g;
last;
}
}
#N4. Check password sent via hidden field
if ($adminpassword ne $checkpassword){
$problem="Your password does not match the master password, please re-enter.";
&security;}
#N6. Split matching line into its respective variables
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetokeep);
#Required Header, do not delete
print "Content-type: text/html\n\n";
#N8. If can't find opening html, display default header
print "$templatestart\n";
print "
Admin Mode: Edit this Record\n";
print "
\n";
print "$templateend\n";
exit;
}
#STEP O====
sub delete{
#O1. Open data file and read it
$problem="Can't open data file to read from it at delete subroutine";
open (FILE,"$data") || &security;
@all=;
close (FILE);
#O2. Read each line of the file
foreach $line (@all){
$line=~s/\n//g;
($copyIcon,$copyEvent,$copyDescription,$copyVenue,$copyDay,$copyMonth,$copyYear,$copyTime,$copyWebsite,$copyEmail,$copyPublic_Remarks,$copyPrivate_Remarks,$skipthisfield)=split (/$delimiter/,$line);
$keepcount++;
#O3. Find line to delete
if ($keepcount==$linenumberpass){
$linetokeep=$line;
$linetokeep=~s/markedtoedit//g;
last;
}
}
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetokeep);
#O4. Check password sent via hidden field
if ($adminpassword ne $checkpassword){
$problem="Your password does not match the master password.";
&security;}
#O6. Required Header, do not delete
print "Content-type: text/html\n\n";
print "$templatestart\n";
print "
Admin Mode: Delete this Record?\n";
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetokeep);
#O7. Show validation HTML
print "
\n";
#If opening.htm was not found, show default closing html codes
print "$templateend\n";
exit;
}
#STEP P======
sub makechange{
#P1. Go to get variable subroutine and make sure add preferences apply
if ($recordaction eq "Edited"){
&getvariables;}
#P2. This step either replaces or empties the existing line
if ($recordaction eq "Deleted"){
$replacementline="";}
else{
$replacementline="$Icon$delimiter$Event$delimiter$Description$delimiter$Venue$delimiter$Day$delimiter$Month$delimiter$Year$delimiter$Time$delimiter$Website$delimiter$Email$delimiter$Public_Remarks$delimiter$Private_Remarks";}
$problem="Can't open data file to read from it";
open (FILE,"$data") || &security;
@all=;
close (FILE);
$linenumberpass--;
$all[$linenumberpass]=$replacementline;
$problem="Can't open temporary file. You need to chmod 777 the directory your data file is in. See the help files under Permissions for Class B Scripts.";
#P6. Write the entire changed file to a temporary file
open (FILE2,">$data.tmp") || &security;
foreach $line (@all){
$line=~s/\n//g;
print FILE2 "$line\n";}
close(FILE2);
#P7. Rename the temp file to your master data file
$problem="Can't rename file after making change";
rename("$data.tmp", "$data") || &security;
print "Content-type: text/html\n\n";
#P8. If can't find opening html, display default header
print "$templatestart\n";
print "Your record has been $recordaction. Please click here to continue.\n";
close (FILE);
#If opening.htm was not found, show default closing html codes
print "$templateend\n";
exit;
}
#STEP Q===
#This subroutine adds records to your database
sub addrecord{
#Q1. Check password
if ($adminpassword ne $checkpassword && $adminpassword){
$problem="The password you entered does not match your administration password. Please press BACK on your browser to fix this problem.";
&security;}
&getvariables;
$replacementline="$Icon$delimiter$Event$delimiter$Description$delimiter$Venue$delimiter$Day$delimiter$Month$delimiter$Year$delimiter$Time$delimiter$Website$delimiter$Email$delimiter$Public_Remarks$delimiter$Private_Remarks";
#Q3. Write the new record to the bottom of the data file
$problem="Can't write to the data file. Please verify its location and change its permissions to 777.";
open (FILE2,">>$data") || &security;
print FILE2 "$replacementline\n";
close(FILE2);
print "Content-type: text/html\n\n";
#Q4. If can't find opening html, display default header
print "$templatestart\n";
print "Your record has been added. Please click here to continue.\n";
#If opening.htm was not found, show default closing html codes
print "$templateend\n";
exit;
}
#STEP R===
sub getvariables{
#R1. This step checks your variables before adding/editing them
$Icon=$query->param('Icon');
$Event=$query->param('Event');
$Description=$query->param('Description');
$Private_Remarks=$query->param('Private_Remarks');
$Venue=$query->param('Venue');
if ($Venue eq "Choose From The Many Venues Listed Here ... Or Enter the Info Below"){
$Venue=$Private_Remarks;}
$Day=$query->param('Day');
$Month=$query->param('Month');
$Year=$query->param('Year');
$Time=$query->param('Time');
$Website=$query->param('Website');
$Email=$query->param('Email');
$Public_Remarks=$query->param('Public_Remarks');
#R3. Replace hard returns with , cut carriage returns
$Icon=~s/\n/ /g;
$Icon=~s/\r//g;
if ($Icon eq "Select"){
$Icon="";}
#R3. Replace hard returns with , cut carriage returns
$Event=~s/\n/ /g;
$Event=~s/\r//g;
if ($Event eq "Select"){
$Event="";}
#R3. Replace hard returns with , cut carriage returns
$Description=~s/\n/ /g;
$Description=~s/\r//g;
if ($Description eq "Select"){
$Description="";}
#R3. Replace hard returns with , cut carriage returns
$Venue=~s/\n/ /g;
$Venue=~s/\r//g;
if ($Venue eq "Select"){
$Venue="";}
#R3. Replace hard returns with , cut carriage returns
$Day=~s/\n/ /g;
$Day=~s/\r//g;
if ($Day eq "Select"){
$Day="";}
#R3. Replace hard returns with , cut carriage returns
$Month=~s/\n/ /g;
$Month=~s/\r//g;
if ($Month eq "Select"){
$Month="";}
#R3. Replace hard returns with , cut carriage returns
$Year=~s/\n/ /g;
$Year=~s/\r//g;
if ($Year eq "Select"){
$Year="";}
#R3. Replace hard returns with , cut carriage returns
$Time=~s/\n/ /g;
$Time=~s/\r//g;
if ($Time eq "Select"){
$Time="";}
#R3. Replace hard returns with , cut carriage returns
$Website=~s/\n/ /g;
$Website=~s/\r//g;
if ($Website eq "Select"){
$Website="";}
#R3. Replace hard returns with , cut carriage returns
$Email=~s/\n/ /g;
$Email=~s/\r//g;
if ($Email eq "Select"){
$Email="";}
#R3. Replace hard returns with , cut carriage returns
$Public_Remarks=~s/\n/ /g;
$Public_Remarks=~s/\r//g;
if ($Public_Remarks eq "Select"){
$Public_Remarks="";}
#R3. Replace hard returns with , cut carriage returns
$Private_Remarks=~s/\n/ /g;
$Private_Remarks=~s/\r//g;
if ($Private_Remarks eq "Select"){
$Private_Remarks="";}
#R4. You have marked Event as a field that must contain at least 2
$Eventcheck=$Event;
$Eventcheck=~s/ +/ /g;
$Eventcheck=length($Eventcheck);
if ($Eventcheck<2){
$problem="Please press back on your browser and provide more information for the .. Event .. field.";
&security;}
#R4. You have marked Description as a field that must contain at least 2
$Venuecheck=$Venue;
$Venuecheck=~s/ +/ /g;
$Venuecheck=length($Venuecheck);
if ($Venuecheck<2){
$problem="Please press the Back Button on your browser and provide more information for the .. Venue .. Field. It is either not indicated in the dropdown box or not indicated in the additional field provided";
&security;}
#R4. You have marked Day as a field that must contain at least 1
$Daycheck=$Day;
$Daycheck=~s/ +/ /g;
$Daycheck=length($Daycheck);
if ($Daycheck<1){
$problem="Please press back on your browser and provide more information for the .. Day .. field.";
&security;}
#R4. You have marked Month as a field that must contain at least 1
#non-blank characters before allowing the field to be added. You can change the
#requirement below, or comment out all 6 lines below step to skip validation
$Monthcheck=$Month;
$Monthcheck=~s/ +/ /g;
$Monthcheck=length($Monthcheck);
if ($Monthcheck<1){
$problem="Please press back on your browser and provide more information for the .. Month .. field.";
&security;}
#R4. You have marked Year as a field that must contain at least 2
#non-blank characters before allowing the field to be added. You can change the
#requirement below, or comment out all 6 lines below step to skip validation
$Yearcheck=$Year;
$Yearcheck=~s/ +/ /g;
$Yearcheck=length($Yearcheck);
if ($Yearcheck<2){
$problem="Please press back on your browser and provide more information for the .. Year .. field.";
&security;}
#R4. You have marked Time as a field that must contain at least 2
$Timecheck=$Time;
$Timecheck=~s/ +/ /g;
$Timecheck=length($Timecheck);
if ($Timecheck<2){
$problem="Please press back on your browser and provide more information for the .. Time .. field - at least 2 letters or numbers.";
&security;}
#R10. You have marked Email as a field that must contain a valid e-mail
#Address, OR, be empty. To remove requirement, comment out 9 lines below
$Emailcheck=$Email;
($firstpart,$secondpart)=split(/\@/,$Emailcheck);
if ($Email && (!$firstpart || !$secondpart || $secondpart!~/\./)){
$problem="The information you have provided in the e-mail field does not look like a valid e-mail address. Please press back on your browser and fix this problem.";
&security;}
#R11. Remove characters that could cause security issues in e-mail field
if ($Emailcheck =~/[\!\|\~\^\'\"]/){
$problem="The information you entered into the e-mail field contains illegal characters. This field should contain letters, numbers, the \@ symbol, and periods only. Please press BACK and fix this problem.";
&security;}
}
#STEP S====
sub addtemp{
#S1. This subroutine adds records to your temporary file for approval
#S2. Check variable sent
&getvariables;
#S3. Randomize in preparation for random generator
srand();
#S4. Get IP address of person posting record
$ipstamp=$ENV{'REMOTE_ADDR'};
#S5. Generate a large random number to serve as key
$randnumb=int(rand(9999999));
$replacementline="$ipstamp&&temp$randnumb(\+\+)$Icon$delimiter$Event$delimiter$Description$delimiter$Venue$delimiter$Day$delimiter$Month$delimiter$Year$delimiter$Time$delimiter$Website$delimiter$Email$delimiter$Public_Remarks$delimiter$Private_Remarks";
#S6. Write the temp record to the bottom of the
$problem="Can't write to the data file. Please verify its location and change its permissions to 777.";
open (FILE2,">>$tempdata") || &security;
print FILE2 "$replacementline\n";
close(FILE2);
print "Content-type: text/html\n\n";
print "
\n";
print "$templatestart\n";
#S7. Acknowledge that record has been posted
print "Your record has been sent to the WebMaster for approval. Please click here to return to the Events Calendar .. OR ... Use your Browser's Back Button to submit more Events.\n";
print "$templateend\n";
exit;
}
#STEP T====
sub scrolltemp{
#T1. This step is your interface with the temp file
#T2. Check password
if ($adminpassword ne $checkpassword && $adminpassword){
$problem="The password you entered does not match your administration password. Please press BACK on your browser to fix this problem.";
&security;}
#T3. Check to make sure that the data file can be opened.
$problem="Unable to open your temporary data file. It either contains no records, or the path to it is incorrect.";
open (FILE, "$tempdata") || &security;
@all=;
close (FILE);
print "Content-type: text/html\n\n";
#T4. Start showing contents of data file
print "$templatestart\n";
print "\n";}
else{
print "\n";}
print "$templateend\n";
exit;
}
#STEP U=======
sub updatetemp{
#U1. This step makes changes from temp file
#U2. Check password
if ($adminpassword ne $checkpassword && $adminpassword){
$problem="The password you entered does not match your administration password. Please press BACK on your browser to fix this problem.";
&security;}
$problem="Unable to open your temporary data file. It either contains no records, or the path to it is incorrect.";
open (FILE, "$tempdata") || &security;
@all=;
close (FILE);
foreach $line (@all){
$line=~s/\n//g;
$checkleng=length($line);
if ($checkleng<2){next};
($indexvalues,$stringvalues)=split(/\(\+\+\)/,$line);
($ipaddress,$uniqueapproval)=split(/&&/,$indexvalues);
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$stringvalues);
if ($tempapprove{$uniqueapproval} eq "A"){
push(@recordstoadd,$stringvalues);}
elsif ($tempapprove{$uniqueapproval} eq "D"){
push(@recordstodelete,$stringvalues);}
elsif ($tempapprove{$uniqueapproval} eq "E"){
push(@recordstoedit,$stringvalues);}
else {
push(@recordstohold,$line);}
}
$problem="Unable to open data file to add records. Check path to it and its permissions.";
open (FILE, ">>$data") || &security;
foreach $line (@recordstoadd){
$line=~s/\n//g;
print FILE "$line\n";}
close(FILE);
$problem="Unable to open data file to records to edit. Check path to it and its permissions.";
open (FILE, ">>$data") || &security;
foreach $line (@recordstoedit){
$line=~s/\n//g;
print FILE "markedtoedit$line\n";}
close(FILE);
$problem="Unable to open temporary file to refresh data. Check path to it and its permissions.";
open (FILE, ">$tempdata") || &security;
foreach $line (@recordstohold){
$line=~s/\n//g;
print FILE "$line\n";}
close(FILE);
$checkhold=@recordstohold;
if ($checkhold){
&scrolltemp;}
print "Content-type: text/html\n\n";
print "$templatestart\n";
print "
Your actions have been taken. Please click here to continue.
\n";
print "$templateend\n";
exit;
}
sub read{
my ($open_file)=@_;
open(DAT, "$open_file") ;
my @data=;
close(DAT);
return @data;
}
sub write{
my ($writeto_file,@write)=@_;
my ($abc,$output);
foreach $abc(@write){
$output="$output\n$abc";
for ($output){
s/^\s+//;
s/\s+$//;
}
}
flock(DAT, 2);
open(DAT,">$writeto_file");
print DAT "$output";
close(DAT);
flock(DAT, 8);
}
sub do_diff_check{
my(@today) = localtime(time);
$today[5]=$today[5]+1900;
$today[4]=$today[4]+1;
if($today[4]<10){
$today[4]="0$today[4]";
}
if($today[3]<10){
$today[3]="0$today[3]";
}
my $today_date="$today[5]$today[4]$today[3]";
my @data_temp=&read($data);
foreach my $line(@data_temp){
my(@fields)=split(/\t/,$line);
my $temp_date="$fields[6]$fields[5]$fields[4]";
if($temp_date < $today_date){
$diff_marker=1;
last;
}
}
my (@output);
if($diff_marker){
foreach my $line(@data_temp){
my(@fields)=split(/\t/,$line);
my $temp_date="$fields[6]$fields[5]$fields[4]";
if($temp_date >=$today_date){
push(@output,$line);
}
}
&write($data,@output);
}
}#!/usr/bin/perl
use CGI;
$query = new CGI;
#You need to modify this script at all parts of Step B
#Script Description
#Unique script ID: yel/coc/f/yel-5b2d
#Created on: 12/19/2001
#Last edited on: 12/19/2001
#Script class: D
#STEP A======
#A1. The following lines get and process data passed
#through the URL, do not modify
$stringpassed=$ENV{'QUERY_STRING'};
#A2. Replace all plusses with spaces for data passed via URL
$stringpassed=~s/\+/ /g;
#STEP B======
######################################################
# START OF CONFIGURATION
######################################################
#B1. REQUIRED: The location of event data file on your server.
$data="/home/mrgforce/public_html/usaent/cgi/ep/eventpublisher.txt";
#B1b. REQUIRED: The location of your TEMPORARY event data file on your server.
$tempdata="/home/mrgforce/public_html/usaent/cgi/ep/eventpublisher.tempdata";
#B1c. OPTIONAL: You can format the opening and closing HTML of your admin mode
$openinghtml="/home/mrgforce/public_html/usaent/ep/icons/template.htm";
$thisurl="http://www.usaentertainment.com/cgi/eventpublisher_pro-sm-today.cgi";
#B4. REQUIRED TO ADD, DELETE, OR MODIFY.
$adminpassword="t123";
$forwardingURL="http://www.usaentertainment.com/cgi/eventpublisher_pro-sm-today.cgi";
$baseurltoIcon="http://www.usaentertainment.com/ep/icons/";
$maximumpage=150;
#B18. Font settings of the event display
$fontface ="Verdana, Arial"; ### Recommended: "Verdana, Arial"
$fontsize= "1"; ### Used for event title and description only ###
$fonttitlecolor = "#990000";
$fontsubtitlecolor ="#000080"; ### Used for event sub titles such as "Venue", "Date" ....
#######################
# END OF CONFIGURATION
#######################
$maximum=1500;
@variablenames = $query->param;
foreach $variable (@variablenames){
$value=$query->param($variable);
$tempapprove{$variable}="$value";}
#STEP D================================
#You should not need to modify this section at all
#D1. Check to see if opening html file is on server
if (-e "$openinghtml"){
#D2. If so, open it and write opening and closing text to different strings
#to be used throughout the script
$problem="Can't open template file. Make sure you are referencing the file and not just a directory.";
open(OPENING, "$openinghtml") || &security;
@wholefile=;
close(OPENING);
$fulltemplate=join("\n",@wholefile);
($templatestart,$templateend)=split(/\+\+\+/,$fulltemplate);}
else{
#D3. If template file not found, use this for now
$templatestart="";
$templateend="";}
$delimiter="\t";
#D6. Get Password Entered by User
$checkpassword=$query->param('checkpassword');
#D7. Figure out what action user wants to take.
$actiontotake=$query->param('actiontotake');
$linenumberpass=$query->param('linenumberpass');
#D8. If user wants to delete record, and has already
#verified password, then go to the makechange subroutine
if ($actiontotake eq "Delete Record"){
$recordaction="Deleted";
&makechange;
exit;}
#D9. If user wants to edit record, and has already
#verified password, then go to the makechange subroutine
if ($actiontotake eq "Edit Record"){
$recordaction="Edited";
&makechange;
exit;}
#D10. If user wants to edit record, to go subroutine to verify
if ($actiontotake eq "Edit"){
&edit;
exit;}
#D11. If user wants to delete record, to go subroutine to verify
if ($actiontotake eq "Delete"){
&delete;
exit;}
#D12. If user wants to add record, go to add subroutine
if ($actiontotake eq "Add"){
&addrecord;
exit;}
#D13. If user wants to add record to temporary file
if ($actiontotake eq "Addtemp"){
&addtemp;
exit;}
#D14. If owner wants to evaluate records in temp file
if ($actiontotake eq "Scrolltemp"){
&scrolltemp;
exit;}
#D15. If user wants to update temp file
if ($actiontotake eq "Updatetemp"){
&updatetemp;
exit;}
#STEP E================================
#E1. Get the data passed from user
#PRO
$Icon=$query->param('Icon');
$Iconwork=lc($Icon);
$Iconwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Iconwork eq "select"){
$Iconwork="";
$Icon="";}
$Iconpass="$Icon";
#E1. Get the data passed from user
$Event=$query->param('Event');
$Eventwork=lc($Event);
#PRO
$Eventwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Eventwork eq "select"){
$Eventwork="";
$Event="";}
$Eventpass="$Event";
#E1. Get the data passed from user
$Description=$query->param('Description');
$Descriptionwork=lc($Description);
#PRO
$Descriptionwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Descriptionwork eq "select"){
$Descriptionwork="";
$Description="";}
$Descriptionpass="$Description";
#E1. Get the data passed from user
$Venue=$query->param('Venue');
$Venuework=lc($Venue);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Venuework=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Venuework eq "select"){
$Venuework="";
$Venue="";}
$Venuepass="$Venue";
#E1. Get the data passed from user
$Month=$query->param('Month');
$Monthwork=lc($Month);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Monthwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Monthwork eq "select"){
$Monthwork="";
$Month="";}
$Monthpass="$Month";
#E1. Get the data passed from user
$Day=$query->param('Day');
$Daywork=lc($Day);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Daywork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Daywork eq "select"){
$Daywork="";
$Day="";}
$Daypass="$Day";
#E1. Get the data passed from user
$Year=$query->param('Year');
$Yearwork=lc($Year);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Yearwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Yearwork eq "select"){
$Yearwork="";
$Year="";}
$Yearpass="$Year";
#E6. Get number of records already displayed
$startitem=$query->param('startitem');
#E7. Figure the last record to display on this page
$enditem=$startitem+$maximumpage;
#F4a. Support for European characters.
#PRO
($Iconone, $Icontwo, $Iconthree, $Iconfour, $Iconfive, $Iconsix, $Iconseven)=split(/ /, $Iconwork);
#F4a. Support for European characters.
($Eventone, $Eventtwo, $Eventthree, $Eventfour, $Eventfive, $Eventsix, $Eventseven)=split(/ /, $Eventwork);
#F4a. Support for European characters.
$Lo1="P"; $Lo2="is";
($Descriptionone, $Descriptiontwo, $Descriptionthree, $Descriptionfour, $Descriptionfive, $Descriptionsix, $Descriptionseven)=split(/ /, $Descriptionwork);
$Text1="Fr"; $Text2="Ev"; $Text3="her";
#F4a. Support for European characters.
$Hi1="ee"; $Hi2="ent"; $Hi3="ubl";
($Venueone, $Venuetwo, $Venuethree, $Venuefour, $Venuefive, $Venuesix, $Venueseven)=split(/ /, $Venuework);
#F4a. Support for European characters.
($Monthone, $Monthtwo, $Monththree, $Monthfour, $Monthfive, $Monthsix, $Monthseven)=split(/ /, $Monthwork);
($Dayone, $Daytwo, $Daythree, $Dayfour, $Dayfive, $Daysix, $Dayseven)=split(/ /, $Daywork);
#F4a. Support for European characters.
$comp1="INT"; $comp2="O"; $comp3="U"; $lcomp1="int"; $lcomp2="po"; $lcomp3="u";
$and1="b"; $and2="y";
($Yearone, $Yeartwo, $Yearthree, $Yearfour, $Yearfive, $Yearsix, $Yearseven)=split(/ /, $Yearwork);
#STEP G================================
#Do not modify this section
#G1. Open datafile and write contents to an array, if can't open report the problem at the security subroutine
$problem="You do not have a file to search on the server. Please ADD test records before trying to search your test data file.";
open (FILE, "$data") || &security;
@all=;
close (FILE);
#G2. The line below is required, do not modify
print "Content-type: text/html\n\n";
#G3. Display HTML Header
if ($adminpassword eq $checkpassword){
print "$templatestart\n";}
else {
######### Show Top of Page with Graphic, Search & Submit Links
#print "
\n";
####### Show Day & Date on Page
@timedisp = localtime(time + (86400 * 5));
@months = qw(January February March April May June July August September October November December);
@dayofweek = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday);
$monthdisp = $months[$timedisp[4]];
$daydisp = $dayofweek[$timedisp[6]];
$monthtemp = @timedisp[4]+1;
$daytemp = @timedisp[3];
$Month = $monthtemp;
$Day = $daytemp;
$Monthpass="$Month";
$Daypass="$Day";
print"\n";
#print "
Click Here for the Complete Calendar \n";
}
#print "";}
#STEP H==========
#H1. Read each line of the data file, compare with search words
foreach $line (@all){
$line=~s/\n//g;
$loopsaround++;
$checkleng=length($line);
if ($checkleng<2){next};
$linetemp1=lc($line);
#H1a. Support for European characters.
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetemp1);
#H9. This line specifies the fields to sort results by
$line="$Year$Month$Day$Event$delimiter$loopsaround$delimiter$line";
#H9.5 This line removes stray leading spaces before sorting your results
$line=~s/^ +//;
$increcount=0;
#PRO
#H12. Look for matches in field named Icon
if (($Icon =~/\b$Iconone/ && $Icon =~/\b$Icontwo/ && $Icon =~/\b$Iconthree/ && $Icon =~/\b$Iconfour/ && $Icon =~/\b$Iconfive/ && $Icon=~/\b$Iconsix/ && $Icon=~/\b$Iconseven/) || !$Iconwork) {
$increcount++;}
#H12. Look for matches in field named Event
if (($Event =~/\b$Eventone/ && $Event =~/\b$Eventtwo/ && $Event =~/\b$Eventthree/ && $Event =~/\b$Eventfour/ && $Event =~/\b$Eventfive/ && $Event=~/\b$Eventsix/ && $Event=~/\b$Eventseven/) || !$Eventwork) {
$increcount++;}
#H12. Look for matches in field named Description
if (($Description =~/\b$Descriptionone/ && $Description =~/\b$Descriptiontwo/ && $Description =~/\b$Descriptionthree/ && $Description =~/\b$Descriptionfour/ && $Description =~/\b$Descriptionfive/ && $Description=~/\b$Descriptionsix/ && $Description=~/\b$Descriptionseven/) || !$Descriptionwork) {
$increcount++;}
#H12. Look for matches in field named Venue
if (($Venue =~/\b$Venueone/ && $Venue =~/\b$Venuetwo/ && $Venue =~/\b$Venuethree/ && $Venue =~/\b$Venuefour/ && $Venue =~/\b$Venuefive/ && $Venue=~/\b$Venuesix/ && $Venue=~/\b$Venueseven/) || !$Venuework) {
$increcount++;}
#H12. Look for matches in fields named Month & Day
if ($Monthpass == "" && $Daypass == "") {
$increcount++;}
elsif ($Monthpass == $Month && $Daypass == "") {
$increcount++;}
elsif ($Monthpass == "" && $Daypass == $Day) {
$increcount++;}
elsif ($Monthpass == $Month && $Daypass == $Day && $Year == ($timedisp[5] + 1900)) {
$increcount++;}
#H12. Look for matches in field named Year
if (($Year =~/\b$Yearone/ && $Year =~/\b$Yeartwo/ && $Year =~/\b$Yearthree/ && $Year =~/\b$Yearfour/ && $Year =~/\b$Yearfive/ && $Year=~/\b$Yearsix/ && $Year=~/\b$Yearseven/) || !$Yearwork) {
$increcount++;}
if ($line=~/markedtoedit/ && $actiontotake eq "markedtoedit"){
$line=~s/markedtoedit//g;
push (@keepers2,$line);}
$line=~s/markedtoedit//g;
if ($increcount==6){
push (@keepers,$line);}}
#STEP J=======
if ($actiontotake eq "markedtoedit"){
@keepers=@keepers2;}
#J1. Sort matches stored in array.
@keepers=sort(@keepers);
#J2. Get and display number of matches found
$length1=@keepers;
#J3. If the number of matches is less than enditem, adjust
if ($length1<$enditem){
$enditem=$length1;
$displaystat="Y";}
#J4. The first field about to display
$disstart=$startitem+1;
##### Show Total Posted
#J5. Show user total number of matches found & display on screen
#if ($length1){
#print "Total Events Posted For Today ... $length1<\/font>\n";
#} else {
#print "
No Local Events Found.<\/B> Press your Browsers Back Button and try again.<\/P>\n";}
#STEP K=====
#K1. Do some HTML formatting before showing results
print "
\n";
#K4. Keep track of results processed on this page
foreach $line (@keepers){
#K5. Delete stray hard returns
$line=~s/\n//g;
#K6. Keep track of records displayed
$countline1++;
#K7. Decide whether or not this record goes on this page
if ($countline1>$startitem && $countline1<=$enditem){
#K8. Open each line of sorted array for displaying
($sortfield,$loopsaround,$Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$line);
if ($Month eq "01"){
$Month2 = "January";}
if ($Month eq "02"){
$Month2 = "February";}
if ($Month eq "03"){
$Month2 = "March";}
if ($Month eq "04"){
$Month2 = "April";}
if ($Month eq "05"){
$Month2 = "May";}
if ($Month eq "06"){
$Month2 = "June";}
if ($Month eq "07"){
$Month2 = "July";}
if ($Month eq "08"){
$Month2 = "August";}
if ($Month eq "09"){
$Month2 = "September";}
if ($Month eq "10"){
$Month2 = "October";}
if ($Month eq "11"){
$Month2 = "November";}
if ($Month eq "12"){
$Month2 = "December";}
#K15. Formatting for ad separating line.
#print "
\n";
#K15. Formatting for field Day. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Day){
#print "
Date:
$daydisp .. $Month2 $Day, #$Year
\n";}
#K15. Formatting for field Event. If you add any HTML, make sure you
#if ($Icon){
print "
$Month\/$Day -
$Event ... $Time @ $Venue
\n";
#else {
#print "
$Event
\n";}
#K15. Formatting for field Venue. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Venue){
#print "
\n";}
#K15. Formatting for field Time. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Time){
#print "
Time:
$Time
\n";}
#K15. Formatting for field Website. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Website){
#print "
\n";}
#K15. Formatting for field Email. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Email){
#print "
\n";}
#K15. Formatting for field Description.
#if ($Description){
#print "
$Description
\n";}
#print "
Info:
$Description
\n";}
#K15. Formatting for field Public_Remarks.
#if ($Public_Remarks){
#print "
$Public_Remarks
\n";}
#K11. Check passwords before showing edit and delete buttons
#if ($adminpassword eq $checkpassword){
#print "
\n";}
#STEP L====
#L1. If total displayed equals maximum you set, then exit
if ($countline1 == $maximum && $maximum){
$problem2="Your search was terminated because there were more than $maximum matching records found, please be more specific in your search";
last;}
#L2. If script just got to last match then exit program
if ($length1 == $countline1){
last;}
#L3. If script is at the end of a page then show NEXT button
if ($countline1 == $enditem && $displaystat ne "Y" && $maximum>$countline1){
$stopit="Y";
last;
}
}}
print "
\n";
$fcc="f"; $fcd="1"; $fce="w"; $fcf="tp"; $fcg="dn"; $fci="e";
$checkfcc="ne"; $checkfcd="t"; $checkfcf="s"; $checkfcg="ef"; $checkfci="ank"; $checkfcj="_bl";
$mer1="";
$mer3=" ";
# Formatting for separating line at bottom above Next Button.
#print "
\n";
#L4. Display NEXT MATCHES button
if ($stopit eq "Y"){
print "\n";
#L5. Pass hidden variables so script will know how to display next page
#PRO
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";}
$errormode ="$mer1";
#if (($stopit eq "Y") and ($adminpassword eq $checkpassword)){
######### Next Button
#if ($stopit eq "Y"){
#print " \n";
######### Copyright
#print "Copyright © 1998-2006 ... All Rights Reserved \n";
#print "TAMPABAYENTERTAINMENT.COM \n";
#print "A Member of the OLTB.COM Information Network
#A Division of USAEntertainment.Com ... and ... \n";
#print "TampaBayMusicScene.Com \n";
#}
#elsif ($stopit ne "Y"){
######### Copyright
#print "Copyright © 1998-2006 ... All Rights Reserved \n";
#print "TAMPABAYENTERTAINMENT.COM \n";
#print "A Member of the OLTB.COM Information Network
#A Division of USAEntertainment.Com ... and ... \n";
#print "TampaBayMusicScene.Com \n";
#}
#L6. Show problems
if ((!$mer1) or (!$mer2) or (!$mer3)){
&low;}
if ($problem2){
print "$problem2";}
else {
print "$mer3";
}
#L8. If opening.htm was found, show its closing html codes
if (!$errormode) {
&low;}
srand();
$checkval=int(rand(30));
if ($checkval==3){
print "";}
if ($adminpassword eq $checkpassword){
print "$templateend\n";}
else {
print "";}
exit;
#STEP M=====
sub security{
#M1. This is the subroutine that reports all problems
print "Content-type: text/html\n\n";
print "$templatestart\n";
print "
Data Error
\n";
print "Please correct the following error:
$problem
\n";
print "$templateend\n";
exit;
}
sub low{
#M1. This is the subroutine that reports all problems
print "$templatestart\n";
print "
Data Error
\n";
print "Error:
Script Corrupted!
\n";
print "$templateend\n";
exit;
}
#STEP N=====
sub edit{
#N1. Open data file and read it
$problem="Can't open data file to read from it at edit subroutine";
open (FILE,"$data") || &security;
@all=;
close (FILE);
#N2. Read each line of the data file
foreach $line (@all){
$line=~s/\n//g;
($copyIcon,$copyEvent,$copyDescription,$copyVenue,$copyDay,$copyMonth,$copyYear,$copyTime,$copyWebsite,$copyEmail,$copyPublic_Remarks,$copyPrivate_Remarks,$skipthisfield)=split (/$delimiter/,$line);
$keepcount++;
#N3. Find the line user wants to modify
if ($keepcount==$linenumberpass){
$linetokeep=$line;
$linetokeep=~s/markedtoedit//g;
last;
}
}
#N4. Check password sent via hidden field
if ($adminpassword ne $checkpassword){
$problem="Your password does not match the master password, please re-enter.";
&security;}
#N6. Split matching line into its respective variables
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetokeep);
#Required Header, do not delete
print "Content-type: text/html\n\n";
#N8. If can't find opening html, display default header
print "$templatestart\n";
print "
Admin Mode: Edit this Record\n";
print "
\n";
print "$templateend\n";
exit;
}
#STEP O====
sub delete{
#O1. Open data file and read it
$problem="Can't open data file to read from it at delete subroutine";
open (FILE,"$data") || &security;
@all=;
close (FILE);
#O2. Read each line of the file
foreach $line (@all){
$line=~s/\n//g;
($copyIcon,$copyEvent,$copyDescription,$copyVenue,$copyDay,$copyMonth,$copyYear,$copyTime,$copyWebsite,$copyEmail,$copyPublic_Remarks,$copyPrivate_Remarks,$skipthisfield)=split (/$delimiter/,$line);
$keepcount++;
#O3. Find line to delete
if ($keepcount==$linenumberpass){
$linetokeep=$line;
$linetokeep=~s/markedtoedit//g;
last;
}
}
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetokeep);
#O4. Check password sent via hidden field
if ($adminpassword ne $checkpassword){
$problem="Your password does not match the master password.";
&security;}
#O6. Required Header, do not delete
print "Content-type: text/html\n\n";
print "$templatestart\n";
print "
Admin Mode: Delete this Record?\n";
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetokeep);
#O7. Show validation HTML
print "
\n";
#If opening.htm was not found, show default closing html codes
print "$templateend\n";
exit;
}
#STEP P======
sub makechange{
#P1. Go to get variable subroutine and make sure add preferences apply
if ($recordaction eq "Edited"){
&getvariables;}
#P2. This step either replaces or empties the existing line
if ($recordaction eq "Deleted"){
$replacementline="";}
else{
$replacementline="$Icon$delimiter$Event$delimiter$Description$delimiter$Venue$delimiter$Day$delimiter$Month$delimiter$Year$delimiter$Time$delimiter$Website$delimiter$Email$delimiter$Public_Remarks$delimiter$Private_Remarks";}
$problem="Can't open data file to read from it";
open (FILE,"$data") || &security;
@all=;
close (FILE);
$linenumberpass--;
$all[$linenumberpass]=$replacementline;
$problem="Can't open temporary file. You need to chmod 777 the directory your data file is in. See the help files under Permissions for Class B Scripts.";
#P6. Write the entire changed file to a temporary file
open (FILE2,">$data.tmp") || &security;
foreach $line (@all){
$line=~s/\n//g;
print FILE2 "$line\n";}
close(FILE2);
#P7. Rename the temp file to your master data file
$problem="Can't rename file after making change";
rename("$data.tmp", "$data") || &security;
print "Content-type: text/html\n\n";
#P8. If can't find opening html, display default header
print "$templatestart\n";
print "Your record has been $recordaction. Please click here to continue.\n";
close (FILE);
#If opening.htm was not found, show default closing html codes
print "$templateend\n";
exit;
}
#STEP Q===
#This subroutine adds records to your database
sub addrecord{
#Q1. Check password
if ($adminpassword ne $checkpassword && $adminpassword){
$problem="The password you entered does not match your administration password. Please press BACK on your browser to fix this problem.";
&security;}
&getvariables;
$replacementline="$Icon$delimiter$Event$delimiter$Description$delimiter$Venue$delimiter$Day$delimiter$Month$delimiter$Year$delimiter$Time$delimiter$Website$delimiter$Email$delimiter$Public_Remarks$delimiter$Private_Remarks";
#Q3. Write the new record to the bottom of the data file
$problem="Can't write to the data file. Please verify its location and change its permissions to 777.";
open (FILE2,">>$data") || &security;
print FILE2 "$replacementline\n";
close(FILE2);
print "Content-type: text/html\n\n";
#Q4. If can't find opening html, display default header
print "$templatestart\n";
print "Your record has been added. Please click here to continue.\n";
#If opening.htm was not found, show default closing html codes
print "$templateend\n";
exit;
}
#STEP R===
sub getvariables{
#R1. This step checks your variables before adding/editing them
$Icon=$query->param('Icon');
$Event=$query->param('Event');
$Description=$query->param('Description');
$Private_Remarks=$query->param('Private_Remarks');
$Venue=$query->param('Venue');
if ($Venue eq "Choose From The Many Venues Listed Here ... Or Enter the Info Below"){
$Venue=$Private_Remarks;}
$Day=$query->param('Day');
$Month=$query->param('Month');
$Year=$query->param('Year');
$Time=$query->param('Time');
$Website=$query->param('Website');
$Email=$query->param('Email');
$Public_Remarks=$query->param('Public_Remarks');
#R3. Replace hard returns with , cut carriage returns
$Icon=~s/\n/ /g;
$Icon=~s/\r//g;
if ($Icon eq "Select"){
$Icon="";}
#R3. Replace hard returns with , cut carriage returns
$Event=~s/\n/ /g;
$Event=~s/\r//g;
if ($Event eq "Select"){
$Event="";}
#R3. Replace hard returns with , cut carriage returns
$Description=~s/\n/ /g;
$Description=~s/\r//g;
if ($Description eq "Select"){
$Description="";}
#R3. Replace hard returns with , cut carriage returns
$Venue=~s/\n/ /g;
$Venue=~s/\r//g;
if ($Venue eq "Select"){
$Venue="";}
#R3. Replace hard returns with , cut carriage returns
$Day=~s/\n/ /g;
$Day=~s/\r//g;
if ($Day eq "Select"){
$Day="";}
#R3. Replace hard returns with , cut carriage returns
$Month=~s/\n/ /g;
$Month=~s/\r//g;
if ($Month eq "Select"){
$Month="";}
#R3. Replace hard returns with , cut carriage returns
$Year=~s/\n/ /g;
$Year=~s/\r//g;
if ($Year eq "Select"){
$Year="";}
#R3. Replace hard returns with , cut carriage returns
$Time=~s/\n/ /g;
$Time=~s/\r//g;
if ($Time eq "Select"){
$Time="";}
#R3. Replace hard returns with , cut carriage returns
$Website=~s/\n/ /g;
$Website=~s/\r//g;
if ($Website eq "Select"){
$Website="";}
#R3. Replace hard returns with , cut carriage returns
$Email=~s/\n/ /g;
$Email=~s/\r//g;
if ($Email eq "Select"){
$Email="";}
#R3. Replace hard returns with , cut carriage returns
$Public_Remarks=~s/\n/ /g;
$Public_Remarks=~s/\r//g;
if ($Public_Remarks eq "Select"){
$Public_Remarks="";}
#R3. Replace hard returns with , cut carriage returns
$Private_Remarks=~s/\n/ /g;
$Private_Remarks=~s/\r//g;
if ($Private_Remarks eq "Select"){
$Private_Remarks="";}
#R4. You have marked Event as a field that must contain at least 2
$Eventcheck=$Event;
$Eventcheck=~s/ +/ /g;
$Eventcheck=length($Eventcheck);
if ($Eventcheck<2){
$problem="Please press back on your browser and provide more information for the .. Event .. field.";
&security;}
#R4. You have marked Description as a field that must contain at least 2
$Venuecheck=$Venue;
$Venuecheck=~s/ +/ /g;
$Venuecheck=length($Venuecheck);
if ($Venuecheck<2){
$problem="Please press the Back Button on your browser and provide more information for the .. Venue .. Field. It is either not indicated in the dropdown box or not indicated in the additional field provided";
&security;}
#R4. You have marked Day as a field that must contain at least 1
$Daycheck=$Day;
$Daycheck=~s/ +/ /g;
$Daycheck=length($Daycheck);
if ($Daycheck<1){
$problem="Please press back on your browser and provide more information for the .. Day .. field.";
&security;}
#R4. You have marked Month as a field that must contain at least 1
#non-blank characters before allowing the field to be added. You can change the
#requirement below, or comment out all 6 lines below step to skip validation
$Monthcheck=$Month;
$Monthcheck=~s/ +/ /g;
$Monthcheck=length($Monthcheck);
if ($Monthcheck<1){
$problem="Please press back on your browser and provide more information for the .. Month .. field.";
&security;}
#R4. You have marked Year as a field that must contain at least 2
#non-blank characters before allowing the field to be added. You can change the
#requirement below, or comment out all 6 lines below step to skip validation
$Yearcheck=$Year;
$Yearcheck=~s/ +/ /g;
$Yearcheck=length($Yearcheck);
if ($Yearcheck<2){
$problem="Please press back on your browser and provide more information for the .. Year .. field.";
&security;}
#R4. You have marked Time as a field that must contain at least 2
$Timecheck=$Time;
$Timecheck=~s/ +/ /g;
$Timecheck=length($Timecheck);
if ($Timecheck<2){
$problem="Please press back on your browser and provide more information for the .. Time .. field - at least 2 letters or numbers.";
&security;}
#R10. You have marked Email as a field that must contain a valid e-mail
#Address, OR, be empty. To remove requirement, comment out 9 lines below
$Emailcheck=$Email;
($firstpart,$secondpart)=split(/\@/,$Emailcheck);
if ($Email && (!$firstpart || !$secondpart || $secondpart!~/\./)){
$problem="The information you have provided in the e-mail field does not look like a valid e-mail address. Please press back on your browser and fix this problem.";
&security;}
#R11. Remove characters that could cause security issues in e-mail field
if ($Emailcheck =~/[\!\|\~\^\'\"]/){
$problem="The information you entered into the e-mail field contains illegal characters. This field should contain letters, numbers, the \@ symbol, and periods only. Please press BACK and fix this problem.";
&security;}
}
#STEP S====
sub addtemp{
#S1. This subroutine adds records to your temporary file for approval
#S2. Check variable sent
&getvariables;
#S3. Randomize in preparation for random generator
srand();
#S4. Get IP address of person posting record
$ipstamp=$ENV{'REMOTE_ADDR'};
#S5. Generate a large random number to serve as key
$randnumb=int(rand(9999999));
$replacementline="$ipstamp&&temp$randnumb(\+\+)$Icon$delimiter$Event$delimiter$Description$delimiter$Venue$delimiter$Day$delimiter$Month$delimiter$Year$delimiter$Time$delimiter$Website$delimiter$Email$delimiter$Public_Remarks$delimiter$Private_Remarks";
#S6. Write the temp record to the bottom of the
$problem="Can't write to the data file. Please verify its location and change its permissions to 777.";
open (FILE2,">>$tempdata") || &security;
print FILE2 "$replacementline\n";
close(FILE2);
print "Content-type: text/html\n\n";
print "
\n";
print "$templatestart\n";
#S7. Acknowledge that record has been posted
print "Your record has been sent to the WebMaster for approval. Please click here to return to the Events Calendar .. OR ... Use your Browser's Back Button to submit more Events.\n";
print "$templateend\n";
exit;
}
#STEP T====
sub scrolltemp{
#T1. This step is your interface with the temp file
#T2. Check password
if ($adminpassword ne $checkpassword && $adminpassword){
$problem="The password you entered does not match your administration password. Please press BACK on your browser to fix this problem.";
&security;}
#T3. Check to make sure that the data file can be opened.
$problem="Unable to open your temporary data file. It either contains no records, or the path to it is incorrect.";
open (FILE, "$tempdata") || &security;
@all=;
close (FILE);
print "Content-type: text/html\n\n";
#T4. Start showing contents of data file
print "$templatestart\n";
print "\n";}
else{
print "\n";}
print "$templateend\n";
exit;
}
#STEP U=======
sub updatetemp{
#U1. This step makes changes from temp file
#U2. Check password
if ($adminpassword ne $checkpassword && $adminpassword){
$problem="The password you entered does not match your administration password. Please press BACK on your browser to fix this problem.";
&security;}
$problem="Unable to open your temporary data file. It either contains no records, or the path to it is incorrect.";
open (FILE, "$tempdata") || &security;
@all=;
close (FILE);
foreach $line (@all){
$line=~s/\n//g;
$checkleng=length($line);
if ($checkleng<2){next};
($indexvalues,$stringvalues)=split(/\(\+\+\)/,$line);
($ipaddress,$uniqueapproval)=split(/&&/,$indexvalues);
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$stringvalues);
if ($tempapprove{$uniqueapproval} eq "A"){
push(@recordstoadd,$stringvalues);}
elsif ($tempapprove{$uniqueapproval} eq "D"){
push(@recordstodelete,$stringvalues);}
elsif ($tempapprove{$uniqueapproval} eq "E"){
push(@recordstoedit,$stringvalues);}
else {
push(@recordstohold,$line);}
}
$problem="Unable to open data file to add records. Check path to it and its permissions.";
open (FILE, ">>$data") || &security;
foreach $line (@recordstoadd){
$line=~s/\n//g;
print FILE "$line\n";}
close(FILE);
$problem="Unable to open data file to records to edit. Check path to it and its permissions.";
open (FILE, ">>$data") || &security;
foreach $line (@recordstoedit){
$line=~s/\n//g;
print FILE "markedtoedit$line\n";}
close(FILE);
$problem="Unable to open temporary file to refresh data. Check path to it and its permissions.";
open (FILE, ">$tempdata") || &security;
foreach $line (@recordstohold){
$line=~s/\n//g;
print FILE "$line\n";}
close(FILE);
$checkhold=@recordstohold;
if ($checkhold){
&scrolltemp;}
print "Content-type: text/html\n\n";
print "$templatestart\n";
print "
Your actions have been taken. Please click here to continue.
\n";
print "$templateend\n";
exit;
}
sub read{
my ($open_file)=@_;
open(DAT, "$open_file") ;
my @data=;
close(DAT);
return @data;
}
sub write{
my ($writeto_file,@write)=@_;
my ($abc,$output);
foreach $abc(@write){
$output="$output\n$abc";
for ($output){
s/^\s+//;
s/\s+$//;
}
}
flock(DAT, 2);
open(DAT,">$writeto_file");
print DAT "$output";
close(DAT);
flock(DAT, 8);
}
sub do_diff_check{
my(@today) = localtime(time);
$today[5]=$today[5]+1900;
$today[4]=$today[4]+1;
if($today[4]<10){
$today[4]="0$today[4]";
}
if($today[3]<10){
$today[3]="0$today[3]";
}
my $today_date="$today[5]$today[4]$today[3]";
my @data_temp=&read($data);
foreach my $line(@data_temp){
my(@fields)=split(/\t/,$line);
my $temp_date="$fields[6]$fields[5]$fields[4]";
if($temp_date < $today_date){
$diff_marker=1;
last;
}
}
my (@output);
if($diff_marker){
foreach my $line(@data_temp){
my(@fields)=split(/\t/,$line);
my $temp_date="$fields[6]$fields[5]$fields[4]";
if($temp_date >=$today_date){
push(@output,$line);
}
}
&write($data,@output);
}
}#!/usr/bin/perl
use CGI;
$query = new CGI;
#You need to modify this script at all parts of Step B
#Script Description
#Unique script ID: yel/coc/f/yel-5b2d
#Created on: 12/19/2001
#Last edited on: 12/19/2001
#Script class: D
#STEP A======
#A1. The following lines get and process data passed
#through the URL, do not modify
$stringpassed=$ENV{'QUERY_STRING'};
#A2. Replace all plusses with spaces for data passed via URL
$stringpassed=~s/\+/ /g;
#STEP B======
######################################################
# START OF CONFIGURATION
######################################################
#B1. REQUIRED: The location of event data file on your server.
$data="/home/mrgforce/public_html/usaent/cgi/ep/eventpublisher.txt";
#B1b. REQUIRED: The location of your TEMPORARY event data file on your server.
$tempdata="/home/mrgforce/public_html/usaent/cgi/ep/eventpublisher.tempdata";
#B1c. OPTIONAL: You can format the opening and closing HTML of your admin mode
$openinghtml="/home/mrgforce/public_html/usaent/ep/icons/template.htm";
$thisurl="http://www.usaentertainment.com/cgi/eventpublisher_pro-sm-today.cgi";
#B4. REQUIRED TO ADD, DELETE, OR MODIFY.
$adminpassword="t123";
$forwardingURL="http://www.usaentertainment.com/cgi/eventpublisher_pro-sm-today.cgi";
$baseurltoIcon="http://www.usaentertainment.com/ep/icons/";
$maximumpage=150;
#B18. Font settings of the event display
$fontface ="Verdana, Arial"; ### Recommended: "Verdana, Arial"
$fontsize= "1"; ### Used for event title and description only ###
$fonttitlecolor = "#990000";
$fontsubtitlecolor ="#000080"; ### Used for event sub titles such as "Venue", "Date" ....
#######################
# END OF CONFIGURATION
#######################
$maximum=1500;
@variablenames = $query->param;
foreach $variable (@variablenames){
$value=$query->param($variable);
$tempapprove{$variable}="$value";}
#STEP D================================
#You should not need to modify this section at all
#D1. Check to see if opening html file is on server
if (-e "$openinghtml"){
#D2. If so, open it and write opening and closing text to different strings
#to be used throughout the script
$problem="Can't open template file. Make sure you are referencing the file and not just a directory.";
open(OPENING, "$openinghtml") || &security;
@wholefile=;
close(OPENING);
$fulltemplate=join("\n",@wholefile);
($templatestart,$templateend)=split(/\+\+\+/,$fulltemplate);}
else{
#D3. If template file not found, use this for now
$templatestart="";
$templateend="";}
$delimiter="\t";
#D6. Get Password Entered by User
$checkpassword=$query->param('checkpassword');
#D7. Figure out what action user wants to take.
$actiontotake=$query->param('actiontotake');
$linenumberpass=$query->param('linenumberpass');
#D8. If user wants to delete record, and has already
#verified password, then go to the makechange subroutine
if ($actiontotake eq "Delete Record"){
$recordaction="Deleted";
&makechange;
exit;}
#D9. If user wants to edit record, and has already
#verified password, then go to the makechange subroutine
if ($actiontotake eq "Edit Record"){
$recordaction="Edited";
&makechange;
exit;}
#D10. If user wants to edit record, to go subroutine to verify
if ($actiontotake eq "Edit"){
&edit;
exit;}
#D11. If user wants to delete record, to go subroutine to verify
if ($actiontotake eq "Delete"){
&delete;
exit;}
#D12. If user wants to add record, go to add subroutine
if ($actiontotake eq "Add"){
&addrecord;
exit;}
#D13. If user wants to add record to temporary file
if ($actiontotake eq "Addtemp"){
&addtemp;
exit;}
#D14. If owner wants to evaluate records in temp file
if ($actiontotake eq "Scrolltemp"){
&scrolltemp;
exit;}
#D15. If user wants to update temp file
if ($actiontotake eq "Updatetemp"){
&updatetemp;
exit;}
#STEP E================================
#E1. Get the data passed from user
#PRO
$Icon=$query->param('Icon');
$Iconwork=lc($Icon);
$Iconwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Iconwork eq "select"){
$Iconwork="";
$Icon="";}
$Iconpass="$Icon";
#E1. Get the data passed from user
$Event=$query->param('Event');
$Eventwork=lc($Event);
#PRO
$Eventwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Eventwork eq "select"){
$Eventwork="";
$Event="";}
$Eventpass="$Event";
#E1. Get the data passed from user
$Description=$query->param('Description');
$Descriptionwork=lc($Description);
#PRO
$Descriptionwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Descriptionwork eq "select"){
$Descriptionwork="";
$Description="";}
$Descriptionpass="$Description";
#E1. Get the data passed from user
$Venue=$query->param('Venue');
$Venuework=lc($Venue);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Venuework=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Venuework eq "select"){
$Venuework="";
$Venue="";}
$Venuepass="$Venue";
#E1. Get the data passed from user
$Month=$query->param('Month');
$Monthwork=lc($Month);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Monthwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Monthwork eq "select"){
$Monthwork="";
$Month="";}
$Monthpass="$Month";
#E1. Get the data passed from user
$Day=$query->param('Day');
$Daywork=lc($Day);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Daywork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Daywork eq "select"){
$Daywork="";
$Day="";}
$Daypass="$Day";
#E1. Get the data passed from user
$Year=$query->param('Year');
$Yearwork=lc($Year);
#PRO
#E1b. The line below chops characters that cause problems in Perl word searches
$Yearwork=~tr/[a-zA-Z0-9 \-\.\,\?]/ /cd;
if ($Yearwork eq "select"){
$Yearwork="";
$Year="";}
$Yearpass="$Year";
#E6. Get number of records already displayed
$startitem=$query->param('startitem');
#E7. Figure the last record to display on this page
$enditem=$startitem+$maximumpage;
#F4a. Support for European characters.
#PRO
($Iconone, $Icontwo, $Iconthree, $Iconfour, $Iconfive, $Iconsix, $Iconseven)=split(/ /, $Iconwork);
#F4a. Support for European characters.
($Eventone, $Eventtwo, $Eventthree, $Eventfour, $Eventfive, $Eventsix, $Eventseven)=split(/ /, $Eventwork);
#F4a. Support for European characters.
$Lo1="P"; $Lo2="is";
($Descriptionone, $Descriptiontwo, $Descriptionthree, $Descriptionfour, $Descriptionfive, $Descriptionsix, $Descriptionseven)=split(/ /, $Descriptionwork);
$Text1="Fr"; $Text2="Ev"; $Text3="her";
#F4a. Support for European characters.
$Hi1="ee"; $Hi2="ent"; $Hi3="ubl";
($Venueone, $Venuetwo, $Venuethree, $Venuefour, $Venuefive, $Venuesix, $Venueseven)=split(/ /, $Venuework);
#F4a. Support for European characters.
($Monthone, $Monthtwo, $Monththree, $Monthfour, $Monthfive, $Monthsix, $Monthseven)=split(/ /, $Monthwork);
($Dayone, $Daytwo, $Daythree, $Dayfour, $Dayfive, $Daysix, $Dayseven)=split(/ /, $Daywork);
#F4a. Support for European characters.
$comp1="INT"; $comp2="O"; $comp3="U"; $lcomp1="int"; $lcomp2="po"; $lcomp3="u";
$and1="b"; $and2="y";
($Yearone, $Yeartwo, $Yearthree, $Yearfour, $Yearfive, $Yearsix, $Yearseven)=split(/ /, $Yearwork);
#STEP G================================
#Do not modify this section
#G1. Open datafile and write contents to an array, if can't open report the problem at the security subroutine
$problem="You do not have a file to search on the server. Please ADD test records before trying to search your test data file.";
open (FILE, "$data") || &security;
@all=;
close (FILE);
#G2. The line below is required, do not modify
print "Content-type: text/html\n\n";
#G3. Display HTML Header
if ($adminpassword eq $checkpassword){
print "$templatestart\n";}
else {
######### Show Top of Page with Graphic, Search & Submit Links
#print "
\n";
####### Show Day & Date on Page
@timedisp = localtime(time + (86400 * 6));
@months = qw(January February March April May June July August September October November December);
@dayofweek = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday);
$monthdisp = $months[$timedisp[4]];
$daydisp = $dayofweek[$timedisp[6]];
$monthtemp = @timedisp[4]+1;
$daytemp = @timedisp[3];
$Month = $monthtemp;
$Day = $daytemp;
$Monthpass="$Month";
$Daypass="$Day";
print"\n";
#print "
Click Here for the Complete Calendar \n";
}
#print "";}
#STEP H==========
#H1. Read each line of the data file, compare with search words
foreach $line (@all){
$line=~s/\n//g;
$loopsaround++;
$checkleng=length($line);
if ($checkleng<2){next};
$linetemp1=lc($line);
#H1a. Support for European characters.
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetemp1);
#H9. This line specifies the fields to sort results by
$line="$Year$Month$Day$Event$delimiter$loopsaround$delimiter$line";
#H9.5 This line removes stray leading spaces before sorting your results
$line=~s/^ +//;
$increcount=0;
#PRO
#H12. Look for matches in field named Icon
if (($Icon =~/\b$Iconone/ && $Icon =~/\b$Icontwo/ && $Icon =~/\b$Iconthree/ && $Icon =~/\b$Iconfour/ && $Icon =~/\b$Iconfive/ && $Icon=~/\b$Iconsix/ && $Icon=~/\b$Iconseven/) || !$Iconwork) {
$increcount++;}
#H12. Look for matches in field named Event
if (($Event =~/\b$Eventone/ && $Event =~/\b$Eventtwo/ && $Event =~/\b$Eventthree/ && $Event =~/\b$Eventfour/ && $Event =~/\b$Eventfive/ && $Event=~/\b$Eventsix/ && $Event=~/\b$Eventseven/) || !$Eventwork) {
$increcount++;}
#H12. Look for matches in field named Description
if (($Description =~/\b$Descriptionone/ && $Description =~/\b$Descriptiontwo/ && $Description =~/\b$Descriptionthree/ && $Description =~/\b$Descriptionfour/ && $Description =~/\b$Descriptionfive/ && $Description=~/\b$Descriptionsix/ && $Description=~/\b$Descriptionseven/) || !$Descriptionwork) {
$increcount++;}
#H12. Look for matches in field named Venue
if (($Venue =~/\b$Venueone/ && $Venue =~/\b$Venuetwo/ && $Venue =~/\b$Venuethree/ && $Venue =~/\b$Venuefour/ && $Venue =~/\b$Venuefive/ && $Venue=~/\b$Venuesix/ && $Venue=~/\b$Venueseven/) || !$Venuework) {
$increcount++;}
#H12. Look for matches in fields named Month & Day
if ($Monthpass == "" && $Daypass == "") {
$increcount++;}
elsif ($Monthpass == $Month && $Daypass == "") {
$increcount++;}
elsif ($Monthpass == "" && $Daypass == $Day) {
$increcount++;}
elsif ($Monthpass == $Month && $Daypass == $Day && $Year == ($timedisp[5] + 1900)) {
$increcount++;}
#H12. Look for matches in field named Year
if (($Year =~/\b$Yearone/ && $Year =~/\b$Yeartwo/ && $Year =~/\b$Yearthree/ && $Year =~/\b$Yearfour/ && $Year =~/\b$Yearfive/ && $Year=~/\b$Yearsix/ && $Year=~/\b$Yearseven/) || !$Yearwork) {
$increcount++;}
if ($line=~/markedtoedit/ && $actiontotake eq "markedtoedit"){
$line=~s/markedtoedit//g;
push (@keepers2,$line);}
$line=~s/markedtoedit//g;
if ($increcount==6){
push (@keepers,$line);}}
#STEP J=======
if ($actiontotake eq "markedtoedit"){
@keepers=@keepers2;}
#J1. Sort matches stored in array.
@keepers=sort(@keepers);
#J2. Get and display number of matches found
$length1=@keepers;
#J3. If the number of matches is less than enditem, adjust
if ($length1<$enditem){
$enditem=$length1;
$displaystat="Y";}
#J4. The first field about to display
$disstart=$startitem+1;
##### Show Total Posted
#J5. Show user total number of matches found & display on screen
#if ($length1){
#print "Total Events Posted For Today ... $length1<\/font>\n";
#} else {
#print "
No Local Events Found.<\/B> Press your Browsers Back Button and try again.<\/P>\n";}
#STEP K=====
#K1. Do some HTML formatting before showing results
print "
\n";
#K4. Keep track of results processed on this page
foreach $line (@keepers){
#K5. Delete stray hard returns
$line=~s/\n//g;
#K6. Keep track of records displayed
$countline1++;
#K7. Decide whether or not this record goes on this page
if ($countline1>$startitem && $countline1<=$enditem){
#K8. Open each line of sorted array for displaying
($sortfield,$loopsaround,$Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$line);
if ($Month eq "01"){
$Month2 = "January";}
if ($Month eq "02"){
$Month2 = "February";}
if ($Month eq "03"){
$Month2 = "March";}
if ($Month eq "04"){
$Month2 = "April";}
if ($Month eq "05"){
$Month2 = "May";}
if ($Month eq "06"){
$Month2 = "June";}
if ($Month eq "07"){
$Month2 = "July";}
if ($Month eq "08"){
$Month2 = "August";}
if ($Month eq "09"){
$Month2 = "September";}
if ($Month eq "10"){
$Month2 = "October";}
if ($Month eq "11"){
$Month2 = "November";}
if ($Month eq "12"){
$Month2 = "December";}
#K15. Formatting for ad separating line.
#print "
\n";
#K15. Formatting for field Day. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Day){
#print "
Date:
$daydisp .. $Month2 $Day, #$Year
\n";}
#K15. Formatting for field Event. If you add any HTML, make sure you
#if ($Icon){
print "
$Month\/$Day -
$Event ... $Time @ $Venue
\n";
#else {
#print "
$Event
\n";}
#K15. Formatting for field Venue. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Venue){
#print "
\n";}
#K15. Formatting for field Time. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Time){
#print "
Time:
$Time
\n";}
#K15. Formatting for field Website. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Website){
#print "
\n";}
#K15. Formatting for field Email. If you add any HTML, make sure you
#put a backslash in front of all quote marks inside print statements
#if ($Email){
#print "
\n";}
#K15. Formatting for field Description.
#if ($Description){
#print "
$Description
\n";}
#print "
Info:
$Description
\n";}
#K15. Formatting for field Public_Remarks.
#if ($Public_Remarks){
#print "
$Public_Remarks
\n";}
#K11. Check passwords before showing edit and delete buttons
#if ($adminpassword eq $checkpassword){
#print "
\n";}
#STEP L====
#L1. If total displayed equals maximum you set, then exit
if ($countline1 == $maximum && $maximum){
$problem2="Your search was terminated because there were more than $maximum matching records found, please be more specific in your search";
last;}
#L2. If script just got to last match then exit program
if ($length1 == $countline1){
last;}
#L3. If script is at the end of a page then show NEXT button
if ($countline1 == $enditem && $displaystat ne "Y" && $maximum>$countline1){
$stopit="Y";
last;
}
}}
print "
\n";
$fcc="f"; $fcd="1"; $fce="w"; $fcf="tp"; $fcg="dn"; $fci="e";
$checkfcc="ne"; $checkfcd="t"; $checkfcf="s"; $checkfcg="ef"; $checkfci="ank"; $checkfcj="_bl";
$mer1="";
$mer3=" ";
# Formatting for separating line at bottom above Next Button.
#print "
\n";
#L4. Display NEXT MATCHES button
if ($stopit eq "Y"){
print "\n";
#L5. Pass hidden variables so script will know how to display next page
#PRO
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";
print " \n";}
$errormode ="$mer1";
#if (($stopit eq "Y") and ($adminpassword eq $checkpassword)){
######### Next Button
#if ($stopit eq "Y"){
#print " \n";
######### Copyright
#print "Copyright © 1998-2006 ... All Rights Reserved \n";
#print "TAMPABAYENTERTAINMENT.COM \n";
#print "A Member of the OLTB.COM Information Network
#A Division of USAEntertainment.Com ... and ... \n";
#print "TampaBayMusicScene.Com \n";
#}
#elsif ($stopit ne "Y"){
######### Copyright
#print "Copyright © 1998-2006 ... All Rights Reserved \n";
#print "TAMPABAYENTERTAINMENT.COM \n";
#print "A Member of the OLTB.COM Information Network
#A Division of USAEntertainment.Com ... and ... \n";
#print "TampaBayMusicScene.Com \n";
#}
#L6. Show problems
if ((!$mer1) or (!$mer2) or (!$mer3)){
&low;}
if ($problem2){
print "$problem2";}
else {
print "$mer3";
}
#L8. If opening.htm was found, show its closing html codes
if (!$errormode) {
&low;}
srand();
$checkval=int(rand(30));
if ($checkval==3){
print "";}
if ($adminpassword eq $checkpassword){
print "$templateend\n";}
else {
print "";}
exit;
#STEP M=====
sub security{
#M1. This is the subroutine that reports all problems
print "Content-type: text/html\n\n";
print "$templatestart\n";
print "
Data Error
\n";
print "Please correct the following error:
$problem
\n";
print "$templateend\n";
exit;
}
sub low{
#M1. This is the subroutine that reports all problems
print "$templatestart\n";
print "
Data Error
\n";
print "Error:
Script Corrupted!
\n";
print "$templateend\n";
exit;
}
#STEP N=====
sub edit{
#N1. Open data file and read it
$problem="Can't open data file to read from it at edit subroutine";
open (FILE,"$data") || &security;
@all=;
close (FILE);
#N2. Read each line of the data file
foreach $line (@all){
$line=~s/\n//g;
($copyIcon,$copyEvent,$copyDescription,$copyVenue,$copyDay,$copyMonth,$copyYear,$copyTime,$copyWebsite,$copyEmail,$copyPublic_Remarks,$copyPrivate_Remarks,$skipthisfield)=split (/$delimiter/,$line);
$keepcount++;
#N3. Find the line user wants to modify
if ($keepcount==$linenumberpass){
$linetokeep=$line;
$linetokeep=~s/markedtoedit//g;
last;
}
}
#N4. Check password sent via hidden field
if ($adminpassword ne $checkpassword){
$problem="Your password does not match the master password, please re-enter.";
&security;}
#N6. Split matching line into its respective variables
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetokeep);
#Required Header, do not delete
print "Content-type: text/html\n\n";
#N8. If can't find opening html, display default header
print "$templatestart\n";
print "
Admin Mode: Edit this Record\n";
print "
\n";
print "$templateend\n";
exit;
}
#STEP O====
sub delete{
#O1. Open data file and read it
$problem="Can't open data file to read from it at delete subroutine";
open (FILE,"$data") || &security;
@all=;
close (FILE);
#O2. Read each line of the file
foreach $line (@all){
$line=~s/\n//g;
($copyIcon,$copyEvent,$copyDescription,$copyVenue,$copyDay,$copyMonth,$copyYear,$copyTime,$copyWebsite,$copyEmail,$copyPublic_Remarks,$copyPrivate_Remarks,$skipthisfield)=split (/$delimiter/,$line);
$keepcount++;
#O3. Find line to delete
if ($keepcount==$linenumberpass){
$linetokeep=$line;
$linetokeep=~s/markedtoedit//g;
last;
}
}
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetokeep);
#O4. Check password sent via hidden field
if ($adminpassword ne $checkpassword){
$problem="Your password does not match the master password.";
&security;}
#O6. Required Header, do not delete
print "Content-type: text/html\n\n";
print "$templatestart\n";
print "
Admin Mode: Delete this Record?\n";
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$linetokeep);
#O7. Show validation HTML
print "
\n";
#If opening.htm was not found, show default closing html codes
print "$templateend\n";
exit;
}
#STEP P======
sub makechange{
#P1. Go to get variable subroutine and make sure add preferences apply
if ($recordaction eq "Edited"){
&getvariables;}
#P2. This step either replaces or empties the existing line
if ($recordaction eq "Deleted"){
$replacementline="";}
else{
$replacementline="$Icon$delimiter$Event$delimiter$Description$delimiter$Venue$delimiter$Day$delimiter$Month$delimiter$Year$delimiter$Time$delimiter$Website$delimiter$Email$delimiter$Public_Remarks$delimiter$Private_Remarks";}
$problem="Can't open data file to read from it";
open (FILE,"$data") || &security;
@all=;
close (FILE);
$linenumberpass--;
$all[$linenumberpass]=$replacementline;
$problem="Can't open temporary file. You need to chmod 777 the directory your data file is in. See the help files under Permissions for Class B Scripts.";
#P6. Write the entire changed file to a temporary file
open (FILE2,">$data.tmp") || &security;
foreach $line (@all){
$line=~s/\n//g;
print FILE2 "$line\n";}
close(FILE2);
#P7. Rename the temp file to your master data file
$problem="Can't rename file after making change";
rename("$data.tmp", "$data") || &security;
print "Content-type: text/html\n\n";
#P8. If can't find opening html, display default header
print "$templatestart\n";
print "Your record has been $recordaction. Please click here to continue.\n";
close (FILE);
#If opening.htm was not found, show default closing html codes
print "$templateend\n";
exit;
}
#STEP Q===
#This subroutine adds records to your database
sub addrecord{
#Q1. Check password
if ($adminpassword ne $checkpassword && $adminpassword){
$problem="The password you entered does not match your administration password. Please press BACK on your browser to fix this problem.";
&security;}
&getvariables;
$replacementline="$Icon$delimiter$Event$delimiter$Description$delimiter$Venue$delimiter$Day$delimiter$Month$delimiter$Year$delimiter$Time$delimiter$Website$delimiter$Email$delimiter$Public_Remarks$delimiter$Private_Remarks";
#Q3. Write the new record to the bottom of the data file
$problem="Can't write to the data file. Please verify its location and change its permissions to 777.";
open (FILE2,">>$data") || &security;
print FILE2 "$replacementline\n";
close(FILE2);
print "Content-type: text/html\n\n";
#Q4. If can't find opening html, display default header
print "$templatestart\n";
print "Your record has been added. Please click here to continue.\n";
#If opening.htm was not found, show default closing html codes
print "$templateend\n";
exit;
}
#STEP R===
sub getvariables{
#R1. This step checks your variables before adding/editing them
$Icon=$query->param('Icon');
$Event=$query->param('Event');
$Description=$query->param('Description');
$Private_Remarks=$query->param('Private_Remarks');
$Venue=$query->param('Venue');
if ($Venue eq "Choose From The Many Venues Listed Here ... Or Enter the Info Below"){
$Venue=$Private_Remarks;}
$Day=$query->param('Day');
$Month=$query->param('Month');
$Year=$query->param('Year');
$Time=$query->param('Time');
$Website=$query->param('Website');
$Email=$query->param('Email');
$Public_Remarks=$query->param('Public_Remarks');
#R3. Replace hard returns with , cut carriage returns
$Icon=~s/\n/ /g;
$Icon=~s/\r//g;
if ($Icon eq "Select"){
$Icon="";}
#R3. Replace hard returns with , cut carriage returns
$Event=~s/\n/ /g;
$Event=~s/\r//g;
if ($Event eq "Select"){
$Event="";}
#R3. Replace hard returns with , cut carriage returns
$Description=~s/\n/ /g;
$Description=~s/\r//g;
if ($Description eq "Select"){
$Description="";}
#R3. Replace hard returns with , cut carriage returns
$Venue=~s/\n/ /g;
$Venue=~s/\r//g;
if ($Venue eq "Select"){
$Venue="";}
#R3. Replace hard returns with , cut carriage returns
$Day=~s/\n/ /g;
$Day=~s/\r//g;
if ($Day eq "Select"){
$Day="";}
#R3. Replace hard returns with , cut carriage returns
$Month=~s/\n/ /g;
$Month=~s/\r//g;
if ($Month eq "Select"){
$Month="";}
#R3. Replace hard returns with , cut carriage returns
$Year=~s/\n/ /g;
$Year=~s/\r//g;
if ($Year eq "Select"){
$Year="";}
#R3. Replace hard returns with , cut carriage returns
$Time=~s/\n/ /g;
$Time=~s/\r//g;
if ($Time eq "Select"){
$Time="";}
#R3. Replace hard returns with , cut carriage returns
$Website=~s/\n/ /g;
$Website=~s/\r//g;
if ($Website eq "Select"){
$Website="";}
#R3. Replace hard returns with , cut carriage returns
$Email=~s/\n/ /g;
$Email=~s/\r//g;
if ($Email eq "Select"){
$Email="";}
#R3. Replace hard returns with , cut carriage returns
$Public_Remarks=~s/\n/ /g;
$Public_Remarks=~s/\r//g;
if ($Public_Remarks eq "Select"){
$Public_Remarks="";}
#R3. Replace hard returns with , cut carriage returns
$Private_Remarks=~s/\n/ /g;
$Private_Remarks=~s/\r//g;
if ($Private_Remarks eq "Select"){
$Private_Remarks="";}
#R4. You have marked Event as a field that must contain at least 2
$Eventcheck=$Event;
$Eventcheck=~s/ +/ /g;
$Eventcheck=length($Eventcheck);
if ($Eventcheck<2){
$problem="Please press back on your browser and provide more information for the .. Event .. field.";
&security;}
#R4. You have marked Description as a field that must contain at least 2
$Venuecheck=$Venue;
$Venuecheck=~s/ +/ /g;
$Venuecheck=length($Venuecheck);
if ($Venuecheck<2){
$problem="Please press the Back Button on your browser and provide more information for the .. Venue .. Field. It is either not indicated in the dropdown box or not indicated in the additional field provided";
&security;}
#R4. You have marked Day as a field that must contain at least 1
$Daycheck=$Day;
$Daycheck=~s/ +/ /g;
$Daycheck=length($Daycheck);
if ($Daycheck<1){
$problem="Please press back on your browser and provide more information for the .. Day .. field.";
&security;}
#R4. You have marked Month as a field that must contain at least 1
#non-blank characters before allowing the field to be added. You can change the
#requirement below, or comment out all 6 lines below step to skip validation
$Monthcheck=$Month;
$Monthcheck=~s/ +/ /g;
$Monthcheck=length($Monthcheck);
if ($Monthcheck<1){
$problem="Please press back on your browser and provide more information for the .. Month .. field.";
&security;}
#R4. You have marked Year as a field that must contain at least 2
#non-blank characters before allowing the field to be added. You can change the
#requirement below, or comment out all 6 lines below step to skip validation
$Yearcheck=$Year;
$Yearcheck=~s/ +/ /g;
$Yearcheck=length($Yearcheck);
if ($Yearcheck<2){
$problem="Please press back on your browser and provide more information for the .. Year .. field.";
&security;}
#R4. You have marked Time as a field that must contain at least 2
$Timecheck=$Time;
$Timecheck=~s/ +/ /g;
$Timecheck=length($Timecheck);
if ($Timecheck<2){
$problem="Please press back on your browser and provide more information for the .. Time .. field - at least 2 letters or numbers.";
&security;}
#R10. You have marked Email as a field that must contain a valid e-mail
#Address, OR, be empty. To remove requirement, comment out 9 lines below
$Emailcheck=$Email;
($firstpart,$secondpart)=split(/\@/,$Emailcheck);
if ($Email && (!$firstpart || !$secondpart || $secondpart!~/\./)){
$problem="The information you have provided in the e-mail field does not look like a valid e-mail address. Please press back on your browser and fix this problem.";
&security;}
#R11. Remove characters that could cause security issues in e-mail field
if ($Emailcheck =~/[\!\|\~\^\'\"]/){
$problem="The information you entered into the e-mail field contains illegal characters. This field should contain letters, numbers, the \@ symbol, and periods only. Please press BACK and fix this problem.";
&security;}
}
#STEP S====
sub addtemp{
#S1. This subroutine adds records to your temporary file for approval
#S2. Check variable sent
&getvariables;
#S3. Randomize in preparation for random generator
srand();
#S4. Get IP address of person posting record
$ipstamp=$ENV{'REMOTE_ADDR'};
#S5. Generate a large random number to serve as key
$randnumb=int(rand(9999999));
$replacementline="$ipstamp&&temp$randnumb(\+\+)$Icon$delimiter$Event$delimiter$Description$delimiter$Venue$delimiter$Day$delimiter$Month$delimiter$Year$delimiter$Time$delimiter$Website$delimiter$Email$delimiter$Public_Remarks$delimiter$Private_Remarks";
#S6. Write the temp record to the bottom of the
$problem="Can't write to the data file. Please verify its location and change its permissions to 777.";
open (FILE2,">>$tempdata") || &security;
print FILE2 "$replacementline\n";
close(FILE2);
print "Content-type: text/html\n\n";
print "
\n";
print "$templatestart\n";
#S7. Acknowledge that record has been posted
print "Your record has been sent to the WebMaster for approval. Please click here to return to the Events Calendar .. OR ... Use your Browser's Back Button to submit more Events.\n";
print "$templateend\n";
exit;
}
#STEP T====
sub scrolltemp{
#T1. This step is your interface with the temp file
#T2. Check password
if ($adminpassword ne $checkpassword && $adminpassword){
$problem="The password you entered does not match your administration password. Please press BACK on your browser to fix this problem.";
&security;}
#T3. Check to make sure that the data file can be opened.
$problem="Unable to open your temporary data file. It either contains no records, or the path to it is incorrect.";
open (FILE, "$tempdata") || &security;
@all=;
close (FILE);
print "Content-type: text/html\n\n";
#T4. Start showing contents of data file
print "$templatestart\n";
print "\n";}
else{
print "\n";}
print "$templateend\n";
exit;
}
#STEP U=======
sub updatetemp{
#U1. This step makes changes from temp file
#U2. Check password
if ($adminpassword ne $checkpassword && $adminpassword){
$problem="The password you entered does not match your administration password. Please press BACK on your browser to fix this problem.";
&security;}
$problem="Unable to open your temporary data file. It either contains no records, or the path to it is incorrect.";
open (FILE, "$tempdata") || &security;
@all=;
close (FILE);
foreach $line (@all){
$line=~s/\n//g;
$checkleng=length($line);
if ($checkleng<2){next};
($indexvalues,$stringvalues)=split(/\(\+\+\)/,$line);
($ipaddress,$uniqueapproval)=split(/&&/,$indexvalues);
($Icon,$Event,$Description,$Venue,$Day,$Month,$Year,$Time,$Website,$Email,$Public_Remarks,$Private_Remarks,$skipthisfield)=split (/$delimiter/,$stringvalues);
if ($tempapprove{$uniqueapproval} eq "A"){
push(@recordstoadd,$stringvalues);}
elsif ($tempapprove{$uniqueapproval} eq "D"){
push(@recordstodelete,$stringvalues);}
elsif ($tempapprove{$uniqueapproval} eq "E"){
push(@recordstoedit,$stringvalues);}
else {
push(@recordstohold,$line);}
}
$problem="Unable to open data file to add records. Check path to it and its permissions.";
open (FILE, ">>$data") || &security;
foreach $line (@recordstoadd){
$line=~s/\n//g;
print FILE "$line\n";}
close(FILE);
$problem="Unable to open data file to records to edit. Check path to it and its permissions.";
open (FILE, ">>$data") || &security;
foreach $line (@recordstoedit){
$line=~s/\n//g;
print FILE "markedtoedit$line\n";}
close(FILE);
$problem="Unable to open temporary file to refresh data. Check path to it and its permissions.";
open (FILE, ">$tempdata") || &security;
foreach $line (@recordstohold){
$line=~s/\n//g;
print FILE "$line\n";}
close(FILE);
$checkhold=@recordstohold;
if ($checkhold){
&scrolltemp;}
print "Content-type: text/html\n\n";
print "$templatestart\n";
print "
Your actions have been taken. Please click here to continue.
\n";
print "$templateend\n";
exit;
}
sub read{
my ($open_file)=@_;
open(DAT, "$open_file") ;
my @data=;
close(DAT);
return @data;
}
sub write{
my ($writeto_file,@write)=@_;
my ($abc,$output);
foreach $abc(@write){
$output="$output\n$abc";
for ($output){
s/^\s+//;
s/\s+$//;
}
}
flock(DAT, 2);
open(DAT,">$writeto_file");
print DAT "$output";
close(DAT);
flock(DAT, 8);
}
sub do_diff_check{
my(@today) = localtime(time);
$today[5]=$today[5]+1900;
$today[4]=$today[4]+1;
if($today[4]<10){
$today[4]="0$today[4]";
}
if($today[3]<10){
$today[3]="0$today[3]";
}
my $today_date="$today[5]$today[4]$today[3]";
my @data_temp=&read($data);
foreach my $line(@data_temp){
my(@fields)=split(/\t/,$line);
my $temp_date="$fields[6]$fields[5]$fields[4]";
if($temp_date < $today_date){
$diff_marker=1;
last;
}
}
my (@output);
if($diff_marker){
foreach my $line(@data_temp){
my(@fields)=split(/\t/,$line);
my $temp_date="$fields[6]$fields[5]$fields[4]";
if($temp_date >=$today_date){
push(@output,$line);
}
}
&write($data,@output);
}
}