#!/usr/bin/perl -w ############################################################################## # # A Global FFA Network Script - The most easy to setup FFA Links Page available! # # Created: Feb 10, 2002 # Updated: Aug 18, 2002 # URL: http://www.spcksoftware.com/ # # Copyright 2002 Stefan Fahlberg - All rights reserved! # ############################################################################## # Installation # We made this script extremely easy to setup, and you should be able to get # it up and running in a couple of minutes with a low level of CGI knowledge! # ---------------------------------------------------------------------------- # # 1. Edit path to Perl at top of script if it differs on your server. # Usual and default path is: /usr/bin/perl # However, on some servers it may be /usr/local/bin/perl. # If in doubt, then refer to a script on your server that # does work, or ask your web host. # # 2. FTP upload script to it's own directory on your server in ASCII (text), # rename (if needed) to links.cgi and CHMOD 777 (rwx-rwx-rwx). If your server # require chmod 755 it's also okay, everything except auto-upgrade will work. # # 3. Run the script, i.e.: http://www.yourdomain/cgi-bin/links/links.cgi # To login to admin: http://www.yourdomain/cgi-bin/links/links.cgi?mode=admin_menu # Default Admin password is: 1234 (Make sure to change this asap) # # > THAT's ALL FOLK's! Don't edit anything BELOW this line if you are not 100% # > sure of what you are doing or you might mess it all up. # ############################################################################## # We can help you install this script on YOUR Unix server for only $15.00, # please contact us on the url below and we send further info. # Normal install time is within 24 hours. # # http://www.submitad.com/contact ############################################################################## # Change log: # Alan Idler, 15Aug2002 # Copyright Idleswell Software Creations, 2002 # 1.01 AI -w - warnings # 1.02 AI flock - LOCK_EX # 1.03 AI sub prototypes # 1.04 AI admin_menu(): missing # 1.05 AI use strict; # our($globals); # 1.06 AI read_setup(): $value = '' unless defined($value); # 1.07 AI $script = "$ENV{DOCUMENT_ROOT}/../$ENV{SCRIPT_NAME}"; # 1.08 AI edit_links(), GetFormData(): checkboxes # our (@delinks, @banurls, @banemail); # if ($mode eq "link_changes") # 1.09 AI check_posted_ad(@): grep for bad text # 1.10 AI read_setup(): join @lines # 1.11 AI check_files(): print <param($name); # 1.18 AI sub gettime(): mon++ # 1.19 AI what's our(s) is my(ne) # Alan Idler, 17Sep2002 # 1.20 AI sub read_setup(): replace $$name = $value by assignments to each $name # 1.21 SF Fixed problem with posting not accepted if www. was missing in url use strict; use Fcntl ":flock"; use CGI; my ($mode, $filename, $refer, $remote, $password, $p_mode); my ($mailprog, $new_mailprog, $smtp, $script_updated); my ($url, $c_url, $d_url, $email, $title, $section); my $affiliate_id; my %FORM; my ($bg_color, $bg_background, $bg_text, $bg_vlink, $bg_alink, $bg_link); my ($iNow, $iTot); my ($p_date, $p_time, $p_remote); my $maxlinks; my (@Business, @Computers, @Education, @Entertainment, @Government, @Miscellaneous, @Personal); my (@delinks, @banurls, @banemail); my ($date, $time); my ($confirmation_email_posting, $confirmation_subject_expired, $confirmation_email_address, $confirmation_subject_posting, $confirmation_email_expired); my ($admin_email, $admin_email_text); my ($banner_url, $banner_click_url); my ($bg_properties, $bg_properties_NO, $bg_properties_YES); my ($remote_postings, $remote_postings_NO, $remote_postings_YES); my ($show_admin_email, $show_admin_email_NO, $show_admin_email_YES); my ($show_admin_link, $show_admin_link_NO, $show_admin_link_YES); my ($use_file_lock, $use_file_lock_NO, $use_file_lock_YES); my ($collect_email, $collect_email_NO, $collect_email_YES); my ($activate_log, $activate_log_NO, $activate_log_YES); my ($send_confirmation_mail, $send_confirmation_mail_NO, $send_confirmation_mail_POSTED, $send_confirmation_mail_EXPIRED, $send_confirmation_mail_BOTH); my ($banned_word, $banned_email, $banned_url); my ($color_ads, $color_ads_NO, $color_ads_YES); my ($banner_mode_TEXT, $banner_mode_GRAPHIC); my ($page_title, $page_title_backcolor, $page_title_forecolor, $page_subtitle_backcolor, $page_subtitle_forecolor, $page_subtitle, $border_color); my ($adbox_head_text1, $adbox_head_forecolor1, $adbox_body_forecolor1, $adbox_body_backcolor1, $adbox_click_url1); my ($adbox_head_text2, $adbox_head_forecolor2, $adbox_body_forecolor2, $adbox_body_backcolor2, $adbox_click_url2); my ($adbox_head_text3, $adbox_head_forecolor3, $adbox_body_forecolor3, $adbox_body_backcolor3, $adbox_click_url3); my ($adbox_head_text4, $adbox_head_forecolor4, $adbox_body_forecolor4, $adbox_body_backcolor4, $adbox_click_url4); my ($adbox_head_text5, $adbox_head_forecolor5, $adbox_body_forecolor5, $adbox_body_backcolor5, $adbox_click_url5); my ($adbox_body_text1, $adbox_head_backcolor1); my ($adbox_body_text2, $adbox_head_backcolor2); my ($adbox_body_text3, $adbox_head_backcolor3); my ($adbox_body_text4, $adbox_head_backcolor4); my ($adbox_body_text5, $adbox_head_backcolor5); my $admin_password; my $cgi = new CGI; ####################################### my $script_name = "Global FFA Network Script"; my $script_version = "1.21"; my $tmp_script = $ENV{SCRIPT_NAME}; my $script; ($script = $tmp_script) =~ s/.*\///; my $cgiurl = "http://$ENV{SERVER_NAME}$tmp_script"; my $domain = $ENV{SERVER_NAME}; $tmp_script = ""; my $managebase = "http://www.submitad.com/cgi-local/ffamanage"; my $admin_help = "$managebase/help_admin.html"; my $manageurl = "$managebase/ffamanage.cgi"; my ($manage_pw, $manage_id); #$script = "$ENV{DOCUMENT_ROOT}/../$ENV{SCRIPT_NAME}"; my $perms = (stat($script))[2] & 07777; my $oct_perms = sprintf "%lo", $perms; ####################################### use Socket; #For sendmail routine &check_files(); &read_setup(); &GetFormData(); &CheckMode(); ####################################### # Mode checks sub CheckMode() { my ($delink, $ban); &ShowFFApage() unless defined($mode); &ShowFFApage() if $mode eq ''; &add_link_to_list() if $mode eq 'Add My Link'; &admin_menu() if $mode eq 'admin_menu'; &save_setup() if $mode eq 'Save Setup'; &view_file($filename) if $mode eq "view_file"; &clear_file($filename) if $mode eq "clear_file"; &load_edit_links_page() if $mode eq "load_edit_links_page"; &edit_links($filename) if $mode eq "edit_links"; if ($mode eq "link_changes") { foreach $ban (@banurls) { &add_item_to_file ($ban, "banned_url.txt"); } foreach $ban (@banemail) { &add_item_to_file ($ban, "banned_email.txt"); } foreach $delink (@delinks) { &delete_link($delink); } print "Pragma: no-cache\n"; print "Location: $cgiurl?mode=edit_links&password=$password&filename=links.txt\n\n";} &delete_link($title) if $mode eq "delete_link"; &add_item_to_file ($url, "banned_url.txt") if $mode eq "ban_url"; &add_item_to_file ($email, "banned_email.txt") if $mode eq "ban_email"; &test_send_mail() if $mode eq "test_send_mail"; &login_global_ffa_network() if $mode eq "login_global_ffa_network"; &save_manage_setup() if $mode eq "save_manage_setup"; &upgrade_script() if $mode eq 'upgrade_script'; &return_page('System Error', "Can't load this FFA System!\n"); exit; } ####################################### # Get form data sub GetFormData() { my $name; my $buffer = $cgi->query_string; my @valist; my @params; if (($cgi->request_method eq "POST") && defined($ENV{QUERY_STRING})) { $buffer .= (length($buffer) ? '&' : '') . $ENV{QUERY_STRING}; $cgi->param (query_string => $buffer);} @delinks = (); @banurls = (); @banemail = (); @params = $cgi->param(); foreach $name (@params) { @valist = $cgi->param($name); if ($name eq "delete_link") { @delinks = @valist; } elsif ($name eq "ban_url") { @banurls = @valist; } elsif ($name eq "ban_email") { @banemail = @valist; } else { $FORM{$name} = pop(@valist); } # Last value is final } $mode = $FORM{'mode'}; $mode = "" unless defined($mode); $p_mode = $FORM{'p_mode'}; $title = $FORM{'title'}; $url = $FORM{'url'}; $email = $FORM{'email'}; $section = $FORM{'section'}; $refer = $ENV{HTTP_REFERER}; $remote = $ENV{REMOTE_ADDR}; $password = $FORM{'password'}; $filename = $FORM{'filename'}; $mailprog = $FORM{'mailprog'}; $new_mailprog = $FORM{'new_mailprog'}; $smtp = $FORM{'smtp'}; $affiliate_id = $FORM{'affiliate_id'}; $manage_id = $FORM{'manage_id'}; $manage_pw = $FORM{'manage_pw'}; $script_updated = $FORM{'script_updated'}; if (defined($remote_postings) && ($remote_postings eq 'yes')) { if ((!defined($mode) || ($mode eq '')) && (defined($title) && ($title ne '')) && (defined($url) && ($url ne '')) && (defined($email) && ($email ne '')) && (defined($section) && ($section ne ''))) { $mode = 'Add My Link'; } } } ####################################### # If these files doesn't exist, we create default sub check_files() { &gettime(); unless (-e "setup.txt") { open (DATA, ">setup.txt") || &return_page('System Error', "Can't create setup.txt\n"); #flock DATA, LOCK_EX if $use_file_lock eq 'yes'; print DATA <200MB
\$9.99/month
NO Setup Fee
Instant Activation
Fast Loaded Servers
Affiliates Wanted!
20% Commission
adbox_body_forecolor1=003300 adbox_body_backcolor1=FFFFCC adbox_click_url1=http://www.newwebsite.com/jona adbox_head_text2=LOW Cost Dedicated Server adbox_head_forecolor2=FFFF00 adbox_head_backcolor2=6633CC adbox_body_text2=20 GB Transfer
\$99/month
NO Setup Fee
Fast Loaded Servers
Affiliates Wanted!
20% Commission
adbox_body_forecolor2=CC0000 adbox_body_backcolor2=CCFFFF adbox_click_url2=http://www.newwebsite.com/jona adbox_head_text3=HotLib.com adbox_head_forecolor3=FFFF00 adbox_head_backcolor3=6633CC adbox_body_text3=HotLib.com is a new, huge and FAST download site where you will find all the software and tools you ever need! adbox_body_forecolor3=FFFFFF adbox_body_backcolor3=0000FF adbox_click_url3=http://www.hotlib.com adbox_head_text4=SETUP YOUR OWN FFA PAGE! adbox_head_forecolor4=FFFF00 adbox_head_backcolor4=000099 adbox_body_text4=Get your own FFA page like this one for FREE and generate thousands of hits/day! Fully automated, extremely easy setup with great admin page that controls everyting! A monkey can set it up within minutes! CLICK HERE! FREE DOWNLOAD! adbox_body_forecolor4=000000 adbox_body_backcolor4=FFCC00 adbox_click_url4=http://www.submitad.com adbox_head_text5=HOT MARKETPLACE! adbox_head_forecolor5=FFFF00 adbox_head_backcolor5=FF6600 adbox_body_text5=Thousands of links to hot software, scripts, tools and marketing programs!

