#!/usr/bin/perl # # BECANADA - ISELL Classifieds Script # Copyright 2000 - All Rights Reserved. # Website: http://www.becanada.com # E-Mail : sales@becanada.com # Version 3.1 # Jan 12 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. # ################################################################## # Data & Categories filename $categories = "category.txt"; $topslogan1 = "topad1.txt"; $topslogan2 = "topad2.txt"; $topslogan3 = "topad3.txt"; $topslogan4 = "topad4.txt"; $banners = "banners.txt"; $banners2 = "count.txt"; $block="block.txt"; $server = $ENV{'HTTP_HOST'}; @referers = ("$server"); if (-e "$banners") { } else { open(HTML, ">$banners") || print "I can't create that file\n"; print FILE ""; close(FILE); chmod 0644, '$banners'; } if (-e "$banners2") { } else { open(HTML, ">$banners2") || print "I can't create that file\n"; print FILE "0"; close(FILE); chmod 0644, '$banners2'; } if (-e "$topslogan1") { } else { open(HTML, ">$topslogan1") || print "I can't create that file\n"; print FILE ""; close(FILE); chmod 0644, '$topslogan1'; } if (-e "$topslogan2") { } else { open(HTML, ">$topslogan2") || print "I can't create that file\n"; print FILE ""; close(FILE); chmod 0644, '$topslogan2'; } if (-e "$topslogan3") { } else { open(HTML, ">$topslogan3") || print "I can't create that file\n"; print FILE ""; close(FILE); chmod 0644, '$topslogan3'; } if (-e "$topslogan4") { } else { open(HTML, ">$topslogan4") || print "I can't create that file\n"; print FILE ""; close(FILE); chmod 0644, '$topslogan4'; } if (-e "$categories") { open(FILE, $categories ) || print "I can't open that file\n"; @cats = ; close(FILE); } else { @cats[0]="/usr/sbin/sendmail|webmaster\@$server|http://$server|$server Free Classifieds|25|1500|||||gold|blue|black|white||http://www.best-host.com/becan/banner1.gif|http://www.mail-loop.com|support\@$server|Operator name|dtb4863||24|||||1|no|yes||\n"; open(HTML, ">$categories") || print "I can't create that file\n"; print HTML @cats; print HTML qq~Advertising|Advertising|Promotion, Software, Services| Business|Business Opportunities|Work at home, income opportunities| Cars|Cars For Sale|Cars, Trucks, Motorcycles| Commission|Commission Sales|Affliate programs, reseller programs, sales| Computers|Computers|Computers, Hardware, Software, Etc.| Dealerships|Dealerships|Franchises, Businesses for sales, Lease| Financial|Financial|Services, and Investments| Freebies|Freebies|Free Stuff, promotional material, discounts| Health|Health Nutrition|Vitamins, Get Well, Self Help| HBusiness|Home Business|Home Based Business, No investment/low investment| Mail|Mail Order|Mail order publications, income opportunities| Miscellaneous|Miscellaneous|Everything but the kitchen sink| MLM|MLM|Multi-Level Marketing, Consumer Direct Marketing| Publications|Publications|How Tos, Information| Services|Services|Professional Services, Services offered.| RealE|Real Estate|Houses, Land for sale|\n~; close(HTML); chmod 0644, '$categories'; open(FILE, $categories ) || print "I can't open that file\n"; @cats = ; close(FILE); } ($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) = 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="

"; } $sitelogo2=$sitename; if (index($sitelogo,"http://")>-1) { $sitelogo2=""; } $header = "

$sitelogo2
$days[$wday], $months[$mon] $mday, $year
"; $footer ="

$img

$pslink

$bestV 3.1 ISELL Classifieds Script Copyright 2000-2003 Becanada
Get Your own, FREE at: http://www.becanada.com
Used By Permission at $home

Return to Homepage
Webmaster

