#!/usr/bin/perl
#################################################
# MeySoft Banner Manager - Version 2.60
# Last Update: 27-OCT-2000
#
# Copyright (c) 2000 MeySoft
# Author: Jeffrey L. Meyer
# WebMaster@MeySoft.com
#
# THIS HEADER MUST REMAIN INTACT
##########################################################################
# If you make ANY changes, other than the perl path, MeySoft cannot accept
# responsibilty for any adverse affects, and do not expect MeySoft to fix
# it for you. If you make any modifications at all below the perl line
# above, you are in violation of the license agreement and forfeit any
# and all rights under the license agreement, and you will lose the right
# to technical support. Do not expect our help nor any refund if you
# violate the license agreement.
##########################################################################
require "bm260fn.cgi";
&load_vars;
require "flush.pl";
require "bm260_sql.lib";
require "htmllib.pl";
alarm(180);
@slist=split(/,/,$CFG{'slist'});
$ext_msg=" ";
$ext_msg2="";
$no_error=1;
@CTRL=();
if($ENV{'REQUEST_METHOD'} eq 'POST'){
read(STDIN,$data,$ENV{'CONTENT_LENGTH'});
}else{
$data="$ENV{'QUERY_STRING'}";
}
@targets=();
@blocks=();
@fields = split(/&/,$data);
foreach $fields(@fields){
($field_name,$field_val)=split(/=/,$fields);
$field_val=~ s/\+/ /g;
$field_val=~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
if($field_name eq 'targets'){
push(@targets,$field_val);
}
if($field_name eq 'blocks'){
push(@blocks,$field_val);
}
$field_val=~ s/\,/./g;
$field_val=~ s/\&//g;
$field_val=~ s/\"//g;
$field_val=~ s/\'//g;
$field_val=~ s/\`//g;
$field_val=~ s/\*//g;
$field_val=~ s/\\//g;
$field_val=~ s///g;
$field_val=~ s/<([^>]|\n)*>//g;
$DATA{$field_name}=$field_val;
}
$first_load=0;
if(($data eq 'FORM')||($data eq '')){
print "Content-type: text/html\n\n";
$first_load=1;
$DATA{'style'}="$slist[0]";
$style="$slist[0]";
$DATA{'account'}="swap";
&send_form;
&end;
}
if($DATA{'style'}){
$style="$DATA{'style'}";
}else{
$no_error=0;
$ext_msg .="Banner Size Not Selected,";
&send_form;
&end;
}
$kc=&style_index($style);
$dbp="$CFG{'acct_dir'}/$style";
&get_date;
($bw,$bh)=split(/x/,$tst);
$no_error=1;
if(!($DATA{'name'})){
$ext_msg .="Site Name Missing, ";
$no_error=0;
}
if(!($DATA{'password'})){
$ext_msg .="Missing Password, ";
$no_error=0;
}
if((!($DATA{'verify'}))||($DATA{'verify'} ne $DATA{'password'})){
$no_error=0;
$ext_msg .= "Verified Password does not match, please re-enter,
";
}
if(!($DATA{'email'}=~ /.*\@.*\..*/)){
$ext_msg .="Invalid or Missing E-mail, ";
$no_error=0;
}
if(!($DATA{'linkurl'}=~ /.*tp:\/\/.*\..*/)){
$ext_msg .="Invalid or Missing Link URL, ";
$no_error=0;
}
if($CFG{'use_upload'}==0){
if($DATA{'bannerurl'}=~ /.*tp:\/\/.*\..*/){
$url="$DATA{'bannerurl'}";
$ext=substr($url,rindex($url,".")+1);
if(!(($ext eq 'gif')||($ext eq 'GIF')||($ext eq 'jpg')||($ext eq 'JPG'))){
$no_error=0;
$ext_msg .= "Invalid Banner Image URL (must end with .jpg,.JPG,.gif or .GIF)
";
}
$ban=0;
}else{
$ext_msg .="Invalid or Missing Banner Image URL, ";
$no_error=0;
$ban=1;
}
}else{
$DATA{'bannerurl'}="N/A";
}
if(!($DATA{'pageurl'}=~ /.*tp:\/\/.*\..*/)){
$DATA{'pageurl'}="$DATA{'linkurl'}";
}
if(!($DATA{'sitetype'})){
$site="N/A";
$no_error=0;
$ext_msg .="No Site Category Selected,";
}else{
$site="$DATA{'sitetype'}";
}
$blks=@blocks;
if($blks == 0){
push(@blocks,"NONE");
}
if(($DATA{'create'})||($no_error==1)){
$dt="$data";
print "Location: $CFG{'cgi_bin_path'}/submitb.cgi?$dt\n\n";
&end;
}
&bad_boy;
print "Content-type: text/html\n\n";
&send_form;
&end;
################
sub send_error {
print "Content-type: text/plain\n\n";
print "Could not create $dbp/$acct_num\n";
print "Error; $!\n";
&end;
}
##############
sub send_form{
open(SPAGE,"<$CFG{'form_dir'}/submit.html") or die "$!";
flock(SPAGE,1);
seek(SPAGE,0,0);
while($pline=){
$pline=~ s/NAME=\"name\" value/NAME=\"name\" value=\"$DATA{'name'}\"/g;
$pline=~ s/NAME=\"email\" value/NAME=\"email\" value=\"$DATA{'email'}\"/g;
$pline=~ s/NAME=\"linkurl\" value/NAME=\"linkurl\" value=\"$DATA{'linkurl'}\"/g;
$pline=~ s/NAME=\"pageurl\" value/NAME=\"pageurl\" value=\"$DATA{'pageurl'}\"/g;
$pline=~ s/NAME=\"bannerurl\" value/NAME=\"bannerurl\" value=\"$DATA{'bannerurl'}\"/g;
$pline=~ s/NAME=\"password\" value/NAME=\"password\" value=\"$DATA{'password'}\"/g;
$pline=~ s/NAME=\"verify\" value/NAME=\"verify\" value=\"$DATA{'verify'}\"/g;
if($no_error==0){
$ermtab=qq~
~;
$pline=~ s/