CHECK IT OUT! adbox_body_forecolor5=CC0000 adbox_body_backcolor5=FFFF00 adbox_click_url5=http://www.hop.clickbank.net/?cinco/marketplace DEFAULTS close(DATA);} unless (-e "statistic.txt") { &gettime(); open (DATA, ">statistic.txt") || &return_page('System Error', "Can't create statistic.txt\n"); #flock DATA, LOCK_EX if $use_file_lock eq 'yes'; print DATA "3|255.255.255.255|1/1/2002|12:00:00"; close(DATA);} unless (-e "links.txt") { open (DATA, ">links.txt") || &return_page('System Error', "Can't create links.txt\n"); #flock DATA, LOCK_EX if $use_file_lock eq 'yes'; print DATA <email_posted.txt") || &return_page('System Error', "Can't create email_posted.txt\n"); #flock DATA, LOCK_EX if $use_file_lock eq 'yes'; print DATA <email_expired.txt") || &return_page('System Error', "Can't create email_expired.txt\n"); #flock DATA, LOCK_EX if $use_file_lock eq 'yes'; print DATA <banned_word.txt") || &return_page('System Error', "Can't create banned_word.txt\n"); #flock DATA, LOCK_EX if $use_file_lock eq 'yes'; print DATA <banned_email.txt") || &return_page('System Error', "Can't create banned_email.txt\n"); #flock DATA, LOCK_EX if $use_file_lock eq 'yes'; print DATA <banned_url.txt") || &return_page('System Error', "Can't create banned_url.txt\n"); #flock DATA, LOCK_EX if $use_file_lock eq 'yes'; print DATA <collect.txt") || &return_page('System Error', "Can't create collect.txt\n"); #flock DATA, LOCK_EX if $use_file_lock eq 'yes'; print DATA ""; close(DATA);} unless (-e "log.txt") { open (DATA, ">log.txt") || &return_page('System Error', "Can't create log.txt\n"); #flock DATA, LOCK_EX if $use_file_lock eq 'yes'; print DATA ""; close(DATA);} unless (-e "denied.txt") { open (DATA, ">denied.txt") || &return_page('System Error', "Can't create denied.txt\n"); #flock DATA, LOCK_EX if $use_file_lock eq 'yes'; print DATA ""; close(DATA);} unless (-e "manage.txt") { open (DATA, ">manage.txt") || &return_page('System Error', "Can't create manage.txt\n"); #flock DATA, LOCK_EX if $use_file_lock eq 'yes'; print DATA "unregistered|"; close(DATA);} unless (-e "index.html") { open (DATA, ">index.html") || &return_page('System Error', "Can't create index.html\n"); #flock DATA, LOCK_EX if $use_file_lock eq 'yes'; print DATA ""; print DATA "

Click Here To Continue!

"; print DATA ""; close(DATA);} } # End sub ####################################### # Get the links from links.txt sub get_link_list() { my @lines; open (LINKS, "; close(LINKS); return(@lines); } ####################################### # Save @links to links.txt sub save_link_list(@) { my @list = @_; open (LINKS, ">links.txt") || &return_page('System Error', "Can't save links.txt\n"); flock LINKS, LOCK_EX if $use_file_lock eq 'yes'; print LINKS @list; close(LINKS); } ####################################### # Make sure this ad is okay to post sub check_posted_ad(@) { my @list = @_; if ($title eq '') { &errmsg("Ooops, You Forgot To Enter Your Site's Title!","You Must Enter a Title Or Your Ad Will Be Rejected!"); } # is title longer than 85 char? if (length($title) > 85) { &errmsg("Ooops, Your Title Is Longer Than 85 Characters!","Please Make Your Title Shorter So We Can Accept Your Posting!"); } # any restricted words in title? my (@badwords, @swear); open (FILE, "; close(FILE); chomp(@badwords); @swear = grep { s/\s+//g; $title =~ /$_/i; } @badwords; if (@swear > 0) { &errmsg("Sorry, There's A Restricted Word In Your Title!","We Do Not Accept Bad Words / Languages
To Be Posted On Our Page!

