#!/usr/bin/perl # ### CONTROL PANEL SCRIPT FOR ULTIMATE BULLETIN BOARD ## # # Ultimate Bulletin Board is copyright Infopop Corporation, 1997-2000. # # ------------ cpanel4.cgi ------------- # # This file contains some of the control panel functionality for # the UBB. It is called from the controlpanel pages (cp.html). # # NOTE: you MAY NOT redistribute this script under any # circumstance. This means that you may not sell, trade, or in # any other way give this script to another user who is not # licensed to use it. Infopop Corporation offers no # warranties on this script. The owner/licensee of the script is # solely responsible for any problems caused by installation of # the script or use of the script, including messages that may be # posted on the BB. # # All copyright notices regarding the Ultimate Bulletin Board # must remain intact on the scripts and in the HTML # for the scripts. # # For more info on the Ultimate BB, # see http://www.UltimateBB.com # ############################################################### #If you are running UBB on IIS, #you may need to add the following line #if so, just remove the "#" sign before the print line below #print "HTTP/1.0 200 OK\n"; print ("Content-type: text/html\n\n"); eval { ($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX / or Windows / ($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \ #substitute all require files here for the file require "mods.file"; require "UltBB.setup"; require "ubb_library.pl"; require "ubb_library2.pl"; require "Date.pl"; require "Styles.file"; }; if ($@) { print "Error including required files: $@\n"; print "Make sure these files exist, permissions are set properly, and paths are set correctly."; exit; } use Socket; #create random numbers for headers/footers $RandomNumber = &MakeRandomNumber; $RandomNumber2 = $RandomNumber + 100074; if (-e "$ForumsPath/Forum$number/forumstyles.file") { if ($ForumHeader ne "") { $Header = $ForumHeader; $Header =~ s/UBBrandomX/$RandomNumber/isg; $Header =~ s/UBBrandomY/$RandomNumber2/isg; } else { if ($Header ne "") { $Header =~ s/UBBrandomX/$RandomNumber/isg; $Header =~ s/UBBrandomY/$RandomNumber2/isg; } } if ($ForumFooter ne "") { $Footer = $ForumFooter; $Footer =~ s/UBBrandomX/$RandomNumber/isg; $Footer =~ s/UBBrandomY/$RandomNumber2/isg; } else { if ($Footer ne "") { $Footer =~ s/UBBrandomX/$RandomNumber/isg; $Footer =~ s/UBBrandomY/$RandomNumber2/isg; } } } else { if ($Header ne "") { $Header =~ s/UBBrandomX/$RandomNumber/isg; $Header =~ s/UBBrandomY/$RandomNumber2/isg; } if ($Footer ne "") { $Footer =~ s/UBBrandomX/$RandomNumber/isg; $Footer =~ s/UBBrandomY/$RandomNumber2/isg; } } #adjust bgcolor variables if ($BGColor ne ""){ $BGColor = qq(bgcolor="$BGColor"); } if ($AltColumnColor1 ne ""){ $AltColumnColor1 = qq(bgcolor="$AltColumnColor1"); } if ($AltColumnColor2 ne ""){ $AltColumnColor2 = qq(bgcolor="$AltColumnColor2"); } if ($CategoryStripColor ne ""){ $CategoryStripColor = qq(bgcolor="$CategoryStripColor"); } if ($TableColorStrip ne ""){ $TableColorStrip = qq(bgcolor="$TableColorStrip"); } if ($PageBackground ne ""){ $PageBackground = qq(background="$NonCGIURL/$PageBackground"); } if ($TableBorderColor ne ""){ $TableWidth2 = "100%"; $BorderTop = qq(
| ); $BorderBottom = qq( |
We just finished processing Forum$x - $ForumName .
HTML Files deleted in that forum: $RemoveCount. Please wait as we continue processing!);
$ForwardURL = "$CGIURL/cpanel4.cgi?action=ContinueRemoveHTML&number=$NextForum";
&ContinueThis($ForwardURL, $ActionWording);
} else {
&StandardHTMLCP("Thank you. We have finished processing this request.");
}
} #end RemoveHTML sr
sub CloseForums {
open(STATUS, ">$MembersPath/status.file");
print STATUS "closed";
close(STATUS);
chmod(0666, "$MembersPath/status.file");
}
sub OpenForums {
unlink("$MembersPath/memholder.cgi");
open(STATUS, ">$MembersPath/status.file");
print STATUS "open";
close(STATUS);
unlink("$MembersPath/status.file");
}
sub DoRebuildMembers {
$StartPoint = $in{'StartPoint'};
#$StartPoint =~/\D//sg;
#confirm identity
if ($action eq "ContinueMemberUpdate") {
&get_cookie; #retrieves all current cookies
if ($cookie{UserNameCP}) {
$CheckUserName = "$cookie{UserNameCP}";
$CheckPassword = "$cookie{PasswordCP}";
}
elsif ($in{'UserName'}) {
$CheckUserName = $in{'UserName'};
$CheckPassword = $in{'Password'};
} else {
$PageTitle = "R E B U I L D M E M B E R S";
$PageIntro = "In order to perform this function, you must first identify yourself. You will not have to do this each time if you allow cookies to be set from your browser.";
$HiddenFields = qq(
);
&QueryForID;
exit;
}
#confirm permission to read forum data
&VerifyAdminCP($CheckUserName, $CheckPassword);
}
if ($in{'Finalize'} eq "true") {
open (MEMFILE, "$MembersPath/memberslist2.cgi");
@memlist = We just finished processing members $StartPoint - $EndPoint. Please wait as we continue processing!);
$ForwardURL = "$CGIURL/cpanel4.cgi?action=ContinueMemberUpdate&StartPoint=$NextStart";
&ContinueThis($ForwardURL, $ActionWording);
exit;
} else {
$NextStart = $EndPoint + 1;
$ActionWording = qq(We are econciling your registered member database. Please wait as we continue procesing. We just finished processing members $StartPoint - $EndPoint. Please wait as we continue processing!);
$ForwardURL = "$CGIURL/cpanel4.cgi?action=ContinueMemberUpdate&StartPoint=$NextStart&Finalize=true";
&ContinueThis($ForwardURL, $ActionWording);
exit;
}
} #end dorebuildmems
sub GetMatches {
if ($in{'StartPoint'} eq "") {
&VerifyAdminCP($UserName, $Password);
} else {
&ConfirmAdminCookie;
$Proceed = "true";
}
if ($Proceed eq "true") {
if ($ViewEntire eq "Yes") {
&GetAll;
} else {
&DoSearch;
}
}
} #end GetMatches SR ###
sub DoSearch {
unless ( ($in{'Status'} eq 'COPPA') || ($in{'PrivateForum'} ne '') ){
$ProfileIndex = 8; # status
}else {
$ProfileIndex = 4; # perms
}
my @themembers = &OpenFile("$MembersPath/memberslist.cgi");
my @theemails = &OpenFile("$MembersPath/emailfile.cgi");
foreach $dos(@themembers) {
($thename, $thenum) = split(/\|\!\!\|/, $dos);
chomp($thenum);
$Line = ("$thenum" . "|||" . "$thename");
push(@sortmems, $Line);
}
foreach $dos2(@theemails) {
($theemail, $thenum) = split(/\|\|/, $dos2);
chomp($thenum);
$Line = ("$thenum" . "|||" . "$theemail");
push(@sortemails, $Line);
}
$TotalMembers = @sortmems;
$CheckEmail = "$in{'Email'}";
$Search = 0;
$arraycount = 0;
foreach $memberinfo(@sortmems) {
($junk, $member) = split(/\|\|\|/, $memberinfo);
chomp($member);
$CleanMember = quotemeta($member);
my @searchfile = @blank;
my $ProfileOpened = "";
my $bad = "no";
#start UserName check block
if ($SearchName ne "") {
$CleanName = quotemeta($SearchName);
unless ($member =~ /$CleanName/i) {
$bad = "yes";
}
}
#do email check
if (($CheckEmail ne "") && ($bad ne "yes")) {
$ThisEmailRow = $sortemails[$arraycount];
($junk, $thisemail) = split(/\|\|\|/, $ThisEmailRow);
chomp($thisemail);
unless ($thisemail =~ /$CheckEmail/i) {
$bad = "yes";
}
} #end if do check of email
# Check number of posts
if (($in{'Posts'} ne "") && ($bad ne "yes")) {
$ProfileNumber = &GetUserNumber($member);
@searchfile = &OpenProfile("$ProfileNumber.cgi");
$ProfileOpened = "true";
$PostNumber = $searchfile[7];
$Math = $in{'Math'};
if ($Math eq "GT") {
unless ($PostNumber >= $in{'Posts'}) {
$bad = "yes";
}
}
if ($Math eq "LT") {
unless ($PostNumber <= $in{'Posts'}) {
$bad = "yes";
}
}
if ($Math eq "EQ") {
unless ($PostNumber == $in{'Posts'}) {
$bad = "yes";
}
}
}
if (($in{'Status'} ne "") && ($bad ne "yes")) {
$ProfileNumber = &GetUserNumber($member) unless ($ProfileOpened eq "true");
@searchfile = &OpenProfile("$ProfileNumber.cgi")unless ($ProfileOpened eq "true");
$ProfileOpened = "true";
$StatusType = $searchfile[$ProfileIndex];
$StatusFind = $in{'Status'};
unless ($StatusType =~ m/$StatusFind/io){
$bad = "yes";
}
}
if (($in{'PrivateForum'} ne "") && ($bad ne "yes")) {
$ProfileNumber = &GetUserNumber($member) unless ($ProfileOpened eq "true");
@searchfile = &OpenProfile("$ProfileNumber.cgi")unless ($ProfileOpened eq "true");
$ProfileOpened = "true";
$PrivateList = $searchfile[4];
$PrivateFind = $in{'PrivateForum'};
unless ($PrivateList =~ m/\D$PrivateFind/){
$bad = "yes";
}
}
#start validation block
$arraycount++;
if ($bad ne "yes") {
$Search++;
if ($ProfileOpened ne "true") {
$ProfileNumber = &GetUserNumber($member);
@searchfile = &OpenProfile("$ProfileNumber.cgi");
}
$line = ("$searchfile[0]" . "|||" . "$searchfile[2]" . "|||" . "$searchfile[4]" . "|||" . "$searchfile[8]" . "|||" . "$searchfile[7]" . "|||" . "$searchfile[10]" . "|||" . "$ProfileNumber");
push (@thefinal, $line);
}
#close validation block
} #end FOREACH $member
if ($Search > 0) {
@final = sort(@thefinal);
$TotalProfiles = @final;
## ONLY DISPLAY 50 at a time--
my $MaxDisplay = 50; #maximum number to view per screen
if ($in{'StartPoint'} eq "") {
$StartPoint = 1;
if ($TotalProfiles <= $MaxDisplay) {
$EndPoint = $TotalProfiles;
$Done = "true";
} else {
$Done = "";
$EndPoint = $MaxDisplay;
}
$EP = $EndPoint - 1;
} else {
$StartPoint = $in{'StartPoint'};
$EndPoint = $StartPoint + $MaxDisplay;
$EndPoint = $EndPoint - 1;
if ($TotalProfiles <= $EndPoint) {
$EndPoint = $TotalProfiles;
$Done = "true";
} else {
$Done = "";
}
}
$SP = $StartPoint - 1;
$EP = $EndPoint - 1;
@final = @final[$SP..$EP];
if ($Done ne "true") {
$NextStart = $EndPoint + 1;
$NextWording = qq([Next Matches]);
} else {
$NextWording = "";
}
if ($TotalProfiles == 0) {
$StartPoint = 0;
}
&PermissionsTopHTML;
&UserInfoRows; # supply @final
print <
For security reasons, re-enter your UserName & Password:
UserName: Password
$infopopcopy
Ultimate Bulletin Board $Version