Integrating DCForum and DCIndex
By David S. Choi
DCScripts.com
Introduction
In this tutorial we describe how you can integrate DCForum and
DCIndex so that they share common user database. This tutorial is
intended for users who already have DCForum installed and up and
running on their websites. If you don't already have DCForum running
on your site, please first install it and then use this tutorial.
Setting up directories
The default setting for DCForum is as follows:
/cgi-bin
|---dcforum
|---Lib
|---User_info (777)
/htdocs
|---dcforum (777)
|---Images
|---forum directories (777)
Please note that "/htdocs" is meant to show your root
HTML directory, which is accessible by the URL "http://www.yourdomain.com".
You may or may not actually have a directory named "/htdocs".
In order for DCIndex to use same user database, we need to install
DCD cgi programs in the /cgi-bin/dcforum directory. The DCD HTML
directory, however, should be at the same level as the /dcforum
directory. Hence, create new directories as shown below:
/cgi-bin
|---dcforum
|---Lib
|---User_info (777)
|---DCDLib
/htdocs
|---dcforum (777)
|---Images
|---forum directories (777)
|---dcd (777)
|---Images
Follow the DCIndex installation procedure as described in readme.txt
and install_unix.txt (install_nt.txt if your web server is NT or
Win2000 based). In step 3 of install_unix.txt (Edit setup parameters
in dcsetup.pm), you must also make the following changes:
$setup{'datadir'} - This variable now should be "$setup{'cgidir'}/User_info"
$setup{'cgilib'} - This variable now should be "$setup{'cgidir'}/DCDLib"
$setup{'cookie_name'} - Take a look at dcforum.setup. Look for $cookie_name.
$setup{'cookie_name'} name should be same as $cookie_name.
By default, the user authentication fields for DCF includes Firstname,
Lastname, and EMail. If your current DCF setup uses additional fields,
you must modify $setup{'login_fields'} and $setup{'field_form_type'}
in dcsetup.pm. Otherwise, no need to edit it.
Make sure $setup{'password_file'} in dcsetup.pm and $password_file
in dcforum.setup is same.
Continue the installation process as outlined in install_unix.txt
until you are finished.
Modify DCForum Login Process
DCIndex program uses static HTML files for category index pages.
One of the administrative features we wanted to add was the ability
to remove or edit links directly from these static pages. At the
same time, we wanted these links to appear only if you are logged
on as administrator. DCD uses cookie named "DCDUserStatus" and javascript
to accomplish this. You must add similar code to DCForum in order
for this to work when you login thru DCForum. To add this feature:
1. Edit auth_login.pl (in /cgi-bin/dcforum/Lib). Look for:
if ($r_in->{'remember'}) {
$session = '%%' . $session;
send_cookie($cookie_name,$session,
$expires,$domain);
}
else {
send_cookie($cookie_name,$session,
'',$domain);
}
After this line add,
if ($r_local->{'login_info'}->{'Group'} eq 'admin') {
#If user is admin, then set admin cookie
send_cookie('DCDUserStatus',$r_local->{'login_info'}->{'Group'},'','');
}
2. Edit login.pl (in /cgi-bin/dcforum/lib). Look for:
if ($session and -e "$sessiondir/$session.session") {
send_cookie($cookie_name,'','Thur, 31-Dec-98 12:00:00 GMT','/');
unlink("$sessiondir/$session.session");
$session = '';
}
After this line add,
$session = get_cookie('DCDUserStatus');
if ($session) {
# delete session cookie
send_cookie('DCDUserStatus','','Thur, 31-Dec-98 12:00:00 GMT','/');
$session = '';
}
Upload these files to your /cgi-bin/dcforum/Lib directory.
Test your result
To see if indeed everything is working ok, login as admin from
DCForum and then from DCIndex. In either case, you should have full
admin access to both programs. You may also want to log in as non-admin
"just to make sure" that normal users do not have admin access.
If you have any questions or problems, please use our support
forum.
|