"; @items = ("Name|30", "Address|30","City|20","State|20","Zip Code|10","Country|30","Phone Number|30","Headline|100","Ad Copy|250","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) = split(/\|/,$ENV{'QUERY_STRING'}); print "Content-type: text/html\n\n"; if ($cg ne "frames" && $cg ne "frames1") { print "$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" ) { 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; $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 "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 Topics [will take longer]') { $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 { $c=int(@cats / 2)+1; print qq~
\n~; $c=0; for ($a = 1; $a < @cats; $a++) { @words = split(/\|/,$cats[$a]); if (@words[0] ne '' ) { &newdatabasecreate("@words[0]"); } print qq~\n~; $c++; if ($c eq "2") { $c=0; print "\n"; } } print qq~
Features:

Ad Readers: [Info]
* Fast Ad Viewing
* Keyword Search
* Keyword Notify
* Global Keyword Notify
* Global "New Ad" Notify
* "Send Email to Friend"
Advertisers: [Info]
* Free, Global & Paid Ads
* Exclusive 'last view' of Ad
* Email on Expiry of Ad
* Anti email "harvesting"
* Hourly Ads Rotation
* "Send Email to Friend"
* Modify/Delete By Password
* Many Ad Expiry periods
Webmasters: [Info]
* Fully Automated
* Online Interface
* Fast 1 File Install
* Revenue Source
* Unlimited Categories
* Unlimited Ads
* Anti Spam/Duplicates
* "Send Email to Friend"
* Free, Paid, Banner Ads
* Auto Email Advertisers
* It's Free! Click Here

  Your Classifieds 
  for getting Results!
$img
@words[1] - View/Post Ads
@words[2]

Search All
Keywords [separate by commas]:

A "Global Search" will allow you to search all sites in the network of
ISELL Networked Sites worldwide plus access other FREE options too.

Admin ONLY Settings
Password:

\n~; } 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]); 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; if ($sear ne "1") { print "
$nm {$c ads }
$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;} for ($a = 0; $a < $showads; $a++) { @words = split(/\|/,@count[$adnum]); $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; } } $adnum++; $ttads++; if ($ttads > @count ) {last;} $x=@words; $xx2=""; if (substr(@words[$x-1],0,6) eq "?never") { $dt="Never Expiry
Premium Ad
"; $xx2="bgcolor=green border=5";} else { $dt=localtime(@words[$x-1]); if (substr(@words[$x-1],0,1) eq "?") { @words[$x-1]=substr(@words[$x-1],1); $dt=localtime(@words[$x-1]) . "
Premium Ad"; $xx2="bgcolor=green border=5"; } if (time>@words[$x-1] && @words[$x-1] !="") { $dodelete=1; $dt="!! Now - Last Viewing"; } } if ($show eq "1") { print qq~
Posted By: @words[0]
@words[3], @words[5]

Ad $adnum Expires:
$dt

@words[7]

@words[8]

| Email this ad to a Friend | Go to Website | Send An Email |


\n~; } if ($adnum >= @count ) {$adnum=0; } if ($results>25 ) { $a=$showads; $ttads=$a; 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~


Search All Ads in $nm:
Keywords [separate by commas]:


A "Global Search" will allow you to search all sites in the network of
ISELL Networked Sites worldwide plus access other FREE options too.

[Post Ad in This Category] [Modify / Delete Ad in This Category]

$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'}]); $data=$FORM{'cat'}; $ex2="
Only Admin can modify expiry date."; } $ex1="\n"; print qq~

$nm

$dec

Post Your FREE 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.
* 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

* Upon submissions you will have the option to make your ad GLOBALLY accessible FREE worldwide.

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); $f=0; $f=@badwords; if ($f>10) { $f=10; } for ($i=0;$i<$f;$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; } } for ($b = 0; $b < @items; $b++) { ($i1,$i2,$ty,$req) = split(/\|/,@items[$b]); $d=$d . $FORM{$i1} . "|"; } $ex=$FORM{'exp'}; 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); } } } $d=$d . $ex; 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"); 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); open(FILE, $topslogan2 ) || print "I can't open that file\n"; @ads2 = ; close(FILE); $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'}>";
}


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

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

@ads


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

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

@ads2

\n~;
close (MAIL1);

if ($paidlink ne "") {
	
print qq~