# # Setup Assistant Error

Setup Assistant Error

If you are seeing this error message, the Setup setup assistant is not being properly executed as a CGI script, but is rather being shown as an ordinary HTML file. You must consult your server administrator to have them turn on CGI permissions in this directory. //g; $FORM->{$qname} .= ",$qvalue" if $FORM->{$qname} ne ""; $FORM->{$qname} = $qvalue if $FORM->{$qname} eq ""; } } my $discus_conf = ""; foreach my $field ('admin_dir', 'html_dir', 'script_dir', 'html_url', 'script_url', 'language', 'title', 'cgi_extension') { $discus_conf .= "$field=$FORM->{$field}\n"; } $discus_conf .= "superuser=admin\n"; $discus_conf .= "pro=$FORM->{get_pro}\n"; $discus_conf .= "ext=html\n"; $discus_conf .= "pro_license=$FORM->{pro_license}\n" if $FORM->{pro_license}; $discus_conf .= "version=4.00\n"; $discus_conf .= "platform=NT\n" if $^O eq "MSWin32"; $discus_conf .= "contact={contact_email}\">$FORM->{contact_name}\n"; my $discus_conf_written = 0; if ($discus_conf_generate_dir ne "" && -e "$discus_conf_generate_dir/discus.conf" && -s "$discus_conf_generate_dir/discus.conf" == 0) { if (open (DISCUS_CONF, "> $discus_conf_generate_dir/discus.conf")) { print DISCUS_CONF $discus_conf; close (DISCUS_CONF); $discus_conf_written = 1; } } header(); print <Telnet/Console Setup Assistant

Discus Setup - Configuration is Complete

Congratulations! You have successfully configured your Discus installation for your server. Now, all that remains is one simple step of actually copying the files to the appropriate locations on your server. These instructions will guide you through this process.

End_Top if ($discus_conf_written) { print <1. Return to 1st_install.pl script

Your discus.conf file has been automatically copied to the directory where you ran the 1st_install.pl script. All you need to do is return to the 1st_install.pl script, and when asked whether to use the discus.conf file in the directory, answer yes. The setup of your Discus installation will then proceed automatically.

2. Access your board

End_Top } else { print <1. Obtain your discus.conf file

Your discus.conf file is contained in the following box. Click your mouse in the box, and select all of the text. Select Edit | Copy from the browser's menu.

2. Run 1st_install.pl again

Back in your telnet/console window, run the 1st_install.pl script again by typing perl 1st_install.pl, or in Windows, double-clicking on the 1st_install.pl script in the explorer list.

The script will ask you if you just recently generated a discus.conf file -- answer yes.

3. Paste in discus.conf

The 1st_install.pl script will tell you to paste in your discus.conf file. Using the paste function of your telnet client or console window, paste in the discus.conf file you copied from above. Generally there is a paste button to accomplish this feature.

4. Access your board

End_Top } print < Your board is now ready for use at:

The first thing you should do is to set up your administration password. To do this, click on the "Administration" link. Enter "admin" as your username and leave the password blank. You will be prompted to set up your password and to register Discus.

Thank you for choosing Discus for your discussion needs!

End_Top exit(0); } # # Check for compliance of Perl interpreter # if ($] < 5) { &header("Setup Setup Error"); print "Your Perl interpreter is not Perl 5 or better.\n"; &perl_sysreq(); } eval 'use strict;'; if ($@) { &header("Setup Setup Error"); print "Your Perl interpreter does not support 'use strict'.\n"; &perl_sysreq(); } my $rv = eval 'my $x = returns_one(); $x;'; if ($rv != 1 || $@) { &header("Setup Setup Error"); print "Your Perl interpreter does not properly handle subroutine definitions.\n"; &perl_sysreq(); } my $c = eval 'crypt("test", "na");'; if ($c ne "nagdheJ4NyCzY") { &header("Setup Setup Error"); print "Your Perl interpreter does not properly support the 'crypt' function.\n"; if ($^O eq "MSWin32") { print "Note: On Windows, you need ActivePerl!\n"; } &perl_sysreq(); } # # Figure out what this script is running as # header(); my $prog = $0; my $cgi_extension = ""; my $b4 = ""; if ($prog =~ m|dconfig\.(\w+)|i) { $prog = $&; $cgi_extension = $1; $b4 = $`; $b4 =~ s/\/$//; $b4 =~ s/\\$//; } else { print "Sorry...\n"; print "Setup Error\n\n"; if ($prog eq "") { print "

This version of Perl is malfunctioning, as it did not\n"; print "set the \$0 variable. Please contact your server\n"; print "administrator and inform them that this Perl installation\n"; print "is not functioning properly.

\n"; } else { print "

It appears that this script is not named "dconfig.***"\n"; print "as required by the setup. If necessary, rename this file. Currently\n"; print "this file is titled $prog

