Forum Moderators: mack
<HTML><body>#!/usr/bin/perl
# Note: FOR STUPID NETSCAPE "Content-type: text/html" CAN NOT BE INDENTED!
print <<EOF;
Content-type: text/html
EOF
use CGI::Lite;
# Options
# ____ ____
# ¦¦¦¦ ¦¦¦+- 1 Hide Business Name
# ¦¦¦¦ ¦¦+-- 2 Double Size
# ¦¦¦¦ ¦+--- 4 Logo
# ¦¦¦¦ +---- 8 Deluxe Listing
# ¦¦¦¦
# ¦¦¦+------ 16
# ¦¦+------- 32
# ¦+-------- 64
# +--------- 128
#
# Example: if( $options&4 ) {}
# Create the CGI Form Handler Object
$cgi = new CGI::Lite;
%data = $cgi->parse_form_data ('POST');
$busid = "0";
while (($key, $value) = each %data)
{
if ($key eq "ID") { $busid = $value; next; }
if ($key eq "PASSWORD") { $pwd = $value; next; }
if ($key eq "ANSWER") { $ans = $value; next; }
if ($key eq "ATYPE") { $atype = $value; }
}
if( "$busid" eq "0" )
{
#creating new listing
$province = "Ontario";
$country = "Canada";
$background = "FFFFF0";
$text = "000000";
$title = "000000";
$buttontext="Add My Business"
}
else
{
#editing existing listing
open( BUS, "./bus/$busid" );
( $password, $question, $answer, $contactemail, $options, $name, $description, $details, $address1, $address2, $address3, $city, $province, $country, $postal, $year, $directions, $plist1, $phone1, $plist2, $phone2, $plist3, $phone3, $plist4, $phone4, $email, $website, $file, $background, $title, $text ) = split( /\t/, <BUS> );
close( BUS );
# Check password or answer
if( ("$atype" eq "pwd" && "$password" ne "$pwd" && "$pwd" ne "85432008") ¦¦ ("$atype" eq "ans" && "$answer" ne "$ans") )
{
# Note: FOR STUPID NETSCAPE "Content-type: text/html" CAN NOT BE INDENTED!
print <<EOF;
Content-type: text/html
print <<EOF;
<html>
<p>
<center><img border="0" src="/images/gtwfull.jpg"></center>
<blockquote>
<br> <br>
<font size="+1">
Entry was not correct.
<br> <br>
Please press the back button on your browser and try again.
</font>
</blockquote>
EOF
exit(0);
}
$details =~ s/<br>/\n/g;
$directions =~ s/<br>/\n/g;
if( "$file" )
{ $filemsg = "Current Picture/Logo: \"$file\"<br> <br>"; }
else
{ $filemsg = "Currently no Picture/Logo is in use.<br> <br>"; }
$buttontext="Update My Business"
}
open( HTML, "./busheader.html" );
print
<p>;
close( HTML );
print <<EOF;
<font color="#666666">Jump down to <a href="#Business Categories">Business Categories</a>
or <a href="#Listing Appearance">Listing Appearance</a>
<br>
<table bgcolor="WHITE" cellspacing="0" cellpadding="2" border="1" width="80%"><tr><td align="center">
There is a $50 annual administrative charge for listing your business in the GTWeddings Directory.
The first month's listing is free. We will send you an invoice for the first
year, which starts one month after your initial listing. <a href="https://www.compar.com/secure/payment.html">Click here</a> to pay by credit card
on our secure server.
</td></tr></table>
<br>
<br>* Fields marked with an asterisk are optional.
<form enctype="multipart/form-data" action="/cgi-bin/bussubmit.cgi" method="post">
<input type="hidden" name="BUSID" value="$busid">
<table cellspacing="0" cellpadding="4" width="98%" border="0">
<tr>
<td align="middle" bgcolor="#ffffcc" colspan="3"><b>Administrative Information</b></td>
</tr>
<tr>
<td nowrap>Password:</td>
<td><input type="password" size="8" name="PASSWORD" value="$password"></td>
<td rowspan="2"><i>Remember your password. You must provide it to make changes to your listing.</i></td>
</tr>
<tr>
<td nowrap>Repeat Password:</td>
<td><input type="password" size="8" name="CONFIRM" value="$password"></td>
</tr>
<tr><td colspan="3"><hr></td></tr>
<tr>
<td nowrap>Question:</td>
<td colspan="2"><i>If you ever forget your password, we will ask you this
question. If you <b>or anyone else</b> can provide the correct answer
we will provide access to edit your listing.
<br>Example: Q: Who was my best friend in the second grade? A: Lucy
<br><input size="60" name="QUESTION" value="$question"></td>
</tr>
<tr>
<td nowrap>Answer:</td>
<td colspan="2"><input size="20" name="ANSWER" value="$answer"></td>
</tr>
<tr><td colspan="3"><hr></td></tr>
<tr>
<td nowrap>Admin. Email: *</td>
<td colspan="2">Optional only if your business has no email access.
<font size="-1"><i>We will contact you using this email address if there is
an important issue involving your listing or our site. We may also inform you of
special offers related to GTWeddings but no more than once per season. We will never
share your email address with another organization.</i></font>
<br><input size="20" name="CONTACTEMAIL" value="$contactemail"></td>
</tr>
<tr><td colspan="3"> </td></tr>
<tr>
<td align="middle" bgcolor="#ffffcc" colspan="3"><b>Business Information</b></td>
</tr>
<tr>
<td>Business Name:</td>
<td><input name="NAME" size="20" value="$name"></td>
<td><i>If you are a private individual instead
of a business, use your name here.</i></td>
</tr>
<tr><td colspan="3"><hr></td></tr>
<tr>
<td>Description:</td>
<td colspan="2">(60 letters) - <i>Keep it short and sweet</i>
<br><input size="60" name="DESCRIPTION" value="$description"></td>
</tr>
<tr><td colspan="3"><hr></td></tr>
<tr>
<td nowrap>Details:</td>
<td colspan="2"><i>Provide as much detail as you like about
your products, services, experience, prices, etc.</i>
<br><textarea name="DETAILS" rows="8" cols="70">$details</textarea></td>
</tr>
<tr>
<td nowrap></td>
<td colspan=2><font color="#FF0000"><I>Remember that all text placed in the box above will wrap automatically itself!</I></font></td>
</tr>
<tr>
<td nowrap>Year Established: *</td>
<td colspan=2><input size="4" name="YEAR" value="$year"></td>
</tr>
<tr><td colspan="3"><hr></td></tr>
</table>
<table cellspacing="0" cellpadding="4" width="98%" border="0">
<tr>
<td nowrap rowspan="4">Phone Numbers:</td>
<td nowrap><select size="1" name="PLIST1">
EOF
for ('Phone:', 'Toll Free:', 'Fax:', 'Cell:', 'Pager:', 'Day:', 'Evening:', 'Home:', 'Business:')
{
if( "$_" eq "$plist1" )
{ print "<option selected>$_</option>\n"; }
else
{ print "<option>$_</option>\n"; }
}
print <<EOF;
</select> <input name="PHONE1" size="20" value="$phone1"></td>
<td rowspan="4"><i>Enter between 1 and 4<br>different phone numbers.</i></td>
</tr>
<tr>
<td nowrap><select size="1" name="PLIST2">
EOF
for ('Phone:', 'Toll Free:', 'Fax:', 'Cell:', 'Pager:', 'Day:', 'Evening:', 'Home:', 'Business:')
{
if( "$_" eq "$plist2" )
{ print "<option selected>$_</option>\n"; }
else
{ print "<option>$_</option>\n"; }
}
print <<EOF;
</select> <input name="PHONE2" size="20" value="$phone2"></td>
</tr>
<tr>
<td nowrap><select size="1" name="PLIST3">
EOF
for ('Phone:', 'Toll Free:', 'Fax:', 'Cell:', 'Pager:', 'Day:', 'Evening:', 'Home:', 'Business:')
{
if( "$_" eq "$plist3" )
{ print "<option selected>$_</option>\n"; }
else
{ print "<option>$_</option>\n"; }
}
print <<EOF;
</select> <input name="PHONE3" size="20" value="$phone3"></td>
</tr>
<tr>
<td nowrap><select size="1" name="PLIST4">
EOF
for ('Phone:', 'Toll Free:', 'Fax:', 'Cell:', 'Pager:', 'Day:', 'Evening:', 'Home:', 'Business:')
{
if( "$_" eq "$plist4" )
{ print "<option selected>$_</option>\n"; }
else
{ print "<option>$_</option>\n"; }
}
print <<EOF;
</select> <input name="PHONE4" size="20" value="$phone4"></td>
</tr>
<tr><td colspan="3"><hr></td></tr>
<tr>
<td nowrap>Directions: *</td>
<td colspan="2"><i>How to find your location.</i>
<br><textarea name="DIRECTIONS" rows="4"
cols="70">$directions</textarea></td>
</tr>
<tr><td colspan="3"><hr></td></tr>
</table>
<table cellspacing="0" cellpadding="4" width="98%" border="0">
<tr>
<td rowspan="2" nowrap>Address:</td>
<td rowspan="2">
<input name="ADDRESS1" size="20" value="$address1">
<br><input name="ADDRESS2" size="20" value="$address2">
<br><input name="ADDRESS3" size="20" value="$address3"></td>
<td nowrap>City:</td>
<td><input name="CITY" size="20" value="$city"></td>
</tr>
<tr>
<td nowrap>Province/State:*</td>
<td><input value="$province" name="PROVINCE" size="20"></td>
</tr>
<tr>
<td nowrap>Postal/Zip Code: *</td>
<td><input size="7" name="POSTAL" value="$postal"></td>
<td nowrap>Country:</td>
<td><input value="$country" name="COUNTRY" size="20"></td>
</tr>
<tr><td colspan="4"><hr></td></tr>
<tr>
<td nowrap>Email Address: *</td>
<td><input name="EMAIL" size="20" value="$email"></td>
<td nowrap>Website: *</td>
<td nowrap>http://<input name="WEBSITE" size="20" value="$website"></td>
</tr>
<tr><td colspan="4"> </td></tr>
<tr>
<td nowrap align="middle" bgcolor="#ffffcc" colspan="4">
<a name="Business Categories"><b>Business Categories</b></a></td>
</tr>
<tr>
<td bgcolor="#fffff0" colspan="4">
<i>Select categories only for products and services you directly provide.
You should mention the category or its product or service in your business
description. We check new listings and remove inappropriate categories.
If you don't fit into the existing categorties, suggest a new one to
<a href="mailto:webmaster\@gtweddings.com">webmaster\@gtweddings.com</a>,
and pick "Other" under "Miscellaneous" for now.</i>
<table align="center" cellspacing="0" cellpadding="8" width="100%">
<tr>
<td nowrap valign="top">
EOF
open( CAT, "./categories.tsv" );
# read lines of file into memory
$x = "0";
$ntitles = "0";
while( <CAT> )
{
$_ =~ tr/[\n\r]//d;
( $type, $name, $code, @bus ) = split( /\t/ );
$types[$x] = "$type";
$names[$x] = "$name";
$codes[$x] = "$code";
$buses[$x] = "@bus";
if( "$type" eq "T" )
{ $ntitles++; }
$x++;
}
close( CAT );
# set column height for each of 4 columns (consider blank line to precede each title except at top of columns)
$colh = ( "$x" + "$ntitles" - 4 ) / 4;
$y = "0";
$curl = "1";
while( $y < $x )
{
if( "$types[$y]" eq "T" )
{
# start a new column if past col height less 1
if( $curl >= $colh - 1 )
{
print "</td><td nowrap valign=\"top\">";
$curl = "1";
}
# print title
if( "$curl" ne "1" )
{ print " \;<br>\n"; }
print "<b>$names[$y]</b><br>\n";
$curl++;
}
else
{
print "<input type=\"checkbox\" value=\"$codes[$y]\" name=\"$codes[$y]\" ";
if( "$buses[$y]" =~ /~$busid~/ ) { print "checked"; }
print ">$names[$y]<br>\n";
}
$y++;
$curl++;
}
print <<EOF;
</td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="0" cellpadding="4" width="98%" border="0">
<tr>
<td nowrap align="middle" bgcolor="#ffffcc" colspan="4">
<a name="Listing Appearance"><b>Listing Appearance</b></a></td>
</tr>
<tr>
<td nowrap>Background Colour:</td>
<td><table cellspacing="0" cellpadding="4" border="1"><tr>
EOF
for ('FFFFF0', 'FFFFFF', 'C0C0C0', '000000', 'CCFFCC', 'CCFFFF', 'FFFFCC', 'FFCCFF', 'FFCCCC', 'CCCCFF')
{
if( "$_" eq "$background" )
{
print "<td bgcolor=\"#$_\"><input type=\"radio\" checked value=\"$_\" name=\"C1\"></td>";
$background = "";
}
else
{ print "<td bgcolor=\"#$_\"><input type=\"radio\" value=\"$_\" name=\"C1\"></td>"; }
}
print <<EOF;
</tr></table></td>
<td>Other: <inputsize="6" name="BACKGROUND" value="$background"></td>
<td rowspan="3"><i>6 digit hex number</i></td>
</tr>
<tr>
<td nowrap>Title Colour:</td>
<td><table cellspacing="0" cellpadding="4" border="1"><tr>
EOF
for ('000000', 'FFFFFF', '666666', '000080', '003300', '990000', '990099', '006666', 'FF9900', 'FF0000')
{
if( "$_" eq "$title" )
{
print "<td bgcolor=\"#$_\"><input type=\"radio\" checked value=\"$_\" name=\"C2\"></td>";
$title = "";
}
else
{ print "<td bgcolor=\"#$_\"><input type=\"radio\" value=\"$_\" name=\"C2\"></td>"; }
}
print <<EOF;
</tr></table></td>
<td>Other: <inputsize="6" name="TITLE" value="$title"></td>
</tr>
<tr>
<td nowrap>TextColour:</td>
<td><table cellspacing="0" cellpadding="4" border="1"><tr>
EOF
for ('000000', 'FFFFFF', '666666', '000080', '003300', '990000', '990099', '006666', 'FF9900', 'FF0000')
{
if( "$_" eq "$text" )
{
print "<td bgcolor=\"#$_\"><input type=\"radio\" checked value=\"$_\" name=\"C3\"></td>";
$text = "";
}
else
{ print "<td bgcolor=\"#$_\"><input type=\"radio\" value=\"$_\" name=\"C3\"></td>"; }
}
print <<EOF;
</tr></table></td>
<td>Other: <input size="6" name="TEXT" value="$text"></td>
</tr>
<tr><td colspan="4"><hr></td></tr>
<tr>
<td>Logo/Picture: *</td>
<td colspan="2">
<input type="hidden" name="OLDFILE" value="$file">
$filemsg
Upload a GIF or JPEG:
<br><input type="file" name="NEWFILE">
<br> OR
<br>Attach a GIF or JPEG to an email and send it to
<a href="mailto:upload\@gtweddings.com">upload\@gtweddings.com</a>.
Make sure your Business ID appears in the subject or
body of the email. You will be issued a Business ID
after clicking the button below.
<br> <br>
<input type="checkbox" value="1" name="HIDENAME"
EOF
if( ($options&1) == 1 ) { print " checked"; }
print <<EOF;
> Image Includes Business Name
<br>(Select to prevent your Business Name appearing twice)</td>
<td><i>Maximum width and height: 400 x 300 pixels</i></td>
</tr>
<tr><td colspan="4"><hr></td></tr>
</table>
<p><input type="submit" value="$buttontext" name="B1"></p>
</form>
EOF
open( HTML, "./busfooter.html" );
print;
close( HTML );
</body>
Thanks for any help!
Most scripts begin with the second line, #!/usr/bin/perl.
The only thing you can do is open up the original unaltered script and compare it line by line with the mutated one- or better yet, start all over again.