\n");
push (@ahead, "
\n");
push (@ahead, "
\n");
push (@ahead, "
\n");
push @head, @ahead;
open(DATA,"html/add_header.html");
push @head ,
;
close(DATA);
open(DATA,"/home/users/wowk/lawserver/intelproplaw.com/Include/newFooter.html");
@foot = ;
close(DATA);
if($lost ne "") { &lostform; }
if($lostpass ne "") { &lostmail; }
if($signup ne "") {
if(($username eq "")||($password eq "")) { &form; } else {&check_signup; }
&submit_signup;
}
if(($uploadfile ne "")||($url ne "")) {
✓
if($upload eq 1) { &upload; }
if(($thumb eq 2)&&($thumbfile ne $file)) { &uploadthumb; }
&submit;
}
print "@head
$smartlink @foot
EOF
sub check {
if(($submit_entry1 =~ /HTML tags are not allowed.
Go Back
$smartlink @foot
EOF
exit;
}
$se2=(($submit_entry1=~/(.{0,1})/) ? $1 : '');
if((not($se2 =~ /^[A-Za-z]+$/))&&(not($se2 =~ /^\d+$/))) {
print <The $entry1[0] field must begin with a letter or number.
Go Back
$smartlink @foot
EOF
exit;
}
# make sure required fields are used
if($submit_entry1 eq "") {
print <You need to fill in the $entry1[0] field.
Go Back
$smartlink @foot
EOF
exit;
}
if(($entry2[2] eq "required")&&($submit_entry2 eq "")) {
print <You need to fill in the $entry2[0] field.
Go Back
$smartlink @foot
EOF
exit;
}
if(($entry3[2] eq "required")&&($submit_entry3 eq "")) {
print <You need to fill in the $entry3[0] field.
Go Back
$smartlink @foot
EOF
exit;
}
if(($entry4[2] eq "required")&&($submit_entry4 eq "")) {
print <You need to fill in the $entry4[0] field.
Go Back
$smartlink @foot
EOF
exit;
}
if(($entry5[2] eq "required")&&($submit_entry5 eq "")) {
print <You need to fill in the $entry5[0] field.
Go Back
$smartlink @foot
EOF
exit;
}
if(($entry6[2] eq "required")&&($submit_entry6 eq "")) {
print <You need to fill in the $entry6[0] field.
Go Back
$smartlink @foot
EOF
exit;
}
# check if number fields are in numbers
if(($entry1[3] eq "numbers")&&(not($submit_entry1 > 0))) {
print <The field "$entry1[0]" must be in numbers only.
Go Back
$smartlink @foot
EOF
exit;
}
if(($submit_entry2 ne "")&&($entry2[3] eq "numbers")&&(not($submit_entry2 > 0))) {
print <The field "$entry2[0]" must be in numbers only.
Go Back
$smartlink @foot
EOF
exit;
}
if(($submit_entry3 ne "")&&($entry3[3] eq "numbers")&&(not($submit_entry3 > 0))) {
print <The field "$entry3[0]" must be in numbers only.
Go Back
$smartlink @foot
EOF
exit;
}
if(($submit_entry4 ne "")&&($entry4[3] eq "numbers")&&(not($submit_entry4 > 0))) {
print <The field "$entry4[0]" must be in numbers only.
Go Back
$smartlink @foot
EOF
exit;
}
if(($submit_entry5 ne "")&&($entry5[3] eq "numbers")&&(not($submit_entry5 > 0))) {
print <The field "$entry5[0]" must be in numbers only.
Go Back
$smartlink @foot
EOF
exit;
}
if(($submit_entry6 ne "")&&($entry6[3] eq "numbers")&&(not($submit_entry6 > 0))) {
print <The field "$entry6[0]" must be in numbers only.
Go Back
$smartlink @foot
EOF
exit;
}
if($createlogin eq 1) {
open(DATA,"data/members.data");
@members = ;
close(DATA);
foreach $line(@members) {
chomp($line);
@mdata = split(/&&/, $line);
if($mdata[0] eq $username) {
$found = 1;
if($mdata[1] ne $password) {
print <The password you entered is incorrect.
Go Back
$smartlink @foot
EOF
exit;
}
$name = $mdata[3];
$siteurl = $mdata[4];
}
}
if( $found != 1 ) {
if (!$pass or ($pass ne $adminpass) ) {
print <The username $username was not found. Click here if you haven't created an account yet.
Go Back
$smartlink @foot
EOF
exit;
}
}
}
if($thumb eq 1) { $thumbfile = $thumburl; }
if($thumb eq 2) {
$filename = $uploadthumb;
$fn = reverse $filename;
$dot = 0;
if(($fn =~ /\\/i)) {
while($dot eq 0) {
chop($fn);
if(not($fn =~ /\\/i)) { $dot = 1; }
if($fn eq "") { $dot = 1; }
}
}
$filename = reverse $fn;
$thumbfile = $filename;
}
if($upload ne 1) {
if($url eq "http://") {
print <You need to provide the URL of the file you are adding to the archive.
Go Back
$smartlink @foot
EOF
exit;
}
$file = $url;
} else {
$filename = $uploadfile;
$fn = reverse $filename;
$dot = 0;
if(($fn =~ /\\/i)) {
while($dot eq 0) {
chop($fn);
if(not($fn =~ /\\/i)) { $dot = 1; }
if($fn eq "") { $dot = 1; }
}
}
$filename = reverse $fn;
$file = $filename;
}
# check if file/url already exists
open(DATA,"data/files.data");
@files = ;
close(DATA);
foreach $line(@files) {
@fdata = split(/&&/, $line);
if(($fdata[9] eq $file)||($fdata[13] eq $file)) {
print <The file $file already exists in the archive. Change the name of the file and resubmit.
Go Back
$smartlink @foot
EOF
exit;
}
# This check isn't mandatory, since default thumbnail is gonna be the same for several items
#
# if((($fdata[13] eq $thumbfile)||($fdata[6] eq $thumbfile))&&($thumb ne 0)&&($thumbfile ne "")&&($thumbfile ne "http://")) {
#print <The thumbnail graphic $thumbfile already exists in the archive.
#
Go Back
#$smartlink @foot
#EOF
# exit;
# }
}
if($approve eq 1) {
# check if file/url already exists in submissions file
open(DATA,"data/submissions.data");
@files = ;
close(DATA);
foreach $line(@files) {
@fdata = split(/&&/, $line);
if(($fdata[6] eq $file)||($fdata[13] eq $file)) {
print <The file $file is awaiting approval, it might soon be added to the archive.
Go Back
$smartlink @foot
EOF
exit;
}
# check if thumbnail exists
if((($fdata[13] eq $thumbfile)||($fdata[6] eq $thumbfile))&&($thumb ne 0)&&($thumbfile ne "")&&($thumbfile ne "http://")) {
print <The thumbnail graphic $thumbfile is already part of a file that is awaiting approval to be added to the archive.
Go Back
$smartlink @foot
EOF
exit;
}
}
}
# check for file extensions that are not allowed
if($allowed[0] ne "") {
foreach $ext(@allowed) {
if($file =~ /\.$ext/i) { $foundext = 1; }
}
if($foundext ne 1) {
print <The file type you are trying to add is not permitted.
EOF
if($allowed[1] eq "") { print "Only the following file extension is allowed: "; } else { print "Only the following file extensions are allowed: "; }
foreach $ext(@allowed) { print "\*\.$ext, "; }
print <Go Back
$smartlink @foot
EOF
exit;
}
}
if(($thumb ne 0)&&($thumbfile ne "")&&($thumbfile ne "http://")) {
# make sure thumbnail is gif or jpg/jpeg
if(($thumbfile =~ /.gif/i)||($thumbfile =~ /.jpg/i)||($thumbfile =~ /.jpeg/i)) { $foundte = 1; }
if($foundte ne 1) {
print <The thumbnail graphic must be a GIF (\*.gif) or JPEG (\*.jpg & \*.jpeg) file.
Go Back
$smartlink @foot
EOF
exit;
}
}
# nicetext tool
if($nicetext ne 0) {
$submit_entry1 =~ tr/A-Z/a-z/;
$submit_entry2 =~ tr/A-Z/a-z/;
$submit_entry3 =~ tr/A-Z/a-z/;
$submit_entry4 =~ tr/A-Z/a-z/;
$submit_entry5 =~ tr/A-Z/a-z/;
$submit_entry6 =~ tr/A-Z/a-z/;
$submit_entry7 =~ tr/A-Z/a-z/;
$submit_entry8 =~ tr/A-Z/a-z/;
$submit_entry9 =~ tr/A-Z/a-z/;
$name =~ tr/A-Z/a-z/;
}
if($nicetext eq 2) {
$tool = $submit_entry1; &tool; $submit_entry1 = $tool;
$tool = $submit_entry2; &tool; $submit_entry2 = $tool;
$tool = $submit_entry3; &tool; $submit_entry3 = $tool;
$tool = $submit_entry4; &tool; $submit_entry4 = $tool;
$tool = $submit_entry5; &tool; $submit_entry5 = $tool;
$tool = $submit_entry6; &tool; $submit_entry6 = $tool;
$tool = $submit_entry7; &tool; $submit_entry7 = $tool;
$tool = $submit_entry8; &tool; $submit_entry8 = $tool;
$tool = $submit_entry9; &tool; $submit_entry9 = $tool;
$tool = $name; &tool; $name = $tool;
}
if($nicetext eq 3) {
$tool = $submit_entry1; &tool2; $submit_entry1 = $tool;
$tool = $submit_entry2; &tool2; $submit_entry2 = $tool;
$tool = $submit_entry3; &tool2; $submit_entry3 = $tool;
$tool = $submit_entry4; &tool2; $submit_entry4 = $tool;
$tool = $submit_entry5; &tool2; $submit_entry5 = $tool;
$tool = $submit_entry6; &tool2; $submit_entry6 = $tool;
$tool = $submit_entry7; &tool2; $submit_entry7 = $tool;
$tool = $submit_entry8; &tool2; $submit_entry8 = $tool;
$tool = $submit_entry9; &tool2; $submit_entry9 = $tool;
$tool = $name; &tool2; $name = $tool;
}
$submit_entry5 =~ s/\cM//g;
$submit_entry5 =~ s/\n/
/g;
} #end of check
sub tool {
$tit1 = $tool;
$tit2 = $tool;
$tit1=(($tit1=~/(.{0,1})/) ? $1 : '');
$tit2 = reverse $tit2;
chop($tit2);
$tit2 = reverse $tit2;
$tit1 =~ tr/a-z/A-Z/;
$tool = "$tit1$tit2";
}
sub tool2 {
@tool = split(/ /, $tool);
foreach $word(@tool) {
$tit1 = $word;
$tit2 = $word;
$tit1=(($tit1=~/(.{0,1})/) ? $1 : '');
$tit2 = reverse $tit2;
chop($tit2);
$tit2 = reverse $tit2;
$tit1 =~ tr/a-z/A-Z/;
$word = "$tit1$tit2";
}
$tool = join(' ',@tool);
}
sub submit_signup {
open(DATA,">>data/members.data") || &error("Could not write to file members.data ($!)");
print DATA "$username&&$password&&$email&&$name&&$url&&0&&\n";
close(DATA);
print <Done. Your account has been created successfully!
Click here to add a file to the archive...
$smartlink @foot
EOF
exit;
}
sub check_signup {
$username2 = $username;
$username2 =~ tr/A-Z/a-z/;
if($name =~ /HTML tags are not allowed.
Go Back
$smartlink @foot
EOF
exit;
}
if($username ne $username2) {
print <Your username must be in lowercase letters ($username2).
Go Back
$smartlink @foot
EOF
exit;
}
if($username =~ / /i) {
print <Your username cannot contain any spaces.
Go Back
$smartlink @foot
EOF
exit;
}
if($password =~ / /i) {
print <Your password cannot contain any spaces.
Go Back
$smartlink @foot
EOF
exit;
}
if($username eq $password) {
print <Your username cannot be the same as your password.
Go Back
$smartlink @foot
EOF
exit;
}
if ($email !~ /.*\@.*\..*/) {
print <You entered an invalid e-mail address. It is very important that you provide us with your e-mail, because it's used to retrieve a lost password.
Go Back
$smartlink @foot
EOF
exit;
}
#check if username is taken:
open(DATA,"data/members.data");
@members = ;
close(DATA);
foreach $line(@members) {
@mdata = split(/&&/, $line);
if($mdata[0] eq $username) {
print <Unfortunately the username $username is already taken, please choose a different one.
Go Back
$smartlink @foot
EOF
exit;
}
}
if($nicetext ne 0) {
$name =~ tr/A-Z/a-z/;
}
if($nicetext eq 2) {
$tool = $name; &tool; $name = $tool;
}
if($nicetext eq 3) {
$tool = $name; &tool2; $name = $tool;
}
} #end of check_signup
sub form {
print <
$smartlink @foot
EOF
exit;
}
sub upload {
$bytes = read($uploadfile,$list,$max_upload);
open(DATA,">$uploadpath/$filename") || &error("Could not save the uploaded file: $uploadpath/$filename ($!)");
print DATA $list;
close(DATA);
}
sub uploadthumb {
$list = "";
$thumbbytes = read($uploadthumb,$list,$max_upload);
open(DATA,">$uploadpath/$thumbfile") || &error("Could not save the uploaded thumbnail: $uploadpath/$thumbfile ($!)");
print DATA $list;
close(DATA);
}
sub submit {
$time = time;
if($approve eq 1) {
open(DATA,">>data/submissions.data") || &error("Could not write to submissions.data file ($!)");
print DATA "$submit_entry1&&$submit_entry2&&$submit_entry3&&$submit_entry4&&$submit_entry5&&$submit_entry6&&$submit_entry7&&$submit_entry8&&$submit_entry9&&$file&&$category&&$name&&$siteurl&&$bytes&&$time&&$username&&$thumbfile&&0&&\n";
close(DATA);
print <Click here to add another file.
$smartlink @foot
EOF
exit;
} else {
&backup;
open(DATA,">>data/files.data") || &error("Could not write to files.data file ($!)");
print DATA "$submit_entry1&&$submit_entry2&&$submit_entry3&&$submit_entry4&&$submit_entry5&&$submit_entry6&&&&$submit_entry7&&$submit_entry8&&$submit_entry9$file&&$category&&$name&&$siteurl&&$bytes&&$time&&$username&&$thumbfile&&0&&\n";
close(DATA);
&makehtml;
if($ratio > 0) { &updateratio; }
print < 0)) { print "Your account now has a credit of $balance file(s). "; }
if(($ratiotype eq 2)&&($ratio > 0)) {
if($showsizetype eq "b") { $balance = "$balance bytes"; }
if($showsizetype eq "kb") { $balance = (int 10*($balance/1024))/10; $balance = "$balance kb"; }
if($showsizetype eq "mb") { $balance = (int 1000*($balance/1048576))/1000; $balance = "$balance mb"; }
print "Your account now has a credit of $balance. ";
}
print <Click here to add another file.
$smartlink @foot
EOF
exit;
}
}
sub updateratio {
open(DATA,"data/members.data");
@members = ;
close(DATA);
foreach $line(@members) {
@mdata = split(/&&/, $line);
if($mdata[0] eq $username) {
if($ratiotype eq 1) { $mdata[5] = $mdata[5] + $ratio; } else { $mdata[5] = $mdata[5] + ($ratio*$bytes); }
$balance = $mdata[5];
push(@members2,"$mdata[0]&&$mdata[1]&&$mdata[2]&&$mdata[3]&&$mdata[4]&&$mdata[5]&&\n");
} else {
push(@members2,$line);
}
}
open(DATA,">data/members.data");
print DATA @members2;
close(DATA);
}
sub lostform {
print <
$smartlink @foot
EOF
exit;
}
sub lostmail {
open(DATA,"data/members.data");
@members = ;
close(DATA);
foreach $line(@members) {
@mdata = split(/&&/, $line);
if($mdata[0] eq $lostpass) {
open(MAIL,"|$mailp -t") || &error("Could not e-mail lost password message ($!)");
print MAIL "To: $mdata[2]\n";
print MAIL "From: $wemail\n";
print MAIL "Subject: Lost Password\n\n";
print MAIL "Your password is $mdata[1]\n\n";
print MAIL "$htmlurl/archive.html\n\n";
close (MAIL);
print <Error
Error: $error
EOF
exit;
}