#!/usr/bin/perl # # BECANADA - ISELL Classifieds Script # Website: http://www.becanada.com/isell/ # E-Mail : sales@becanada.com # Version 3.1 - PAID PLATINUM VERSION # Copright May 2003 # # !!!!! WARNING !!!!!! # # - Variables below this line are default values. # - Any attempt to set values below this line will NOT work. # - The script name (classifieds.cgi) CAN NOT be changed. # # If you want to suggest modifications or want to purchase # more advanced versions, visit the BECANADA site above. # # ! DO NOT MODIFY below this line, you will be in violation # of copyrights, and this program will cease to function. # # You may also cause harm to your data files, and server. # # ! DO NOT MODIFY - this program will inform the script # maker BECANADA of ANY modifications - automatically. # # All unlawful modifications will result in court action. # International fines are $250,000 or 5 years in jail PER infraction. # # Absolutely no copying, reverse engineering, or use of any part # of this source code in ANY way, shape or form # is allowed without PERMISSION from BECANADA. # ################################################################## $goremote="http://www.internet-grocer.net/cgi/classif/usecr.cgi"; # Data & Categories filename $categories = "category.txt"; $block="block.txt"; $blockemail="blockemail.txt"; $blockphrases="blockphrases.txt"; $topslogan1 = "topad1.txt"; $topslogan2 = "topad2.txt"; $topslogan3 = "topad3.txt"; $topslogan4 = "topad4.txt"; $banners = "banners.txt"; $banners2 = "count.txt"; $header1="header.txt"; $footer1="footer.txt"; $leftside="leftside.txt"; $subject1="subject1.txt"; $subject2="subject2.txt"; $permdatabase="database.txt"; $keywords="keywords.txt"; $server = $ENV{'HTTP_HOST'}; @referers = ("$server"); if (-e "$categories") { open(FILE, $categories ) || print "I can't open that file\n"; @cats = ; close(FILE); } else { require "config.cgi"; } ($sendmail,$email,$home,$sitename,$showads,$maxads,$slogantop,$sloganbottom,$slogantop2,$sloganbottom2,$clads,$lnks,$txt,$bgcolor,$imgbck,$topimg,$toplnk,$emcopy,$opname,$adminpassword,$paidlink,$hourly,$slogantop3,$sloganbottom3,$slogantop4,$sloganbottom4,$yesbest,$spamable,$showpslink,$adsendhtml,$sitelogo,$adoptions,$globaladyes,$htmlinads,$adcopysize,$allowimages,$postadsubject,$expireadsubject,$webmasterverify,$verifyuseremail,$basefont,$priorityofemail,$imageupload,$imagedir) = split(/\|/,@cats[0]); $CC="classifieds.cgi"; $ret = "[Click Here To Return to Classifieds]"; $purge=20; open(FILE, $banners ) || print "I can't open that file\n"; @ads = ; close(FILE); # change for possible bug with multiple ads. $zz=0; @adbanner=(''); for ($i=0;$i<@ads;$i++) { if (index(@ads[$i],"%%")>-1) { @words=split(/%%/,@ads[$i]); for ($x=0;$x<@words;$x++) { @adbanner[$zz]=@adbanner[$zz] . @words[$x]; $zz++; } } else { @adbanner[$zz]=@adbanner[$zz] . @ads[$i]; } } @days = ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); @months = ('January','February','March','April','May','June','July','August','September','October','November','December'); ($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6]; $year = substr($year, 1); $time = sprintf("%02d:%02d:%02d",$hour,$min,$sec); $year += 2000; $date = "$days[$wday], $months[$mon] $mday, $year at $time"; $dup=0; $sear=0; $img=""; $best=""; $pslink=""; if ($topimg ne "") { $img="
"; } if (@adbanner ne "") { open(FILE, $banners2 ) || print "I can't open that file\n"; $count = ; close(FILE); $img= $img . "@adbanner[$count]"; $count++; if ($count > @adbanner || $count eq @adbanner ) { $count="0"; } open(FILE, ">$banners2" ) || print "I can't open that file\n"; print FILE "$count"; close(FILE); } if ($yesbest eq "1") { $best="

"; } if ($showpslink eq "yes") { $pslink="