\n"; } print "\n"; exit(0); } # # Find your home directory # my ($script_uid, $hdsees, $elim, $sees, $sees_warn); if ($^O ne "MSWin32") { ($script_uid, $hdsees, $elim, $sees) = eval { my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat $0; my $hd = (getpwuid($uid))[7]; if ($hd =~ m|/\./|) { ( $uid, $hd, $`, "$'" ); } else { ( $uid, $hd, "", "" ); } }; if ($elim || $sees) { $sees_warn = "

    Directory Information: It appears that when you log in by Setup, you are restricted by your web host to a certain portion of your server. This is OK, but it will require you to mentally adjust directory paths when you complete the setup of this software.

    It appears that when you log in by Setup, the name of the directory you first see in your Setup program is /$sees. The actual, full path to this directory is $elim/$sees.

    It is very important in this setup that you leave the $elim part at the beginning of the directory paths, even though you don't see this when you log in by Setup. However, in the final setup instructions, you may be asked for example to create the directory $elim/$sees/discus. In your Setup program, it would appear that you are creating the directory /$sees/discus.

    For more information regarding this situation, please read our Knowledge Center document on Adjusting Directory Paths.

"; } } my $homedir = {}; if ($^O ne "MSWin32") { eval '$homedir->{home} = (getpwuid($<))[7];'; $homedir->{pwd} = `pwd`; chomp $homedir->{pwd}; } if (!eval 'use Cwd;') { eval '$homedir->{cwd} = cwd();'; } $homedir->{docroot} = $ENV{'DOCUMENT_ROOT'}; $homedir->{filename} = $ENV{'SCRIPT_FILENAME'}; $homedir->{filename} =~ s/\/$prog//; $homedir->{filename} =~ s/\\$prog//; $homedir->{path} = $ENV{'PATH_TRANSLATED'}; $homedir->{b4} = $b4; my $real = check($homedir, [ 'pwd', 'filename', 'path', 'cwd', 'b4', 'docroot' ], $prog); $real =~ s%\\%/%g; $real =~ s%//%/%g; if ($real eq "") { print "Sorry...\n"; print "
Setup Complication\n\n";
   print "The setup script could not determine the current working directory\n";
   print "of the server.  This is very rare (only 1-2% of servers).  The environment\n";
   print "variables and other potentially helpful values are being printed here for\n";
   print "your reference:\n\n";
   print "PWD         $homedir->{pwd}\n";
   print "Doc. Root   $homedir->{docroot}\n";
   print "File name   $homedir->{filename}\n";
   print "Path        $homedir->{path}\n";
   print "CWD         $homedir->{cwd}\n";
   print "'b4'        $homedir->{b4}\n";
   print "Here are the environment variables:\n\n";
   foreach my $key (sort keys(%ENV)) {
       print "$key = [$ENV{$key}]\n";
   }
   print "\n\n";
   print "