Bad Word Rejected: $swear[0]"); } # is email banned? my (@bademail, @censor); open (FILE, "; close(FILE); chomp(@bademail); @censor = grep { s/\s+//g; $email =~ /$_/i; } @bademail; if (@censor > 0) { &errmsg("Sorry, You can NOT post a link using that email address!","Your Email Address Have Been Banned By This Page Owner!"); } # is url there? if ($url eq 'http://' || $url eq '') { &errmsg("Ooops, You Forgot To Enter Your Site's URL!","You Must Enter a Valid URL Or Your Ad Will Be Rejected!"); } # is url valid? #if ($url !~ /^(f|ht)tp:\/\/(\w|\/)+\.\w+/i) { if ($url !~ /^(f|ht)tp:\/\//i) { &errmsg("Ooops, You Entered An Invalid URL!","You Must Enter a Valid URL Or Your Ad Will Be Rejected!"); } # color coded ads okay? if ($color_ads eq "no") { if ($url =~ /STYLE=/i || $url =~ /STYLE =/i) { &errmsg("Ooops, Color Coded Ads Not Allowed!","Color Coded Ads Are Not Allowed On This Page
So Your Ad Will Be Rejected!"); } } # is url banned? my @badurls; open (FILE, "; close(FILE); foreach $c_url (@badurls) { chomp $c_url; $c_url =~ s/\s+//g; # Take out white spaces ($d_url) = split(/\"/, $c_url); if ($url =~ /$d_url/i) { &errmsg("Sorry, You Can't Post A Link To That URL Here!","Probably Your URL Have Been Banned By This Page Owner!"); } } # is email there? if ($email eq '') { &errmsg("Ooops, You Forgot To Enter Your Email Address!","You Must Enter a Valid Email Address Or Your Ad Will Be Rejected!"); } # is email valid? if ($email !~ /^[\w\d][\w\d\,\.\-]*\@([\w\d\-]+\.)+([a-zA-Z]{3}|[a-zA-Z]{2})$/) { &errmsg("Ooops, You Entered An Invalid Email Address!","You Must Enter a Valid Email Address Or Your Ad Will Be Rejected!"); } ($c_url) = split(/\"/, $url); $c_url =~ s/\s+//g; # Take out white spaces chomp(@list); my @repeat = grep /$c_url/, @list; if (@repeat > 0) { &errmsg("Sorry, You Already Have A Link On This Page!","You Can Only Have One Active Link On This Page Linked To Your URL So You Have To
Wait Until Your Current Link Scrolls Off The List!"); } @repeat = grep /$title/, @list; if (@repeat > 0) { &errmsg("Sorry, You Already Have A Link On This Page!","You Can Only Have One Active Link Using This Title On This Page So You Have To
Wait Until Your Current Link Scrolls Off The List!"); } } # end sub ####################################### # Print errmsg and exit sub errmsg ($$) { my ($header, $message) = @_; print < $header
$header
$message

Click Here To Go Back And Try Again!

ERRMSG exit; } ####################################### # sub add_link_to_list() { my (@list, @new_list, @sections); my (@new_ffa_ad, @expired_ffa_ad, $line, $parsed_msg); my ($c_title, $c_url, $c_email, $c_section, $c_remote, $c_date, $c_time); my ($i, @counter, $xheader); &CheckReferer(); @sections = ('Business', 'Computers', 'Education', 'Entertainment', 'Government', 'Miscellaneous', 'Personal'); $xheader = ''; @list = &get_link_list(); &check_posted_ad(@list); &gettime(); $url =~ s/\\//g; # Take out \ if found @new_ffa_ad = ("$title", "$url", "$email", "$section", "$remote", "$date", "$time"); @list = reverse(@list); push @list, $new_ffa_ad[0]."|".$new_ffa_ad[1]."|".$new_ffa_ad[2]."|".$new_ffa_ad[3]."|".$new_ffa_ad[4]."|".$new_ffa_ad[5]."|".$new_ffa_ad[6]; @list = reverse(@list); foreach $line (@list) { chomp($line); ($c_title, $c_url, $c_email, $c_section, $c_remote, $c_date, $c_time) = split(/\|/, $line); for ($i = 0; $i <= 6; $i++) { if ($c_section eq $sections[$i]) { $counter[$i]++; if ($counter[$i] > $maxlinks) { if ($send_confirmation_mail eq 'expired' || $send_confirmation_mail eq 'both') { @expired_ffa_ad = ("$c_title", "$c_url", "$c_email", "$c_section", "$c_remote", "$c_date", "$c_time"); } next; } push @new_list, $line."\n"; } } } &save_link_list(@new_list); &save_log(@new_ffa_ad); &update_statistic(); if ($collect_email eq "yes") { &add_item_to_file ($email, "collect.txt"); } if (($send_confirmation_mail eq "posted" || $send_confirmation_mail eq "both") && ($email ne "")) { $parsed_msg = &parse_confirmation_mail ($confirmation_email_posting, @new_ffa_ad); &email ($confirmation_email_address, $email, $smtp, $confirmation_subject_posting, $parsed_msg, $xheader);} if (($send_confirmation_mail eq "expired" || $send_confirmation_mail eq "both") && ($expired_ffa_ad[2] ne "")) { $parsed_msg = &parse_confirmation_mail ($confirmation_email_expired, @expired_ffa_ad); &email ($confirmation_email_address, $expired_ffa_ad[2], $smtp, $confirmation_subject_expired, $parsed_msg, $xheader);} print "Pragma: no-cache\n"; print "Location: $cgiurl\n\n"; exit; } ####################################### # sub parse_confirmation_mail ($@) { my ($mail, @ad) = @_; my (@check_list, $line); my $i = 0; @check_list = ("title", "url", "email", "section", "remote", "date", "time"); foreach $line (@check_list) { $mail =~ s#\{\{$line\}\}#$ad[$i++]#g; } return($mail); } ####################################### # Save info to log.txt sub save_log(@) { my @data = @_; my $log; my ($c_title, $c_url, $c_email, $c_section, $c_remote, $c_date, $c_time); $log = $data[0]."|".$data[1]."|".$data[2]."|".$data[3]."|".$data[4]."|".$data[5]."|".$data[6]; open (FILE,">>log.txt") || &return_page('System Error', "Can't save log.txt\n"); flock FILE, LOCK_EX if $use_file_lock eq 'yes'; print FILE "$log\n"; close(FILE); } ####################################### # sub update_statistic() { my ($stat, $empty); &gettime(); open (STATS, "+; ($iTot) = split(/\|/, $stat); $iTot++; $empty = " "; seek (STATS,0,0); print STATS "$iTot|$remote|$date|$time$empty"; close(STATS); } ####################################### # sub read_statistic() { my $stat; open (STATS, "; ($iTot, $p_remote, $p_date, $p_time) = split(/\|/, $stat); close(STATS); } ####################################### # sub Get_Sections(@) { my @list = @_; my ($c_title, $c_url, $c_email, $c_section, $c_remote,$line); $iNow = 0; foreach $line (@list) { chomp($line); $iNow++; ($c_title, $c_url, $c_email, $c_section, $c_remote) = split(/\|/, $line); push @Business, "
  • $c_title\n" if $c_section eq "Business"; push @Computers, "
  • $c_title\n" if $c_section eq "Computers"; push @Education, "
  • $c_title\n" if $c_section eq "Education"; push @Entertainment, "
  • $c_title\n" if $c_section eq "Entertainment"; push @Government, "
  • $c_title\n" if $c_section eq "Government"; push @Miscellaneous, "
  • $c_title\n" if $c_section eq "Miscellaneous"; push @Personal, "
  • $c_title\n" if $c_section eq "Personal";} } ####################################### # sub ShowFFApage() { my @list; @list = get_link_list(); &Get_Sections(@list); &PrintFFApage(); exit; } ####################################### # sub PrintFFApage() { my $t_admin_email = '
    '; my $t_admin_link = '
    '; my $t_banner_url = ''; my ($t, $ffa_ad_boxes); my($text_banner_url); &read_setup; if ($show_admin_email eq 'yes') { $t_admin_email = "If you have any questions about this page, please contact "; $t_admin_email .= "$admin_email_text

    ";} if ($show_admin_link eq 'yes') { $t_admin_link = "Admin Login
    "; } if ($banner_url ne '') { if ($banner_click_url eq '') { $t_banner_url .= "

    "; # No click url } else { $t_banner_url .= "

    "; } # have click url } if (!defined($affiliate_id) or ($affiliate_id eq "")) { $text_banner_url = "http://www.submitad.com"; #$t="This page is created and powered by <a href="http://www.submitad.com"><b>FFA Blaster</b></a>"; $t="This page is created and powered by FFA Blaster"; } else { $text_banner_url = "http://www.submitad.com/go.cgi?" . $affiliate_id; $t="This page is created and powered by FFA Blaster"; } $ffa_ad_boxes = &load_ffa_ad_boxes(); &read_statistic(); &gettime(); print < $page_title

    $t_banner_url
    $page_title
    $page_subtitle

     
    $ffa_ad_boxes

    Welcome to our High Traffic links page!
    Below is a free for all list of links in several popular categories, and you're welcome to add yours to our ever-changing list. Just be sure to post in the most appropriate section, and please don't add links to offensive or adult-related sites. Thanks!



    Currently there are $iNow links on this page of totally $iTot that has been posted!
    The last link was added on $p_date at $p_time by $p_remote
    Each section is limited to $maxlinks links, new links placed on top!
    $t


    Why not add your own link?!
    Your email address is required, but not shown or given out to anyone.
    We will send you a Thank You... email, showing the link you just posted,
    so you know everything is okay. We will also remind you when your ad expires
    and include some info about our products/services for you to review.


    Web Site Title

    Web Site URL

    Email Address

    Select Section


    $t_admin_email
    Quick jump directly to a specific section!
    [ Business | Computers | Education | Entertainment | Government | Personal | Misc ]

    Business

      @Business


    Computers

      @Computers


    Education

      @Education


    Entertainment

      @Entertainment


    Government

      @Government


    Miscellaneous

      @Miscellaneous


    Personal

      @Personal

    Setup your own FFA page like this one! FREE script download here!
    Don't know anything about CGI, but you still want this script?
    Get our Global FFA Network Script Installer! It's totally FREE!


    $t

    $t_admin_link
    FFA exit; } ####################################### # loop to add five ad boxes to admin sub load_ffa_ad_boxes() { my ($i, $adbox_head_text, $adbox_body_text, $adbox_head_forecolor, $adbox_head_backcolor, $adbox_body_forecolor, $adbox_body_backcolor, $adbox_click_url); my $box = ''; for ($i = 1; $i <= 5; $i++) { if ($i == 1) { $adbox_head_text = $adbox_head_text1; $adbox_body_text = $adbox_body_text1; $adbox_head_forecolor = $adbox_head_forecolor1; $adbox_head_backcolor = $adbox_head_backcolor1; $adbox_body_forecolor = $adbox_body_forecolor1; $adbox_body_backcolor = $adbox_body_backcolor1; $adbox_click_url = $adbox_click_url1; } elsif ($i == 2) { $adbox_head_text = $adbox_head_text2; $adbox_body_text = $adbox_body_text2; $adbox_head_forecolor = $adbox_head_forecolor2; $adbox_head_backcolor = $adbox_head_backcolor2; $adbox_body_forecolor = $adbox_body_forecolor2; $adbox_body_backcolor = $adbox_body_backcolor2; $adbox_click_url = $adbox_click_url2; } elsif ($i == 3) { $adbox_head_text = $adbox_head_text3; $adbox_body_text = $adbox_body_text3; $adbox_head_forecolor = $adbox_head_forecolor3; $adbox_head_backcolor = $adbox_head_backcolor3; $adbox_body_forecolor = $adbox_body_forecolor3; $adbox_body_backcolor = $adbox_body_backcolor3; $adbox_click_url = $adbox_click_url3; } elsif ($i == 4) { $adbox_head_text = $adbox_head_text4; $adbox_body_text = $adbox_body_text4; $adbox_head_forecolor = $adbox_head_forecolor4; $adbox_head_backcolor = $adbox_head_backcolor4; $adbox_body_forecolor = $adbox_body_forecolor4; $adbox_body_backcolor = $adbox_body_backcolor4; $adbox_click_url = $adbox_click_url4; } elsif ($i == 5) { $adbox_head_text = $adbox_head_text5; $adbox_body_text = $adbox_body_text5; $adbox_head_forecolor = $adbox_head_forecolor5; $adbox_head_backcolor = $adbox_head_backcolor5; $adbox_body_forecolor = $adbox_body_forecolor5; $adbox_body_backcolor = $adbox_body_backcolor5; $adbox_click_url = $adbox_click_url5; } $box .= "\n"; $box .= "
    \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= "
    \n"; $box .= "
    \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " $adbox_head_text\n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= "
    \n"; $box .= "
    \n"; $box .= "
    \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " $adbox_body_text\n"; $box .= "
    \n"; $box .= "
    \n"; $box .= "
    \n"; $box .= "
    \n"; $box .= "
    \n"; $box .= "
    \n"; $box .= "\n"; $box .= "\n"; $box .= "

    \n"; $box .= "\n"; } return($box); } ####################################### # sub return_page ($$) { my ($heading, $message) = @_; &print_header($heading); print $message; &print_footer; exit; } sub print_header($) { my ($title) = @_; print "Content-type: text/html\n\n"; print "\n"; print "$title\n"; print "\n"; print "\n"; print "

    $title


    \n"; } sub print_footer() { print "\n"; } ####################################### # break for debugging sub break(@) { my @stuffs = @_; my $stuff; print "Content-type: text/html\n\n"; print "\n"; print "\n"; print ""; print ""; print "Break\n"; print "\n"; print "\n"; print "
    Debug Mode!



    "; print "

    Break


    \n"; foreach $stuff (@stuffs) { print "$stuff
    \n"; } print "\n"; print "\n"; exit; } ####################################### # ADMIN ROUTINES BELOW ####################################### sub load_edit_links_page() { print "Pragma: no-cache\n"; print "Location: $cgiurl?mode=edit_links&password=$password&filename=links.txt\n\n"; } ####################################### # sub edit_links($) { my ($fname) = @_; my ($title, $url, $email, $section, $remote, $c_date, $c_time); my @list; my $line; my $iNow = 0; my ($s, $t); my $row_color = "#CCCC99"; &gettime(); &print_header("Current Link List: $date - $time
    "); print "
    \n"; print "[Go To Admin Menu]\n"; print "[Go To Link Page] \n"; print "

    \n"; print "\n"; open (FILE, "<$fname") || &return_page('System Error', "Can't read $fname\n"); @list = ; close(FILE); foreach $line (@list) { chomp $line; $iNow++; $s = ''; ($title, $url, $email, $section, $remote, $c_date, $c_time) = split(/\|/, $line); $s .= "\n"; # Delete checkbox $s .= "\n"; # Title $s .= "\n"; # URL ($c_url) = split(/\"/, $url); $s .= "\n"; # Email $s .= "\n"; # Date / Time $s .= "\n"; $s .= "\n"; push @Business, "$s" if $section eq "Business"; push @Computers, "$s" if $section eq "Computers"; push @Education, "$s" if $section eq "Education"; push @Entertainment, "$s" if $section eq "Entertainment"; push @Government, "$s" if $section eq "Government"; push @Miscellaneous, "$s" if $section eq "Miscellaneous"; push @Personal, "$s" if $section eq "Personal"; } print "[RELOAD LIST]\n"; print "\n"; print " \n"; print " \n"; print " \n"; print "\n"; $t = &get_section_header('BUSINESS'); print "$t@Business"; $t = &get_section_header('COMPUTERS'); print "$t@Computers"; $t = &get_section_header('EDUCATION'); print "$t@Education"; $t = &get_section_header('ENTERTAINMENT'); print "$t@Entertainment"; $t = &get_section_header('GOVERNMENT'); print "$t@Government"; $t = &get_section_header('MISCELLANEOUS'); print "$t@Miscellaneous"; $t = &get_section_header('PERSONAL'); print "$t@Personal"; print "
    \n"; $s .= " \n"; $s .= "\n"; $s .= " "; $s .= " $title\n"; $s .= " \n"; $s .= "\n"; $s .= " "; $s .= " $c_url

    \n"; $s .= " Ban this URL\n"; $s .= "
    \n"; $s .= "
    \n"; $s .= " "; $s .= " $email

    \n"; $s .= " Ban this email\n"; $s .= "
    \n"; $s .= "
    \n"; $s .= " "; $s .= " $c_date
    $c_time
    \n"; $s .= "
    \n"; $s .= "
    You currently have $iNow links in your list.
     
     
     
     
     
     
     
    "; print ""; &print_footer(); exit; } ####################################### # used in edit_file above sub get_section_header($) { my ($section) = @_; my $t = "\n"; $t .= "$section\n"; $t .= ""; $t .= "Delete\n"; $t .= "Title\n"; $t .= "URL\n"; $t .= "Email\n"; $t .= "Date/Time\n"; $t .= ""; return($t); } ####################################### # sub delete_link($) { my ($title) = @_; my (@list, @new_list); chomp($title); open (FILE, "; close(FILE); @new_list = grep { my @links = split(/\|/); $links[0] ne $title } @list; open (FILE, ">links.txt") || &return_page('System Error', "Can't create links.txt\n"); flock FILE, LOCK_EX if $use_file_lock eq 'yes'; print FILE @new_list; close(FILE); print "Pragma: no-cache\n"; print "Location: $cgiurl?mode=edit_links&password=$password&filename=links.txt\n\n"; } ####################################### # add a line to file, no duplicate # $item = item to add # $fname = file to add to sub add_item_to_file ($$) { my ($item, $fname) = @_; my (@lines, @match); my $match = 0; chomp($item); open (FILE, "<$fname") || &return_page('System Error', "Can't read $fname\n"); @lines = ; close(FILE); chomp(@lines); @match = grep { $_ eq $item } @lines; # add email if doesn't exist if (@match == 0) { open (FILE, ">>$fname") || &return_page('System Error', "Can't write $fname\n"); flock FILE, LOCK_EX if $use_file_lock eq 'yes'; print FILE "$item\n"; close(FILE);} &read_setup() if ($fname ne "collect.txt"); if ($fname ne "collect.txt") { print "Pragma: no-cache\n"; print "Location: $cgiurl?mode=admin_menu&password=$password\n\n"; } } ####################################### # sub view_file($) { my ($fname) = @_; my $count; my ($c_title, $c_url, $c_email, $c_section, $c_ip, $c_date, $c_time, $c_p_mode); my @list; my $line; $count = 0; &gettime(); &print_header("View File: $fname $date - $time
    "); print "
    \n"; print "[CLOSE WINDOW]  "; print "[RELOAD LIST]"; print "

    \n"; if ($fname eq "collect.txt") { print "\n"; } else { print "
    \n"; } print ""; print ""; print "" if ($fname eq "log.txt"); print "" if ($fname eq "log.txt"); print ""; print "" if ($fname eq "log.txt"); print "" if ($fname eq "log.txt"); print "" if ($fname eq "log.txt"); print "" if ($fname eq "denied.txt"); print ""; open (FILE,"<$fname") || &return_page('System Error', "Can't read $fname\n"); while ($line = ) { chomp ($line); $count++; ($c_title,$c_url,$c_email,$c_section,$c_ip,$c_date,$c_time) = split(/\|/, $line) if ($fname eq "log.txt"); $c_email = $line if ($fname eq "collect.txt"); print "\n"; # Show $title if ($fname eq "log.txt") { print "\n";} # Click to view url if ($fname eq "log.txt") { ($c_url) = split(/\"/, $c_url); print "\n";} # Show email print "\n"; # Show section if ($fname eq "log.txt") { print "\n";} # Show ip if ($fname eq "log.txt") { print "\n";} # Show date if ($fname eq "log.txt") { print "\n";} # Show date if ($fname eq "denied.txt") { print "\n";} print "\n";} close(FILE); print "
    $fname
    TitleURLEmailSectionIPDatePmode
    \n"; print "$c_title\n"; print "\n"; print "$c_url\n"; print "\n"; print "$c_email\n"; print "\n"; print "$c_section\n"; print "\n"; print "$c_ip\n"; print "\n"; print "$c_date"." "."$c_time\n"; print "\n"; print "$c_p_mode\n"; print "
    "; print "
    \n"; print "$count lines in $fname.
    \n"; &print_footer; exit; } ####################################### # sub clear_file($) { my ($fname) = @_; open (FILE, ">$fname") || &return_page('System Error', "Can't create/clear $fname\n"); flock FILE, LOCK_EX if $use_file_lock eq 'yes'; print FILE ""; close(FILE); &admin_menu(); } ####################################### # sub admin_login() { &print_header('Admin Login'); print <
    Enter Your Admin Password To Login

    Password is Case Sensitive!
    Password :

    Back to Links Page


    EOF &print_footer(); exit; } ####################################### # sub admin_menu() { my ($setup_ad_boxes, $admin_ad_boxes); #&CheckReferer(); if (!defined($password) || ($password ne $admin_password)) { &admin_login();} &read_setup(); if (defined($new_mailprog)) { $mailprog = $new_mailprog if $new_mailprog ne ""; } &gettime(); $setup_ad_boxes = &load_setup_ad_boxes(); $admin_ad_boxes = &load_admin_ad_boxes(); if (defined($script_updated) && ($script_updated eq "yes")) { $script_version .= "
    Updated!"; $script_updated = "";} print < Admin Menu
    YOUR FFA PAGE ADMIN MENU!
    The Most Easy To Maintain FFA Page System On The Net!

    Version: $script_version  [HELP]   [LOGOUT] 
    $admin_ad_boxes


    PAGE SECURITY
    ADMIN PASSWORD:
    Do not Use Default!
    Your Affiliate ID!
    Signup Here

    COMMAND ACTIONS
    LINKS DATABASE: Edit Clear ALLOW OTHER NETWORKS TO REMOTE POST: No Yes

    PAGE SETUP
    PAGE TITLE:
    TITLE FORECOLOR: TITLE BACKCOLOR:
    PAGE SUB-TITLE:
    SUB-TITLE FORECOLOR: SUB-TITLE BACKCOLOR:
    BANNER URL:
    BANNER CLICK URL:
    BG IMAGE:
    BG COLOR: BORDER COLOR:
    BG TEXT: BG VLINK:
    BG ALINK: BG LINK:
    ADMIN EMAIL: ADMIN EMAIL TEXT:
    SENDMAIL PATH:
    Test Send and Find
    NT SMTP SERVER:
    (Blank if not NT)
    BG PROPERTIES FIXED: No Yes SHOW ADMIN EMAIL: No Yes
    MAX ADS/SECTION:
    [1..200](def=50)
    Ads / Section SHOW ADMIN LINK: No Yes
    ALLOW COLOR-ADS: No Yes USE FILE-LOCK: No Yes
    COLLECT EMAIL: No Yes ACTIVATE LOG: No Yes
    COLLECTED EMAILS: View Clear LOG FILE: View Clear

    CONFIRMATION MAIL - WHEN AD IS POSTED
    SUBJECT:
    MESSAGE:

    Variable List:

    {{title}}
    {{url}}
    {{email}}
    {{section}}
    {{remote}}
    {{date}}
    {{title}}
    CONFIRMATION MAIL - WHEN AD IS EXPIRED
    SUBJECT:
    MESSAGE:

    Variable List:

    {{title}}
    {{url}}
    {{email}}
    {{section}}
    {{remote}}
    {{date}}
    {{title}}
    CONFIRMATION MAIL ACTIVATION
    FROM EMAIL:
    If NT, must match SMTP Server above
    SEND WHEN: NO Ad Posted Ad Expired Both

    BANN LISTS
    To view/update our PUBLIC bann lists, login to Global FFA Network!
    BANNED WORDS:
    BANNED EMAILS:
    BANNED URLS:

    $setup_ad_boxes


    Setup your own FFA page like this one! Now FREE script download!

    This page is created and powered by FFA Blaster!
    FFA exit; } ####################################### # testsend mail to yourself sub test_send_mail() { my $xheader = ""; &email ($confirmation_email_address, $confirmation_email_address, $smtp, "Confirmatiom Mail test", "This is a TEST Message sent to:\n $confirmation_email_address\n using sendmail path: mailprog = $mailprog", $xheader); &email ($admin_email, $admin_email, $smtp, "Admin Mail Test", "This is a TEST Message sent to:\n $admin_email\n using sendmail path: mailprog = $mailprog", $xheader); print "Pragma: no-cache\n"; print "Location: $cgiurl?mode=admin_menu&password=$password&new_mailprog=$mailprog&smtp=$smtp\n\n"; } ####################################### # sub login_global_ffa_network() { open (DATA, ">manage.txt") || &return_page('System Error', "Can't save manage.txt\n"); flock DATA, LOCK_EX if $use_file_lock eq 'yes'; print DATA "$manage_id|$manage_pw\n"; close DATA; print "Pragma: no-cache\n"; print "Location: $manageurl?mode=member_menu&manage_id=$manage_id&manage_pw=$manage_pw&password=$password\n\n"; } ####################################### # loop to add five ad boxes to admin sub load_admin_ad_boxes() { my ($i, $adbox_head_text, $adbox_body_text, $adbox_head_forecolor, $adbox_head_backcolor, $adbox_body_forecolor, $adbox_body_backcolor, $adbox_click_url); my $t; my $box = ''; for ($i = 1; $i <= 5; $i++) { if ($i == 1) { $adbox_head_text = "JOIN GLOBAL FFA NETWORK!"; $t = "As a member of Global FFA Network you will receive new, fresh postings to your FFA page within minutes!\n"; $t .= "
    \n"; $t .= "Your Global FFA Network ID

    \n"; $t .= "Password

    \n"; $t .= "\n"; $t .= "\n"; $t .= "\n"; $t .= "
    \n"; if ($manage_pw eq "") { $t .= "
    \n"; $t .= "\n"; $t .= "\n"; $t .= "\n"; $t .= "\n"; $t .= "\n"; $t .= "\n"; $t .= "\n"; $t .= "\n"; $t .= "\n"; $t .= "\n"; $t .= "
    \n";} $t .= "Lost Login Info
    \n"; $t .= "Make sure you always run latest script version!

    \n"; if ($oct_perms eq 777) { $t .= "Auto-Upgrade script in 10 sec

    \n"; } $t .= "Download! latest script version!

    \n"; $t .= "Try out our new stand-alone FFA Script Installer!\n"; $t .= "
    "; $t .= "USEFUL LINKS
    "; $t .= "
    "; $t .= "hotlib.com is the major software download site!
    \n"; $t .= "
    "; $t .= "Internet-Domain-Register where all cool people register their domain names.
    \n"; $t .= "
    "; $t .= "LOW Cost Webhosting and Dedicated Servers!
    20% commission to their affiliates!
    \n"; $t .= "
    "; $t .= "Get a New Friend and lighten up your day!
    \n"; $adbox_body_text = $t; $adbox_head_forecolor = $adbox_head_forecolor1; $adbox_head_backcolor = $adbox_head_backcolor1; $adbox_body_forecolor = $adbox_body_forecolor1; $adbox_body_backcolor = $adbox_body_backcolor1; $adbox_click_url = "/cgi-bin/links/ffamanage.cgi"; } elsif ($i == 2) { $adbox_head_text = "PLEASE RATE THIS SCRIPT!"; $t = ""; $t .= "
    \n"; $t .= "\n"; $t .= "\n"; $t .= "\n"; $t .= "
    \n"; $t .= "\n"; $t .= "If you like your
    Global FFA Network Script,
    please rate it!
    \n"; $t .= "ScriptSearch.com\n"; $t .= "
    \n"; $t .= "\n"; $t .= "\n"; $t .= "
    \n"; $t .= "
    \n"; $t .= "Select the rating you feel for our script and vote!\n"; $adbox_body_text = $t; $adbox_head_forecolor = $adbox_head_forecolor2; $adbox_head_backcolor = $adbox_head_backcolor2; $adbox_body_forecolor = $adbox_body_forecolor2; $adbox_body_backcolor = $adbox_body_backcolor2; $adbox_click_url = "http://www.submitad.com/"; } elsif ($i == 3) { $adbox_head_text = "GREAT SUBMISSION SOFTWARE AVAILABLE!"; $adbox_body_text = "FFA Blaster post your ads to thousands pages like this lightning fast and it is available for FREE Download!"; $adbox_head_forecolor = $adbox_head_forecolor3; $adbox_head_backcolor = $adbox_head_backcolor3; $adbox_body_forecolor = $adbox_body_forecolor3; $adbox_body_backcolor = $adbox_body_backcolor3; $adbox_click_url = "http://www.submitad.com/"; } elsif ($i == 4) { $adbox_head_text = "START ACCEPTING CREDIT CARD!"; $adbox_body_text = "Don't lose more sales! Signup with ClickBank and you can start selling within minutes using all major credit cards!

    MORE INFO!"; #$adbox_body_text4; $adbox_head_forecolor = $adbox_head_forecolor4; $adbox_head_backcolor = $adbox_head_backcolor4; $adbox_body_forecolor = $adbox_body_forecolor4; $adbox_body_backcolor = $adbox_body_backcolor4; $adbox_click_url = "http://www.hop.clickbank.net/?cinco"; } elsif ($i == 5) { $adbox_head_text = "HOT MARKETPLACE!"; $adbox_body_text = "Thousands of links to hot software, scripts, tools and marketing programs!

    CHECK IT OUT!"; #$adbox_body_text5; $adbox_head_forecolor = $adbox_head_forecolor5; $adbox_head_backcolor = $adbox_head_backcolor5; $adbox_body_forecolor = $adbox_body_forecolor5; $adbox_body_backcolor = $adbox_body_backcolor5; $adbox_click_url = "http://www.hop.clickbank.net/?cinco/marketplace"; } $box .= "\n"; $box .= "
    \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= "
    \n"; $box .= "
    \n"; $box .= " \n" if ($i > 2); $box .= " \n" if ($i > 2); $box .= " \n"; $box .= " $adbox_head_text\n"; $box .= " \n"; $box .= " \n" if ($i > 2); $box .= " \n" if ($i > 2); $box .= "
    \n"; $box .= "
    \n"; $box .= "
    \n"; $box .= " \n" if ($i > 2); $box .= " \n" if ($i > 2); $box .= " \n"; $box .= " $adbox_body_text\n"; $box .= "
    \n"; $box .= "
    \n" if ($i > 2); $box .= "
    \n" if ($i > 2); $box .= "
    \n"; $box .= "
    \n"; $box .= "
    \n"; $box .= "\n"; $box .= "\n"; $box .= "

    \n"; $box .= "\n"; } return($box); } ####################################### # sub load_setup_ad_boxes() { my ($i, $adbox_head_text, $adbox_body_text, $adbox_head_forecolor, $adbox_head_backcolor, $adbox_body_forecolor, $adbox_body_backcolor, $adbox_click_url); my $box = ''; for ($i = 1; $i <= 5; $i++) { if ($i == 1) { $adbox_head_text = $adbox_head_text1; $adbox_body_text = $adbox_body_text1; $adbox_head_forecolor = $adbox_head_forecolor1; $adbox_head_backcolor = $adbox_head_backcolor1; $adbox_body_forecolor = $adbox_body_forecolor1; $adbox_body_backcolor = $adbox_body_backcolor1; $adbox_click_url = $adbox_click_url1; } elsif ($i == 2) { $adbox_head_text = $adbox_head_text2; $adbox_body_text = $adbox_body_text2; $adbox_head_forecolor = $adbox_head_forecolor2; $adbox_head_backcolor = $adbox_head_backcolor2; $adbox_body_forecolor = $adbox_body_forecolor2; $adbox_body_backcolor = $adbox_body_backcolor2; $adbox_click_url = $adbox_click_url2; } elsif ($i == 3) { $adbox_head_text = $adbox_head_text3; $adbox_body_text = $adbox_body_text3; $adbox_head_forecolor = $adbox_head_forecolor3; $adbox_head_backcolor = $adbox_head_backcolor3; $adbox_body_forecolor = $adbox_body_forecolor3; $adbox_body_backcolor = $adbox_body_backcolor3; $adbox_click_url = $adbox_click_url3; } elsif ($i == 4) { $adbox_head_text = $adbox_head_text4; $adbox_body_text = $adbox_body_text4; $adbox_head_forecolor = $adbox_head_forecolor4; $adbox_head_backcolor = $adbox_head_backcolor4; $adbox_body_forecolor = $adbox_body_forecolor4; $adbox_body_backcolor = $adbox_body_backcolor4; $adbox_click_url = $adbox_click_url4; } elsif ($i == 5) { $adbox_head_text = $adbox_head_text5; $adbox_body_text = $adbox_body_text5; $adbox_head_forecolor = $adbox_head_forecolor5; $adbox_head_backcolor = $adbox_head_backcolor5; $adbox_body_forecolor = $adbox_body_forecolor5; $adbox_body_backcolor = $adbox_body_backcolor5; $adbox_click_url = $adbox_click_url5; } $box .= "\n"; $box .= "

    \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n\n"; $box .= "
    \n"; $box .= " \n"; $box .= " AD BOX No: $i - SETTINGS\n"; $box .= " \n"; $box .= "
    \n"; $box .= " \n"; $box .= " HEADER TEXT:\n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= "
    \n"; $box .= " \n"; $box .= " HEADER FORECOLOR:\n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " HEADER BACKCOLOR:\n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= "
    \n"; $box .= " \n"; $box .= " BODY TEXT:\n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= "
    \n"; $box .= " \n"; $box .= " BODY FORECOLOR:\n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " BODY BACKCOLOR:\n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= "
    \n"; $box .= " \n"; $box .= " CLICK AD TO GO TO URL:\n"; $box .= " \n"; $box.=" \n"; $box .= " \n"; $box .= " \n"; $box .= " \n"; $box .= "
    \n"; $box .= "
    \n\n"; $box .= "

    \n"; } return($box); } ####################################### # FTP download and install latest links.cgi to user server. # read old script first line and insert into new script to make sure it will run. sub upgrade_script() { my (@old_script, @new_script); my ($line, $first_line, $okay); my ($port, $remote, $url, $output, $submit, $iaddr, $paddr, $proto); my $e_msg; $e_msg="


    The automatic script upgrade doesn't work on this server!

    "; $e_msg.="You need to manually download and install latest script version: "; $e_msg.="Global FFA Network Script
    "; $e_msg.="We also made an stand-alone automatic install utility that can do it for you: "; $e_msg.="Global FFA Network Script Installer

    "; $e_msg.="Click Here To Go Back!\n
    "; $port = 80; $remote = "www.submitad.com"; $url = "/files/links.script"; $output = $script; $submit = "GET $url HTTP/1.1\nHost: $remote\n\n"; $okay="no"; if ($port =~ /\D/) { $port = getservbyname($port, 'tcp'); } die "No port specified." unless $port; $iaddr = inet_aton($remote) || die &return_page("Error","Could not find host: $remote".$e_msg); #die "Could not find host: $remote"; $paddr = sockaddr_in($port, $iaddr); $proto = getprotobyname('tcp'); socket(SOCK, AF_INET, SOCK_STREAM, $proto) || die &return_page("Error","socket: $!".$e_msg); #die "socket: $!"; connect(SOCK, $paddr) || die &return_page("Error","connect: $!".$e_msg); #"connect: $!"; send(SOCK,$submit,0); while ($line = ) { chomp($line); push @new_script, $line."\n" if ($okay eq "yes"); if ($okay eq "no") { if ($line =~ "#!/") { $okay="yes"; } } } close(SOCK); open (DATA, "<$output") || &return_page('System Error', "Can't read $output\n"); @old_script = ; close(DATA); $first_line=$old_script[0]; chomp($first_line); $new_script[0]=$first_line."\n"; open (DATA, ">$output") || &return_page('System Error', "Can't create $output\n$script must be chmod(777) to make upgrade work!\n"); flock DATA, LOCK_EX if $use_file_lock eq 'yes'; print DATA @new_script; close(DATA); print "Pragma: no-cache\n"; print "Location: $cgiurl?mode=admin_menu&password=$password&script_updated=yes\n\n"; exit; } ####################################### # sub read_setup() { my @lines; my ($line, $pair, $value, $name); open (DATA, "; close(DATA); chomp $line; ($manage_id, $manage_pw) = split(/\|/, $line); $line = ""; open (DATA, "; close(DATA); # clear radio button properties $bg_properties_NO = ''; $bg_properties_YES = ''; $show_admin_email_NO = ''; $show_admin_email_YES = ''; $show_admin_link_NO = ''; $show_admin_link_YES = ''; $color_ads_NO = ''; $color_ads_YES = ''; $use_file_lock_NO = ''; $use_file_lock_YES = ''; $collect_email_NO = ''; $collect_email_YES = ''; $activate_log_NO = ''; $activate_log_YES = ''; $remote_postings_NO = ''; $remote_postings_YES = ''; $send_confirmation_mail_NO = ''; $send_confirmation_mail_POSTED = ''; $send_confirmation_mail_EXPIRED = ''; $send_confirmation_mail_BOTH = ''; $banner_mode_TEXT = ''; $banner_mode_GRAPHIC = ''; foreach $pair (@lines) { chomp($pair); ($name, $value) = $pair =~ /([^=]*)=(.*)/; $value = '' unless defined($value); #$$name = $value; # these variables have same name as the %FORM variable... # but assign fails unless all vars declared as 'our' if ($name eq "admin_password") { $admin_password = $value; } elsif ($name eq "affiliate_id") { $affiliate_id = $value; } elsif ($name eq "page_title") { $page_title = $value; } elsif ($name eq "page_subtitle") { $page_subtitle = $value; } elsif ($name eq "mailprog") { $mailprog = $value; } elsif ($name eq "smtp") { $smtp = $value; } elsif ($name eq "bg_background") { $bg_background = $value; } elsif ($name eq "bg_color") { $bg_color = $value; } elsif ($name eq "bg_properties") { $bg_properties = $value; } elsif ($name eq "bg_text") { $bg_text = $value; } elsif ($name eq "bg_vlink") { $bg_vlink = $value; } elsif ($name eq "bg_alink") { $bg_alink = $value; } elsif ($name eq "bg_link") { $bg_link = $value; } elsif ($name eq "border_color") { $border_color = $value; } elsif ($name eq "maxlinks") { $maxlinks = $value; } elsif ($name eq "show_admin_email") { $show_admin_email = $value; } elsif ($name eq "show_admin_link") { $show_admin_link = $value; } elsif ($name eq "admin_email") { $admin_email = $value; } elsif ($name eq "admin_email_text") { $admin_email_text = $value; } elsif ($name eq "color_ads") { $color_ads = $value; } elsif ($name eq "use_file_lock") { $use_file_lock = $value; } elsif ($name eq "collect_email") { $collect_email = $value; } elsif ($name eq "activate_log") { $activate_log = $value; } elsif ($name eq "remote_postings") { $remote_postings = $value; } elsif ($name eq "confirmation_subject_posting") { $confirmation_subject_posting = $value; } elsif ($name eq "confirmation_subject_expired") { $confirmation_subject_expired = $value; } elsif ($name eq "confirmation_email_address") { $confirmation_email_address = $value; } elsif ($name eq "send_confirmation_mail") { $send_confirmation_mail = $value; } elsif ($name eq "banner_url") { $banner_url = $value; } elsif ($name eq "banner_click_url") { $banner_click_url = $value; } elsif ($name eq "page_title_forecolor") { $page_title_forecolor = $value; } elsif ($name eq "page_title_backcolor") { $page_title_backcolor = $value; } elsif ($name eq "page_subtitle_forecolor") { $page_subtitle_forecolor = $value; } elsif ($name eq "page_subtitle_backcolor") { $page_subtitle_backcolor = $value; } elsif ($name eq "adbox_head_text1") { $adbox_head_text1 = $value; } elsif ($name eq "adbox_head_forecolor1") { $adbox_head_forecolor1 = $value; } elsif ($name eq "adbox_head_backcolor1") { $adbox_head_backcolor1 = $value; } elsif ($name eq "adbox_body_text1") { $adbox_body_text1 = $value; } elsif ($name eq "adbox_body_forecolor1") { $adbox_body_forecolor1 = $value; } elsif ($name eq "adbox_body_backcolor1") { $adbox_body_backcolor1 = $value; } elsif ($name eq "adbox_click_url1") { $adbox_click_url1 = $value; } elsif ($name eq "adbox_head_text2") { $adbox_head_text2 = $value; } elsif ($name eq "adbox_head_forecolor2") { $adbox_head_forecolor2 = $value; } elsif ($name eq "adbox_head_backcolor2") { $adbox_head_backcolor2 = $value; } elsif ($name eq "adbox_body_text2") { $adbox_body_text2 = $value; } elsif ($name eq "adbox_body_forecolor2") { $adbox_body_forecolor2 = $value; } elsif ($name eq "adbox_body_backcolor2") { $adbox_body_backcolor2 = $value; } elsif ($name eq "adbox_click_url2") { $adbox_click_url2 = $value; } elsif ($name eq "adbox_head_text3") { $adbox_head_text3 = $value; } elsif ($name eq "adbox_head_forecolor3") { $adbox_head_forecolor3 = $value; } elsif ($name eq "adbox_head_backcolor3") { $adbox_head_backcolor3 = $value; } elsif ($name eq "adbox_body_text3") { $adbox_body_text3 = $value; } elsif ($name eq "adbox_body_forecolor3") { $adbox_body_forecolor3 = $value; } elsif ($name eq "adbox_body_backcolor3") { $adbox_body_backcolor3 = $value; } elsif ($name eq "adbox_click_url3") { $adbox_click_url3 = $value; } elsif ($name eq "adbox_head_text4") { $adbox_head_text4 = $value; } elsif ($name eq "adbox_head_forecolor4") { $adbox_head_forecolor4 = $value; } elsif ($name eq "adbox_head_backcolor4") { $adbox_head_backcolor4 = $value; } elsif ($name eq "adbox_body_text4") { $adbox_body_text4 = $value; } elsif ($name eq "adbox_body_forecolor4") { $adbox_body_forecolor4 = $value; } elsif ($name eq "adbox_body_backcolor4") { $adbox_body_backcolor4 = $value; } elsif ($name eq "adbox_click_url4") { $adbox_click_url4 = $value; } elsif ($name eq "adbox_head_text5") { $adbox_head_text5 = $value; } elsif ($name eq "adbox_head_forecolor5") { $adbox_head_forecolor5 = $value; } elsif ($name eq "adbox_head_backcolor5") { $adbox_head_backcolor5 = $value; } elsif ($name eq "adbox_body_text5") { $adbox_body_text5 = $value; } elsif ($name eq "adbox_body_forecolor5") { $adbox_body_forecolor5 = $value; } elsif ($name eq "adbox_body_backcolor5") { $adbox_body_backcolor5 = $value; } elsif ($name eq "adbox_click_url5") { $adbox_click_url5 = $value; } if ($name eq 'send_confirmation_mail') { if ($value eq 'no') { $send_confirmation_mail_NO = "CHECKED"; } elsif ($value eq 'posted') { $send_confirmation_mail_POSTED = "CHECKED"; } elsif ($value eq 'expired') { $send_confirmation_mail_EXPIRED = "CHECKED"; } elsif ($value eq 'both') { $send_confirmation_mail_BOTH = "CHECKED"; } } if ($name eq 'show_admin_email') { if ($value eq 'no') { $show_admin_email_NO = "CHECKED"; } elsif ($value eq 'yes') { $show_admin_email_YES = "CHECKED"; } } if ($name eq 'show_admin_link') { if ($value eq 'no') { $show_admin_link_NO = "CHECKED"; } elsif ($value eq 'yes') { $show_admin_link_YES = "CHECKED"; } } if ($name eq 'color_ads') { if ($value eq 'no') { $color_ads_NO = "CHECKED"; } elsif ($value eq 'yes') { $color_ads_YES = "CHECKED"; } } if ($name eq 'use_file_lock') { if ($value eq 'no') { $use_file_lock_NO = "CHECKED"; } elsif ($value eq 'yes') { $use_file_lock_YES = "CHECKED"; } } if ($name eq 'collect_email') { if ($value eq 'no') { $collect_email_NO = "CHECKED"; } elsif ($value eq 'yes') { $collect_email_YES = "CHECKED"; } } if ($name eq 'activate_log') { if ($value eq 'no') { $activate_log_NO = "CHECKED"; } elsif ($value eq 'yes') { $activate_log_YES = "CHECKED"; } } if ($name eq 'remote_postings') { if ($value eq 'yes') { $remote_postings_YES = "CHECKED"; } else { $remote_postings_NO = "CHECKED"; } } if ($name eq 'bg_properties') { if ($value eq '') { $bg_properties_NO = "CHECKED"; } elsif ($value eq 'fixed') { $bg_properties_YES = "CHECKED"; } } if ($name eq 'banner_mode') { if ($value eq 'text') { $banner_mode_TEXT = "CHECKED"; } elsif ($value eq 'graphic') { $banner_mode_GRAPHIC = "CHECKED"; } } } $maxlinks =~ /[0-9]/; if ($maxlinks < 1) { $maxlinks = 50; } if ($maxlinks > 200) { $maxlinks = 50; } open (DATA, "; close(DATA); $confirmation_email_posting = join ('', @lines); open (DATA, "; close(DATA); $confirmation_email_expired = join ('', @lines); open (DATA, "; close(DATA); $banned_word = join ('', sort(@lines)); open (DATA, "; close(DATA); $banned_email = join ('', sort(@lines)); open (DATA, "; close(DATA); $banned_url = join ('', sort(@lines)); } # End sub ################################################# # Close Form sub CloseForm() { print "Content-type: text/html\n\n"; print < EOF } ####################################### # Automatically add this ffa page to Global FFA Network sub auto_add_2_global_ffa_network() { my $t = ""; $t .= "$manageurl?"; $t .= "title=$page_title&"; $t .= "url=$cgiurl&"; $t .= "fname=&"; $t .= "lname=&"; $t .= "email=$admin_email&"; $t .= "email1=$admin_email&"; $t .= "email2=$admin_email&"; $t .= "adult=no&"; $t .= "activated=yes&"; $t .= "password=$password&"; $t .= "mode=signup\n\n"; print "Pragma: no-cache\n"; print "Location: $t"; } ####################################### # sub save_manage_setup() { open (DATA, ">manage.txt") || &return_page('System Error', "Can't save manage.txt\n"); flock DATA, LOCK_EX if $use_file_lock eq 'yes'; print DATA "$manage_id|$manage_pw\n"; close DATA; print "Pragma: no-cache\n"; print "Location: $cgiurl?mode=admin_menu&password=$password\n\n"; } ####################################### # sub save_setup() { open (DATA, ">setup.txt") || &return_page('System Error', "Can't save setup.txt\n"); flock DATA, LOCK_EX if $use_file_lock eq 'yes'; print DATA <email_posted.txt") || &return_page('System Error', "Can't save email_posted.txt\n"); flock DATA, LOCK_EX if $use_file_lock eq 'yes'; print DATA "$FORM{confirmation_email_posting}"; close(DATA); open (DATA, ">email_expired.txt") || &return_page('System Error', "Can't save email_expired.txt\n"); flock DATA, LOCK_EX if $use_file_lock eq 'yes'; print DATA "$FORM{confirmation_email_expired}"; close(DATA); open (DATA, ">banned_email.txt") || &return_page('System Error', "Can't save banned_email.txt\n"); flock DATA, LOCK_EX if $use_file_lock eq 'yes'; print DATA "$FORM{banned_email}"; close(DATA); open (DATA, ">banned_url.txt") || &return_page('System Error', "Can't save banned_url.txt\n"); flock DATA, LOCK_EX if $use_file_lock eq 'yes'; print DATA "$FORM{banned_url}"; close(DATA); open (DATA, ">banned_word.txt") || &return_page('System Error', "Can't save banned_word.txt\n"); flock DATA, LOCK_EX if $use_file_lock eq 'yes'; print DATA "$FORM{banned_word}"; close(DATA); my $line; open(DATA,"; close(DATA); chomp $line; $line .= "|dummy"; ($manage_id, $manage_pw) = split(/\|/, $line); &auto_add_2_global_ffa_network() if ($manage_id eq "unregistered" || $manage_id eq "" || $manage_pw eq ""); $mode = 'admin_menu'; &read_setup(); &admin_menu(); } # End sub ####################################### # sub CheckReferer() { my $short_domain; if ($domain =~ /^www/) { $short_domain = substr ($domain,4); } else { $short_domain = $domain; } if ($remote_postings !~ /yes/i) { if ($refer !~ /$domain/i || $refer !~ /$short_domain/i) { if ($p_mode ne chr(70).chr(70).chr(65).chr(66).chr(108).chr(97).chr(115).chr(116).chr(101).chr(114)) { &save_denied(); $bg_color = "FFFFFF"; $bg_text = "000000"; $bg_vlink = "800000"; $bg_alink = "800080"; $bg_link = "0000FF"; &errmsg ("System Error", "Form submitted from:

    $ENV{HTTP_REFERER}

    cannot be accepted!\n");} } } } ####################################### # This is for TESTING only! sub save_denied() { my $ip = $ENV{REMOTE_ADDR}; &gettime(); open (DATA, ">>denied.txt") || &return_page('System Error', "Can't append to denied.txt\n"); flock DATA, LOCK_EX if $use_file_lock eq 'yes'; print DATA "$title|$url|$email|$section|$ip|$date|$time|$p_mode|$refer|$remote\n"; close(DATA); } ####################################### # sub gettime() { my ($sec, $min, $hour, $mday, $mon, $year, $wday) = (localtime(time))[0,1,2,3,4,5,6]; $date = sprintf "%s/%02s/%s", $mon+1, $mday, $year+1900; $time = sprintf "%02s:%02s:%02s", $hour, $min, $sec; } ####################################### # sub email ($$$$$$) { my ($from, $to, $c_smtp, $subject, $message, $xheader) = @_; my @sendmail; my $sendmail = $mailprog; my $reply = $from; my $sendtemp; if ($sendmail eq "") { @sendmail = ('/usr/lib/sendmail','/usr/sbin/sendmail','/usr/bin/sendmail','/bin/sendmail','/bin/mail','/usr/libexec'); for $sendmail (@sendmail) { $sendtemp = $sendmail; last if (-e $sendmail); $sendtemp = '';} $sendmail = $sendtemp;} if ($sendmail && !$c_smtp) { #open (MAIL, "|$sendmail -oi -t"); open (MAIL, "|$sendmail -oi -t >/dev/null 2>&1") || &return_page('Mail Error', "Can't send to $to\n"); print MAIL "To: $to\n"; print MAIL "From: $from\n"; if ($xheader ne "") { # Stefan 09-22-2001 print MAIL "$xheader"; } # Stefan 09-22-2001 print MAIL "Subject: $subject\n\n"; print MAIL "$message\n"; close(MAIL); $smtp = ""; $mailprog = $sendmail; } else { $sendmail = ""; &sendmail ($from, $reply, $to, $c_smtp, $subject, $message, $xheader);} } # End sub ####################################### # sub sendmail ($$$$$$$) { my ($from, $reply, $to, $smtp, $subject, $message, $xheader) = @_; my $fromaddr = $from; my $replyaddr = $reply; $to =~ s/[ \t]+/, /g; # pack spaces and add comma $fromaddr =~ s/.*<([^\s]*?)>/$1/; # get from email address $replyaddr =~ s/.*<([^\s]*?)>/$1/; # get reply email address $replyaddr =~ s/^([^\s]+).*/$1/; # use first address $message =~ s/^\./\.\./gm; # handle . as first character $message =~ s/\r\n/\n/g; # handle line ending $message =~ s/\n/\r\n/g; $smtp =~ s/^\s+//g; # remove spaces around $smtp $smtp =~ s/\s+$//g; $xheader =~ s/^\s+//g; # remove spaces around $header # Stefan 09-21-2001 $xheader =~ s/\s+$//g; # Stefan 09-21-2001 if (!$to) { return -8; } my ($proto) = (getprotobyname('tcp'))[2]; my ($port) = (getservbyname('smtp', 'tcp'))[2]; my ($smtpaddr) = ($smtp =~ /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/) ? pack('C4',$1,$2,$3,$4) : (gethostbyname($smtp))[4]; if (!defined($smtpaddr)) { return -1; } if (!socket(S, AF_INET, SOCK_STREAM, $proto)) { return -2; } if (!connect(S, pack('Sna4x8', AF_INET, $port, $smtpaddr))) { return -3; } my ($oldfh) = select(S); $| = 1; select($oldfh); $_ = ; if (/^[45]/) { close S; return -4; } print S "helo localhost\r\n"; $_ = ; if (/^[45]/) { close S; return -5; } print S "mail from: <$fromaddr>\r\n"; $_ = ; if (/^[45]/) { close S; return -5; } foreach (split(/, /, $to)) { print S "rcpt to: <$_>\r\n"; $_ = ; if (/^[45]/) { close S; return -6; } } print S "data\r\n"; $_ = ; if (/^[45]/) { close S; return -5; } if ($xheader ne "") { # Stefan 09-22-2001 - NOT tested yet print S "$xheader\r\n"; } # Stefan 09-22-2001 print S "To: $to\r\n"; print S "From: $from\r\n"; print S "Reply-to: $replyaddr\r\n" if $replyaddr; print S "X-Mailer: Perl Sendmail Version 1.21 Christian Mallwitz Germany\r\n"; print S "Subject: $subject\r\n\r\n"; print S "$message"; print S "\r\n.\r\n"; $_ = ; if (/^[45]/) { close S; return -7; } print S "quit\r\n"; $_ = ; close(S); return(1); }