"; } $showclasslink=""; if ($expireadsubject eq "yes") { $showclasslink="

"; } $showstylesheet=""; if ($postadsubject ne "") { $showstylesheet=""; } $sitelogo2=""; if (index($sitelogo,"http://")>-1) { $sitelogo2=""; } # PAID open(FILE, $header1 ) || print "I can't open that file\n"; @headerads = ; close(FILE); open(FILE, $footer1 ) || print "I can't open that file\n"; @footerads = ; close(FILE); $showkeynote=qq~

Be automatically notified when an ad matchs what you are searching for...
Your full name:
Your Email Address:
Keywords/Phrases [separate with commas]:
You want to be notifed for these if they appear
~; $header = "$sitelogo2 @headerads "; $footer ="

$img

$showclasslink $pslink $best

@footerads "; @items = ("Name|40", "Address|40","City|30","State|30","Zip Code|20","Country|30","Phone Number|20","Headline|50","Ad Copy|$adcopysize","Email Address|50||@","Website Address|100","Password|10"); @expiry=("10 Minutes|.005","1 Hour|.05","1 Day|1","7 Days|7","14 Days|14","30 Days|30","ADMIN 60 Days|?60","ADMIN 3 Monthes|?90","ADMIN 4 Monthes|?120","ADMIN 6 Monthes|?180","ADMIN 12 Monthes|?365","ADMIN NEVER Expiry|?never"); ($cg,$data,$singlead,$extra1) = split(/\|/,$ENV{'QUERY_STRING'}); print "Content-type: text/html\n\n"; if ($cg ne "frames" && $cg ne "frames1") { print "$showstylesheet \n \n$sitename\n"; print "

\n$header\n"; } if ($cg eq "post_ad" || $cg eq "do_delete_ad" || $cg eq "add_to_categories" || $cg eq "do_delete_cat" || $cg eq "do_email" || $cg eq "search_ads" || $cg eq "email_ad_friend" || $cg eq "admin_access" || $cg eq "addtokey") { read(STDIN, $input, $ENV{'CONTENT_LENGTH'}); # split the input @pairs = split(/&/, $input); # split the name/value pairs foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $name =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ tr/+/ /; # change value to allow Returns. if ($cg eq "do_email" || $cg eq "add_to_categories" ) { $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s///g; } else { $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; if ($name eq "Ad Copy" && $htmlinads eq "1") { $value =~ s/|\n*//g; } else { $value =~ s/<([^>]|\n)*>//g; } $value =~ s/(\s+|\n)?,(\s+|\n)?/,/g; $value =~ s/(\s+)?\n+(\s+)?//g; } $FORM{$name} = $value; } } $modify=0; $multisearch=0; #display ads $did=0; if ($cg eq "display_ads") { &displayads; $did=1; } if ($cg eq "verify_AD") { &go_verify_ads; $did=1; } if ($cg eq "addtokey") { $holdtime=$FORM{'notetime'}; if ($holdtime ne "never") { $holdtime= time + ($holdtime * 86400); } if (index($FORM{'email1'},"@")>0 && index($FORM{'email1'},".") >0) { &get_file_lock("$keywords.lock"); open(FILE, ">>$keywords") || print "I can't create that file\n"; print FILE "$FORM{'name1'}|$FORM{'email1'}|$FORM{'key1'}|$holdtime|\n"; close(FILE); &release_file_lock("$keywords.lock"); print "Your Keywords have been added.

You will receive notifications at $FORM{'email1'} automatically as ads are posted that MATCH your keywords/phrases.

$ret"; } else { print "$FORM{'email1'} is an invalid email address, hit your back button and re-enter.

$ret"; } $did=1; } if ($cg eq "remove_keywords") { require "keywords.cgi"; print "

removed...