\n"; exit(0); } my @founddir = (); opendir(CURDIR, ".."); while (my $q = readdir(CURDIR)) { push (@founddir, $q); } closedir(CURDIR); @founddir = grep(!/\./, @founddir); my $discusware_url = "http://www.discusware.com/cgi-bin/discus/ftp/ftp-inst.cgi"; ### SETUP PARAMETERS ### my $version = '4_00'; my $get_discus_pro = 0; my $pro_license = ''; ### END SETUP PARAMETERS ### ### LANGUAGES ### my $language_list = ""; ### END LANGUAGES ### ### SUGGESTION PARAMETERS ### my $discus_dir_name = 'discus'; my $board_title = ''; my $contact_name = ''; my $contact_email = ''; ### END SUGGESTION PARAMETERS ### # # On some unix platforms, figure out altered directory paths # my $adjustment = ""; if ($^O ne "MSWin32") { my $s = ' my $u = (stat "$0")[4]; my $hd = (getpwuid($u))[7]; if ($hd =~ m|/\./|) { $`; } '; $adjustment = eval $s; } # # Guess your setup parameters # open (PROG, $prog); my @prog = ; close (PROG); my $perl = $prog[0]; $perl =~ s/^#!//; $perl =~ s/\s+$//; $perl = "/usr/bin/perl" if $perl eq ""; my $base = ""; my $cgi = ""; if ($real =~ m|(.*)/(.+)|) { $base = $1; $cgi = $2; } else { $base = $real; $cgi = "cgi-bin"; } my $admin_dir = "$base/$discus_dir_name" . "_admin_"; my $p = $$; $p =~ s/\D//g; $p .= substr(time, 0, -5); $admin_dir .= $p; my $html_prefix = 'public_html htdocs www htdoc html docs doc'; my $html_dir = $base; foreach my $i (split(/\s+/, $html_prefix)) { if (-e "$base/$i/index.html" || -e "$base/$i/default.htm" || -e "$base/$i/index.htm") { $html_dir .= "/$i"; last; } } $html_dir .= "/$discus_dir_name"; my $script_dir = "$real/$discus_dir_name"; my $sn = ""; my $script_url = ""; if ($ENV{'SCRIPT_URI'} ne "") { $sn = $ENV{'SCRIPT_URI'}; } elsif ($ENV{'SCRIPT_URL'} ne "") { $sn = $ENV{'SCRIPT_URL'}; } elsif ($ENV{'REQUEST_URI'}) { $sn = $ENV{'REQUEST_URI'}; } elsif ($ENV{'SCRIPT_NAME'} ne "") { $sn = $ENV{'SCRIPT_NAME'}; } if ($sn ne "") { if ($sn =~ m|^http://([^/]+)|) { $sn = $'; } if ($sn =~ m|/$prog|i) { $sn = $`; } if ($sn ne "") { $script_url = "http://$ENV{'HTTP_HOST'}$sn/$discus_dir_name"; } } else { $script_url = "http://$ENV{'HTTP_HOST'}/$cgi/$discus_dir_name"; } my $uinfo = ""; if ($script_url =~ m|^http://([^/]+)/~([^/]+)/|) { $uinfo = "~" . $2 . "/"; } my $html_url = "http://$ENV{'HTTP_HOST'}/$uinfo$discus_dir_name"; my $bdcgi = "$base/$cgi"; # # For NT users, convert / to \ to make it look more familiar # $admin_dir =~ s%/%\\%g if $admin_dir =~ m|^(\w+):|; $html_dir =~ s%/%\\%g if $html_dir =~ m|^(\w+):|; $script_dir =~ s%/%\\%g if $script_dir =~ m|^(\w+):|; $admin_dir =~ s%\\\\%\\%g; $html_dir =~ s%\\\\%\\%g; $script_dir =~ s%\\\\%\\%g; $bdcgi =~ s%/%\\%g if $admin_dir =~ m|^(\w+):|; $bdcgi =~ s%\\\\%\\%g; my $NTFLAG = ''; my $slash = "/"; if (-e 'c:/' || $^O eq "MSWin32") { $NTFLAG = ''; $slash = "\\"; } my $path_warning = ""; if ($cgi =~ m|/| || $sn =~ m|^.+/|) { $path_warning = "

Warning: It has been detected that you might have created a separate directory for this script (e.g., cgi-bin/discus). If you did this, THIS IS BAD and the suggestions will not be accurate. To ensure the most accurate suggestions, this script should be placed, if possible, into the server's main cgi directory.

"; $path_warning = "" if $cgi !~ m|discus| && $sn !~ m|discus|; } # # Discus Setup Form # print <<_END_; Welcome to Discus Setup

Discus Setup - Interactive Form

Congratulations! You have successfully uploaded the Setup setup assistant to your server, and it is now being properly executed by your web server. In addition, it appears that your web server meets our system requirements for basic installation and operation of Discus.

$path_warning

On this page, you will be able to enter the parameters for your Discus board after reviewing the instructions and suggestions that have been provided for you. Don't just accept our guesses without reviewing them (and changing them if necessary)!

When specifying directories, it is necessary to use the full directory path that your server "sees". This may or may not correspond to what you see when you log in with your Setup program (many web hosts seek to restrict you to only certain parts of the server to avoid interrupting their other customers). The suggestions are generally accurate or very close to being accurate. If you find yourself substantially changing the suggestions, you might be doing something wrong.

Your server reports seeing this script as:
    $bdcgi$slash$prog

$sees_warn

Path to Perl, CGI Extension, License Information