"; $did=1; } if ($cg eq "uploadimage") { require "imageup.cgi"; $did=1; } if ($cg eq "remove") { &remove_ALL; $did=1; } if ($cg eq "place_ads") { if ($spamable ne "yes") { &check_url; } &place_ads; $did=1; } if ($cg eq "post_ad") { if ($spamable ne "yes") { &check_url; } &post_ad; $did=1; } if ($cg eq "delete_ad") { &delete_ad; $did=1; } if ($cg eq "do_delete_ad") { &do_delete_ad; $did=1; } if ($cg eq "add_category") { &add_category; $did=1; } if ($cg eq "add_to_categories") { &add_to_categories; $did=1; } if ($cg eq "delete_cat") { &delete_cat; $did=1; } if ($cg eq "do_delete_cat") { &do_delete_cat; $did=1; } if ($cg eq "admin_access") { &check_url; &admin_access; $did=1; } if ($cg eq "do_email") { &check_url; &do_email; $did=1; } if ($cg eq "friend") { &check_url; &friend; $did=1; } if ($cg eq "frames") { &frames; $did=1; } if ($cg eq "frames1") { &frames1; $did=1; } if ($cg eq "email_ad_friend") { &check_url; &email_ad_friend; $did=1; } if ($cg eq "search_ads") { @keywords = split(/,/,$FORM{'keywords'}); &check_url; @keywords = split(/,/,$FORM{'keywords'}); $sear=1; if ($FORM{'submit'} eq 'Search All Categories') { $multisearch=1; for ($data=1;$data<@cats;$data++) { &displayads; } } else { &displayads; } $did=1; } if ($did eq "0") { &showcategories; } if ($cg ne "frames1") { print "$footer \n"; } exit; # # End main # sub showcategories { open(FILE, $leftside ) || print "I can't open that file\n"; @leftads = ; close(FILE); $c=int(@cats / 2)+1; print qq~ \n~; $c=0; $cwid=2; $cwid2=int( 85/ $cwid ) . "%"; for ($a = 1; $a < @cats; $a++) { @words = split(/\|/,$cats[$a]); # no display subs if (index(@words[0],"-") < 0 ) { if (@words[0] ne '' ) { &newdatabasecreate("@words[0]"); } if (index(@words[1],"paid") >-1 ) { @words[1]=substr(@words[1],4); } print qq~\n~; $c++; if ($c eq $cwid ) { $c=0; print "\n"; } } } print qq~
@leftads $img
@words[1] - View ads / Post Ads
@words[2]
SEARCH:

Search all ads at this site by keywords or phrases: [separate by commas]:

AUTOMATIC NOTIFICATION: $showkeynote
~; $footer=$footer . qq~