Setup has automatically selected the following parameters:

    Path to Perl: $perl
    CGI Extension: $cgi_extension
    Discus Version: Discus _END_ my $v = $version; $v =~ s/_/\./g; if ($get_discus_pro) { print "Pro $v
    License Number: $pro_license"; } else { print "Freeware $v"; } print <<_END_;

The path to Perl, Discus version, and Discus Pro license information (if any) were configured when you downloaded this file from DiscusWare's web server. The CGI extension is chosen to match the extension on this file. If any of these parameters is incorrect, you should download another copy of this script from DiscusWare.

$NTFLAG

Administration Directory

The administration directory stores configuration files and password files for your Discus board. This directory is never accessed by a web browser. For your security, this directory should be "hidden" from the web server (out of the server's web space) if possible. In other words, the administration directory should not be accessible at http://your.server.com/something.

If you must put this directory in a place where it's accessible via the web, we suggest a long string of numbers (or something else random) after the directory name to make it more difficult for an attacker to guess the directory name. Note that if you don't hide this directory from your web server and someone finds it and accesses it via the web, they can look at your password files and other privileged information! Finally, this setting must be a directory and not a URL -- it should not start with http://.

Our suggestions for this parameter are over 95% accurate!

Administration Directory:
    

HTML Directory and URL

The HTML files that come with Discus, such as the instructions and main menu, are placed in the HTML Directory. In addition, your message files (topics and messages), clipart, and icons are all stored in subdirectories of the HTML Directory. This should not go under your server's CGI directory (i.e., don't put it under your cgi-bin). The directory must be a directory and not a URL -- it should not start with http://!

Our suggestions for this parameter are generally quite accurate (unless you choose to rename "discus" to something else). The most common mistake in the suggestion is if the suggestion forgets to put in the directory immediately above "discus" -- sometimes named public_html, www, htdocs, docs, and so on. Or, sometimes the suggestion contains one of these directory names when it shouldn't.

HTML Directory:
    

You also need to give the URL that corresponds to the HTML Directory that you specified above. This must start with http://. If you changed "discus" to something else when setting up the HTML Directory, be sure to change it here too.

HTML URL:
    

Script Directory and URL

The script (CGI) files that come with Discus, such as the board administration script and the new message search script, go into the Script Directory. (These are the Perl scripts that actually power Discus by writing to the message files.)

The suggestion for this parameter is over 99% accurate. You may change the "discus" part at the end if you want to, but don't change anything else unless you really know what you're doing.

Script Directory:
    

You also need to give the URL that corresponds to the Script Directory that you specified above. This suggestion for this parameter has proven to be over 99% accurate. If you changed the "discus" part in the Script Directory, be sure to change it here as well. Don't change anything else unless you really know what you're doing.

Script URL:
    

Title and Contact Information

Here is where you specify the title of your discussion board. Choose any title you wish. Since it is fairly difficult to change this later, please be sure to double-check your spelling!

Board Title:
    

Enter the name and e-mail address of the person who is to be contacted if there is a problem with the board. When users receive error messages, they are told to contact this person. Generally you will enter your own name and e-mail address here. This is very easy to change later.

Board Contact Person:
    

Board Contact E-mail Address:
    

User Interface Options

Available translations of the Discus User Interface are indicated on the list below. Choose the desired language for your User Interface from this list.

User Interface Language:
    

Submit the Form

When you have filled in all of the blanks above, click the button to generate your individual customized Discus distribution. Please note that processing could take several seconds, so please click the button only one time, and be patient.

_END_ exit(0); sub check { my ($hr, $arr, $prog) = @_; foreach my $l (@{ $arr }) { my $dr = $hr->{$l}; next if $dr eq ""; $dr =~ s%\\%/%g; $dr =~ s%/$%%g; next if $dr eq ""; if (-e "$dr/$prog") { return $dr; } } my $c = determine_cwd(); return $c if $c ne ""; } sub determine_cwd { my $filename = $0; if ($filename =~ m|(.*)/(.*)|) { $filename = $2; } undef my @parent; my $ctr = 100; my $dots = ""; my $parent = ""; O: while ($ctr > 0) { $ctr -= 1; $dots .= "/" if $dots ne ""; $dots .= ".."; if (opendir(DIR, $dots)) { I: while (my $dir = readdir(DIR)) { next if $dir =~ m|^\.+$|; next if !-d "$dots/$dir"; if (scalar(@parent)) { $parent = "/" . join("/", reverse(@parent)); } else { $parent = ""; } if (-e "$dots/$dir$parent/$filename") { push (@parent, $dir); last I; } } closedir(DIR); } else { last O; } $parent = "/" . join("/", reverse(@parent)); if (-e "$parent/$filename") { last O; } } $parent = "/" . join("/", reverse(@parent)); if ($^O eq "MSWin32") { foreach my $dr ('c' .. 'z') { if (-e "$dr:$parent/$filename") { return "$dr:$parent"; } } } return $parent; } sub returns_one { return 1; } sub header { my ($x) = @_; $| = 1; print "Content-type: text/html\n\n"; return undef if $x eq ""; print "$x\n"; print "

$x


\n"; print "
\n";
	return undef;
}

sub perl_sysreq {
	print "\n";
	print "Discus will not run on this system, as your Perl interpreter\n";
	print "does not meet the system requirements.  You should upgrade your\n";
	print "Perl interpreter at CPAN (for unix) or at ";
	print "ActiveState (for\nWindows) to be able ";
	print "to run Discus and other CGI scripts like it.\n\n";
	print "Your Perl version is: $]\n";
	print "Your OS is reported as: $^O\n";
	print "The exact error was: $@\n" if ($@ ne "");
	print "\n";
	print "This is not a malfunction in Discus.  We regret that DiscusWare\n";
	print "Support cannot assist you with this problem.\n";
	print "
\n"; exit(0); } # -->