Admin ONLY Settings
Password:
~; } sub showSUBcategories { local ($x) = @_; @xxx=split(/-/,$x); @xxx[1]++; $xy=join("-",@xxx); $c=int(@cats / 2)+1; print qq~ \n~; $c=0; $cwid=2; $cwid2=int( 85/ $cwid ) . "%"; $max1=0; for ($a = 1; $a < @cats; $a++) { @words = split(/\|/,$cats[$a]); @xy1=split(/-/,@words[0]); if (index(@words[0],"@xxx[0]-") eq 0 && @xy1[1] eq @xxx[1] ) { $match=1; for ($i=2;$i<(@xy1[1]+1);$i++) { if ( (@xy1[$i] eq @xxx[$i] || @xxx[$i] eq "") ) { $match=1; } else { $match=0; } } if ($match eq 1) { if (@xy1[@xy1[1]+1] > $max1) { $max1=@xy1[@xy1[1]+1]; } if (@words[0] ne '' ) { &newdatabasecreate("@words[0]"); } if (index(@words[1],"paid") >-1 ) { @words[1]=substr(@words[1],4); } print qq~\n~; $c++; if ($c eq $cwid ) { $c=0; print "\n"; } } # end check all } } print qq~ ~; $max1++; $footer=$footer . qq~ Add Sub-Category.

~; } sub newdatabasecreate { local ($x) = @_; if (-e "$x") { } else { open(HTML, ">$x") || print "I can't create that file\n"; print HTML ""; close(HTML); chmod 0644, '$x'; } } sub displayads { ($fl,$nm,$dec) = split(/\|/,@cats[$data]); &showSUBcategories("$fl"); open(HTML,$fl) || print "I can't access that file\n"; @count = ; close(HTML); $c=@count; $results=0; $ct=$c * ($hour/$hourly); $ct=int($ct); $adnum=0; $ispaid=""; if (index($nm,"paid")>-1) { $ispaid="Paid ads only, no free ads in this category
"; $nm=substr($nm,4); } if ($sear ne "1") { print "

Sub-Categories: $img
@words[1] - View ads / Post Ads
@words[2]
$nm {$c ads }
$ispaid$dec

$img

\n"; } if ($showads eq "0" ){ $showads= @count;} if ($singlead ne "") { $adnum=$singlead; } else {$adnum=$adnum+$ct;} if ($adnum>= @count) {$adnum=0;} if ($sear eq "1") { $showads=@count; $adnum=0; print "

$nm {$c listings }
$dec

\n"; print "Search Results [maximum 25] for:
@keywords

\n"; } $dodelete=0; $rlv=0; $keepad=$adnum; $ttads=0; if (@count eq 0) {print "

No Ads in this category.\n"; $showads=-1;} # # Start show loop # $holdshowads=$showads; for ($topads=0;$topads<2;$topads++) { # # Special loop, do premium first, free second # if ($topads eq 0 && ($singlead eq "" || $extra1 eq "nextads") ) { $showads=@count; print "

Top Ads

Top Ads get 5 to 10 times the response of regular ads. To make your ad a TOP ad, place a free ad and then choose the ad extention option. If you already have an ad listed here find it, and click on the link EXTEND AD INSTANTLY in the full listing.

"; } else { print "

Regular Ads

"; $showads=$holdshowads; } $stopdisplay=0; $ttads=0; for ($a = 0; $a < $showads; $a++) { if ($topads eq 1) { @words = split(/\|/,@count[$adnum]); } else { @words = split(/\|/,@count[$a]); } $show=1; if ($sear eq "1") { $show=0; for ($i = 0; $i < @keywords; $i++) { if (index(@count[$adnum],@keywords[$i])>=0){$show++;} } if ($show eq @keywords) {$show=1; $results++;} else {$show=0; } } if ($topads eq 1) { $adnum++; $ttads++; if ($ttads > @count ) { $stopdisplay=1; } } $x=@words; if (index(@words[12],"hold") eq 0) { $show=0; @words[12]=substr($x,4); } # # Extend paid ad link # $user=qq~Extend Ad Instantly~; # # # $premium=0; $xx2=""; if (substr(@words[12],0,6) eq "?never") { $dt="Never Expiry
Premium Ad
"; $xx2="bgcolor=green border=5"; $premium=1; } else { $dt=localtime(@words[12]); if (substr(@words[12],0,1) eq "?") { @words[12]=substr(@words[12],1); $dt=localtime(@words[12]) . "
Premium Ad"; $xx2="bgcolor=green border=5"; $premium=1; } if (time>@words[12] && @words[12] !="") { $dodelete=1; $dt="!! Now - Last Viewing"; } } $adnumber=$adnum; if ($topads eq 0) { $adnumber=$a; } if ( ($topads eq 0 && $premium eq 1) || $topads eq 1) { if ($show eq "1" && $adoptions ne "1" || ($adoptions eq "1" && $singlead ne "" && $extra1 ne "nextads" ) ) { $xshowad=""; $xshowad2=""; $sddd1=$adnum - 1; $adnumber=$adnum; if ($topads eq 0) { $sddd1=$a; $adnumber=$a; } if ($adoptions eq "1" && $singlead ne "" ) { if (@words[13] ne "") { $xshowad=qq~

~; } } else { if (@words[13] ne "") { $xshowad2=qq~PICTURE | ~; } } # # Stop stripping emails # $email=@words[9]; $email=~s/\@/&/; print qq~
Posted By: @words[0]
@words[3], @words[5]

Ad $adnumber Expires:
$dt

$xshowad @words[7]

@words[8]

$xshowad2Email this ad to a Friend | Go to Website | Send An Email | $user


\n~; if ($adoptions eq "1" && $singlead ne "" ) { $a=$showads; $ttads=$a; $stopdisplay=1; } } else { if ($show eq "1" && $adoptions eq "1" ) { $sddd=substr(@words[8],0,40); $sddd1=$adnum - 1; if ($topads eq 0) { $sddd1=$a; } $xshowad2=""; if (@words[13] ne "") { $xshowad2=qq~PICTURE

~; } print qq~
$xshowad2 Ad # $adnumber :@words[7]
$sddd ...
\n~; } } #end double check } if ($adnum >= @count && $topads eq 1 ) {$adnum=0; } if ($results>25 && $topads eq 1 ) { $a=$showads; $ttads=$a; $stopdisplay=1;} } # # end paid ... free display loop # if ($stopdisplay eq 1 && $topads eq 1 ) { last; } } if ($ttads < @count ) { print "

[--- Next Ads ----]\n"; } if ($dodelete eq "1") { &purge_data; } if (($multisearch eq "1" && $data eq (@cats-1) ) || $multisearch eq "0") { print qq~

Options:

Search All Ads by keywords/phrases in $nm: [separate by commas]:


$showkeynote [Post Ad in $nm] [Modify / Delete Ad in $nm]
$ret

\n~; } } sub place_ads { ($fl,$nm,$dec) = split(/\|/,@cats[$data]); if ($modify eq "1") { ($fl,$nm,$dec) = split(/\|/,@cats[$FORM{'cat'}]); open(HTML,$fl) || print "I can't access that file\n"; @count = ; close(HTML); @modad=split(/\|/,@count[$FORM{'number'}]); chomp(@modad); $data=$FORM{'cat'}; $ex2="
Only Admin can modify expiry date."; } $ex1="\n"; $fggth=""; if ($htmlinads eq "1") { $fggth="- EXCEPT in AD COPY."; } $showimageok=""; if ($allowimages eq "1") { $showimagesok=qq~OPTIONAL: Image for Ad [http://mydomain.com/myadimage.jpg]:
~; } if ($verifyuseremail eq "1" && $webmasterverify ne "1" ) { $showimagesok=$showimagesok . "

NOTICE: You must verify your email address via email sent to you prior to your ad being posted."; } if ($webmasterverify eq "1") { $showimagesok=$showimagesok . "

NOTICE: Webmaster of this classifieds must verify your ad, BEFORE it is visible to the public."; } $ispaid=""; if (index($nm,"paid")>-1) { $ispaid="Paid ads only, no free ads in this category

"; $nm=substr($nm,4); } print qq~

$nm

$ispaid$dec

Post Your Ad:

* All Fields are required.
* Only name, email, url, headline and ad copy will appear online.
* If you want to have more contact info included, add it to your ad copy only.
* HTML is not allowed $fggth.
* If there is an error you will get a pop up notice.
* If you do not have a website, leave the website field BLANK.

\n~; $sc=" Ad To Last: $ex1
$ex2

$showimagesok

* Upon submissions you may have additional options.

By submitting your FREE AD, you agree to accept:

---> 1 AUTOMATED email confirming submissions of your ad,
---> 1 AUTOMATED email confirming expiration of your ad
---> An occasional email direct from the operator of this site.

-----> Which you will NOT consider SPAM under ANY circumstances.

Admin Only:

Enter your Password for "ADMIN" Time periods ,"NEVER" expiry, "Modify" Expiry and "duplicate override".]

Admin Password:

[Click Here To Return to $nm ] $ret \n~; } sub post_ad { ($fl,$nm,$dec) = split(/\|/,@cats[$FORM{'cat'}]); $d=""; if (-e "$block") { } else { open(HTML, ">$block") || print "I can't create that file\n"; print FILE ""; close(FILE); chmod 0644, '$block'; } open(HTML,$block) || print "I can't access that file\n"; @badwords =; close(HTML); for ($i=0;$i<@badwords;$i++) { chomp(@badwords[$i]); if (index(lc($FORM{'Website Address'}),lc(@badwords[$i]) )> -1) { print "

SORRY!

$FORM{'Website Address'} has been Banned by webmaster by this site...

"; exit; } } # # emails # if (-e "$blockemail") { } else { open(HTML, ">$blockemail") || print "I can't create that file\n"; print FILE ""; close(FILE); chmod 0644, '$blockemail'; } open(HTML,$blockemail ) || print "I can't access that file\n"; @badwords =; close(HTML); for ($i=0;$i<@badwords;$i++) { chomp(@badwords[$i]); if (index(lc($FORM{'Email Address'}),lc(@badwords[$i]) )> -1) { print "

SORRY!

$FORM{'Email Address'} has been Banned by webmaster

"; exit; } } # # headline/adcopy # if (-e "$blockphrases") { } else { open(HTML, ">$blockphrases") || print "I can't create that file\n"; print FILE ""; close(FILE); chmod 0644, '$blockphrases'; } open(HTML,$blockphrases) || print "I can't access that file\n"; @badwords =; close(HTML); for ($i=0;$i<@badwords;$i++) { chomp(@badwords[$i]); if (index(lc($FORM{'Headline'}),lc(@badwords[$i]) )> -1 || index(lc($FORM{'Ad Copy'}),lc(@badwords[$i]) )> -1 ) { print "

SORRY!

@badwords[$i] is Banned by webmaster in adcopy or headline.

"; exit; } } for ($b = 0; $b < @items; $b++) { ($i1,$i2,$ty,$req) = split(/\|/,@items[$b]); $d=$d . $FORM{$i1} . "|"; } $ex=$FORM{'exp'}; $adimg="|$FORM{'adimage'}"; if ($FORM{'pass-admin'} eq $adminpassword ) { if ($ex ne '?never' && index($ex,'?')> -1 ) { $ex="?" . (time+(substr($ex,1)*86400)); } if ( $FORM{'pass-admin'} eq $adminpassword && index($ex,'?')< 0 ) { $ex=time+($ex*86400); } if ( $FORM{'exp'} eq "" ) { $ex=$FORM{'expmod'}; } } else { if ( $FORM{'expmod'} ne "" ) { $ex=$FORM{'expmod'}; } else { if ( index($ex,"?") eq 0 ) { print "

Admin Only - Invalid Password - you can not choose these time periods.

$ret\n"; exit; } else { $ex=time+($ex*86400); } } } $holdmail=""; $verifylink=""; $webmasterVV=""; if ($verifyuseremail eq "1" && $FORM{'expmod'} eq "" && $webmasterverify ne "1" ) { $holdmail="hold"; print "

IMPORTANT: You will have to verify your email address, in the ad posted email you receive.

"; $verifylink=qq~=========== IMPORTANT ========== for your ad to appear, you MUST click this link to verify your ad: $home$ENV{'SCRIPT_NAME'}?verify_AD|$FORM{'cat'}|$ex|$FORM{'Email Address'}| or Click here ~; } if ( ($webmasterverify eq "1" || index($nm,"paid") >-1 ) && $FORM{'expmod'} eq "") { $holdmail="hold"; $tyyy=""; if (index($nm,"paid") >-1) { $tyyy="Paid Ads only";} print "

NOTICE $tyyy : Webmaster of this classifieds must verify your ad and/or payment, BEFORE it is visible to the public."; $webmasterVV=qq~=========== $tyyy : IMPORTANT : ========== Click this link to allow ad to become visible: $home$ENV{'SCRIPT_NAME'}?verify_AD|$FORM{'cat'}|$ex|$FORM{'Email Address'}| or Click here ~; $verifylink=qq~=========== IMPORTANT ========== Webmaster review REQUIRED before your ad will be visible to the public. Allow 24-48 hours for webmaster to review your ad[s]. ~; } $d=$d . $holdmail . $ex . $adimg . "|"; # # Extend paid ad link # $user=qq~usecr.cgi?|$FORM{'cat'}|$ex|$FORM{'Email Address'}~; # # # open(HTML,$fl) || print "I can't access that file\n"; @count = ; close(HTML); $dup="0"; ($xx1,$ty2,$ty,$req) = split(/\|/,@items[9]); ($xx2,$ty,$ty2,$req) = split(/\|/,@items[10]); for ($a=0; $a<@count; $a++) { @words=split(/\|/,@count[$a]); if (@words[9] eq $FORM{$xx1} ) { $dup="1"; last;} } if ($FORM{'expmod'} ne "") { if (index($d,'\n') < 0 ) { $d=$d . "\n"; } @ReturnArray = splice(@count,$FORM{'mod'},1,$d ); &get_file_lock("$fl.lock"); open(FILE, ">$fl") || print "I can't create that file\n"; print FILE @count ; close(FILE); &release_file_lock("$fl.lock"); print "

Ad Updated

$ret \n"; } if ( ($dup ne "1" || $FORM{'pass-admin'} eq $adminpassword) && $FORM{'expmod'} eq "" ) { if (@count>$maxads) { &purge_data; } &get_file_lock("$fl.lock"); open(FILE, ">>$fl") || print "I can't create that file\n"; print FILE "$d\n"; close(FILE); &release_file_lock("$fl.lock"); # # Add permanent # &get_file_lock("$permdatabase.lock"); open(FILE, ">>$permdatabase") || print "I can't create that file\n"; print FILE "$FORM{'Name'}|$FORM{'Email Address'}|$FORM{'Phone Number'}|$FORM{'Headline'}|$FORM{'Website Address'}|\n"; close(FILE); &release_file_lock("$permdatabase.lock"); if ($ex ne "never") { $ex=localtime($ex); } if ($FORM{'Password'} eq $adminpassword) { $FORM{'Password'}="Admin Password"; } open(FILE, $topslogan1 ) || print "I can't open that file\n"; @ads = ; close(FILE); $zz=0; @allads=(''); for ($i=0;$i<@ads;$i++) { if (index(@ads[$i],"%%")>-1) { @words=split(/%%/,@ads[$i]); for ($x=0;$x<@words;$x++) { @allads[$zz]=@allads[$zz] . @words[$x]; $zz++; } } else { @allads[$zz]=@allads[$zz] . @ads[$i]; } } srand; $ad1=@allads[int(rand($zz))]; if ($zz eq 0) { $ad1=@allads[0]; } open(FILE, $topslogan2 ) || print "I can't open that file\n"; @ads = ; close(FILE); $zz=0; @allads=(''); for ($i=0;$i<@ads;$i++) { if (index(@ads[$i],"%%")>-1) { @words=split(/%%/,@ads[$i]); for ($x=0;$x<@words;$x++) { @allads[$zz]=@allads[$zz] . @words[$x]; $zz++; } } else { @allads[$zz]=@allads[$zz] . @ads[$i]; } } srand; $ad2=@allads[int(rand($zz))]; if ($zz eq 0) { $ad2=@allads[0]; } open(FILE, $subject1 ) || print "I can't open that file\n"; @ads = ; close(FILE); $zz=0; @allads=(''); for ($i=0;$i<@ads;$i++) { if (index(@ads[$i],"%%")>-1) { @words=split(/%%/,@ads[$i]); for ($x=0;$x<@words;$x++) { @allads[$zz]=@allads[$zz] . @words[$x]; $zz++; } } else { @allads[$zz]=@allads[$zz] . @ads[$i]; } } srand; $subject=@allads[int(rand($zz))]; if ($zz eq 0) { $subject=@allads[0]; } $sender="text/plain \n"; if ($adsendhtml eq 'html') { $sender="text/html \n

";}


if ($emcopy ne "" ) {
	$emcopy="TO: $FORM{'Name'}<$FORM{'Email Address'}>\n" . 'BCC: ' . $emcopy ;
	}
else {
$emcopy="TO: $FORM{'Name'}<$FORM{'Email Address'}>";
}




#
# For path to credit script.
#

$cdr=$ENV{'SCRIPT_NAME'};
$cdr=~s/$CC//g;
$cdr="$home$cdr$user";



open (MAIL1, "|$sendmail -t ");

print MAIL1 qq~$emcopy
FROM: "Classifieds at $home" <$email>
SUBJECT: $FORM{'Name'} $subject
Content-Type: $sender

$ad1

#############################################################################

Extend your ad instantly and get more responses/better exposure - click link:

$cdr

or Click Here

#############################################################################

Thank you $FORM{'Name'} for your ad posting:

Headline: $FORM{'Headline'}

Ad Copy: $FORM{'Ad Copy'}

E-Mail: $FORM{'Email Address'}
Name: $FORM{'Name'} 
URL: $FORM{'Website Address'}

Your Ad will expire on: $ex
Your Ad Delete is Password: $FORM{'Password'}

in :

Category: $nm
Detailed: $dec

$verifylink

Posted at Classifieds website:

Site: $home

Please visit us again to re-post your ad.
You will get an expiry notice as well.

Thanks.
Webmaster at $home
$opname

$ad2

\n~;
close (MAIL1);

#
# Email webmaster for confirmation IF set.
# 

if ($webmasterVV ne "") {

open (MAIL1, "|$sendmail -t ");

print MAIL1 qq~TO: "Classifieds at $home" <$email>
FROM: $FORM{'Name'}<$FORM{'Email Address'}>
SUBJECT: Webmaster Review of Ad Required.

Webmaster, please click on link to accept ad below and
allow it to become visible to the public.

$webmasterVV

Category: $nm
Detailed: $dec

Headline: 
$FORM{'Headline'}

Ad Copy: 
$FORM{'Ad Copy'}

URL: $FORM{'Website Address'}
E-Mail: $FORM{'Email Address'}
Name: $FORM{'Name'} 

Your Ad will expire on: $ex
Your Ad Delete is Password: $FORM{'Password'}
Posted at Classifieds website: $home

\n~;
close (MAIL1);

}

#
# Keywords
#

require "keywords.cgi";

#
# Image
#

if ($imageupload ne "0") {

$ssIMAGE=substr($FORM{'Email Address'},2,2) . time; 

print qq~
Image Upload - optional

Select your image using the Browse button.
Click Upload when ready. Uploading may take a moment.

Image File :

~; } print qq~


To Order a PAID CLASSIFIEDS...

FEATURES: * Has a longer expiry period * Stands out better * More Responses * Less Reposting Time on your end

...Instantly Extend your ad now - For Details Click HERE


~; if ($globaladyes eq "1") { print qq~

Click Here To Return to $nm

$ret \n~; } else { print qq~

Your Ad has been posted.

Click Here To Return to $nm

$ret \n~; } } else { if ($FORM{'expmod'} eq "") { print "

Error Duplicate Add Found, by same posting party.

@words[7]
@words[8]

Please delete this ad or wait for it to expiry.

\n"; $data=$FORM{'cat'}; &delete_ad; } } } sub delete_ad { require "deletead.cgi"; } sub do_delete_ad { require "dodeletead.cgi"; } sub add_category { ($fl,$nm,$dec) = split(/\|/,@cats[$data]); print qq~

Add Category:

To make it a "paid only" category, add paid at the begining of the category name.

Name [letter and numbers only]:

Full Category Name:

Detailed Description:

Admin Password :


$ret \n~; } sub add_to_categories { require "addtocats.cgi"; } sub delete_cat { open(HTML,$categories) || print "I can't access that file\n"; @count = ; close(HTML); print "

Edit / Remove Category:

To make it a 'paid only' category, add paid at the begining of the category name.\n"; print "


Admin Password :


$ret \n~; } sub do_delete_cat { require "do-delete-cat.cgi"; } sub show_admin { require "admin.cgi"; } sub do_email { } sub purge_data { require "deleteads.cgi"; } sub get_file_lock { local ($lock_file) = @_; local ($endtime); $endtime = 500; $endtime = time + $endtime; while (-e $lock_file && time < $endtime) { sleep(1); } open(LOCK_FILE, ">$lock_file") || &file_open_error ("$lock_file", "Lock File Routine", __FILE__, __LINE__); } sub release_file_lock { local ($lock_file) = @_; close(LOCK_FILE); unlink($lock_file); } sub check_url { local($check_referer) = 0; if ($ENV{'HTTP_REFERER'}) { foreach $referer (@referers) { if ($ENV{'HTTP_REFERER'} =~ m|https?://([^/]*)$referer|i) { $check_referer = 1; last; } } } else { $check_referer = 1; } if ($check_referer != 1) { &showcategories; print "$footer \n"; exit; } } sub friend { require "start-friend.cgi"; } sub email_ad_friend { require "friend.cgi"; } sub frames { print qq~ $sitename <BODY> <P> </BODY> \n~; } sub frames1 { print qq~
$sitename

VIEW / POST ADS
\n~; for ($a = 1; $a < @cats; $a++) { @words = split(/\|/,$cats[$a]); print qq~- @words[1]
\n~; } print "
[Classifieds Home]

Admin ONLY Settings
Password:

[Homepage]\n"; } sub admin_access { if ($FORM{'password'} eq $adminpassword) { &show_admin ; } else { print "

Invalid Password.

$ret\n"; } } sub go_verify_ads { require "verifyads.cgi"; } sub remove_ALL { require "removeall.cgi"; }