Gossamer Forum
Home : Products : Links 2.0 : Installation -- Unix :

Help Me Cebidae

Quote Reply
Help Me Cebidae
Hi all;
I am a new member in GossamerThreads site. I installed Links 2.0 script in my cgi-bin directory in a subdirectory called links, to use it in my site intra-sy.net.
I have several problems:
First, when I enter the admin area:
http://www.intra-sy.net/cgi-bin/links/admin/admin.cgi
I try any link under "building" section but I have an error message as follows:
Links Manager: Building Pages
Building Pages
Pages built on 11-Jul-2000 at 11:00:49
--------------------------------------------------------

Backing up database . . .
Backup exists for today.. Skipping
Done.

Building URL Index . . .
Done.

Updating New and Popular Records . . .
What's New Cutoff: 14 days
Popular Cutoff: 2 hits

CGI ERROR
==========================================
Error Message : Error building! Links database is 0 bytes!
Script Location : /www/cgi-bin/links/admin/nph-build.cgi
Perl Version : 5.00502

Form Variables
-------------------------------------------

Environment Variables
-------------------------------------------
DOCUMENT_ROOT : /usr/local/etc/httpd/htdocs
GATEWAY_INTERFACE : CGI/1.1
HTTP_ACCEPT : image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*
HTTP_ACCEPT_ENCODING: gzip, deflate
HTTP_ACCEPT_LANGUAGE: en-us
HTTP_FORWARDED : by http://lune:3128 (Netscape-Proxy/2.5)
HTTP_HOST : intra-sy.net
HTTP_REFERER : http://intra-sy.net/cgi-bin/links/admin/admin.cgi?display=navigation
HTTP_USER_AGENT : Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
PATH : /bin:/usr/bin
QUERY_STRING :
REMOTE_ADDR : 195.22.198.9
REMOTE_PORT : 55116
REQUEST_METHOD : GET
REQUEST_URI : /cgi-bin/links/admin/nph-build.cgi
SCRIPT_FILENAME : /www/cgi-bin/links/admin/nph-build.cgi
SCRIPT_NAME : /cgi-bin/links/admin/nph-build.cgi
SERVER_ADMIN : intrasyn@intra-sy.net
SERVER_NAME : intra-sy.net
SERVER_PORT : 80
SERVER_PROTOCOL : HTTP/1.0
SERVER_SIGNATURE : Apache/1.3.4 Server at intra-sy.net Port 80

SERVER_SOFTWARE : Apache/1.3.4 (Unix) PHP/3.0.15
-------------------------------------------------------
So can anybody know what's going on, what's the problem?
Secondly when I enter the following url:
http://www.intra-sy.net/cgi-bin/links/add.cgi
I see a page contains several links. When I click on "Home" link, it's supposed that move to intra home page, In fact I see a blank page. Also I don't know how to organize and use the "What's New" and "What's Cool" links.
Can Anybody enter the above mentioned urls and examine the result then tell me how to fix the problem.
Please note that I left the admin area unprotected to let you enter and try by yourself.
Thanks for your advice.


Quote Reply
Re: links 2.0 usage. In reply to
Have you added any links to your database, if not that is your problem. Add the links then do a build.
Later,
Paul

http://www.fullmoonshining.com for Pearl Jam Fans
Quote Reply
Re: links 2.0 usage. In reply to
I suggest that as a matter of urgency you protect your admin.cgi! Shocked Either use .htaccess or the ADMIN PASSWORD MOD. You can get this MOD here: http://www.cebidae.co.uk/download/gossamer.shtml if you cannot use .htaccess.

Martin Webster
--
Cebidae's UK Internet Resource
http://www.cebidae.co.uk/
Quote Reply
Re: links 2.0 usage. In reply to
Hi;
Thanks Cebidae and cranepaul. I added some links but I encountered some problems:
When somebody enters the following url:
http://intra-sy.net/cgi-bin/links/add.cgi
to add his link and click on the "Home" link he moves directly to the following url:
http://intra-sy.net/intra-synet/links_pages/
but without seeing the existing categories, he sees no categories found, then after he clicks on the "Home" link in the home page of the categories he moves to the following url:
http://intra-sy.net/intra-synet/links_pages/<%build_root_url%> and has the following error message:
"The page cannot be found"
Can anybody help to fix this problem. Can the changes made by editing the templete and this can be achieved.
I didn't protect the admin area because the script still in the experimental period.
Jamal


Quote Reply
Re: links 2.0 usage. In reply to
Have you made any changes to the home.html page. You might compare the menu with the other templates and see if it is the same, because your other pages seem to be building just fine. As far as the category listing go make sure you have the <%category%> tag on on your home.html template.

Here's what the menu should look like:

<p><small class="menu">|
<a class="menulink" href="<%build_root_url%>">Home</a> |
<a class="menulink" href="<%db_cgi_url%>/add.cgi">Add a Site</a> |
<a class="menulink" href="<%db_cgi_url%>/modify.cgi">Modify a Site</a> |
<a class="menulink" href="<%build_root_url%>/New">What's New</a> |
<a class="menulink" href="<%build_root_url%>/Cool">What's Cool</a> |
<a class="menulink" href="<%build_root_url%>/Ratings">Top Rated</a> |
<a class="menulink" href="<%db_cgi_url%>/jump.cgi?ID=random">Random Link</a> |
<a class="menulink" href="<%db_cgi_url%>/search.cgi">Search</a> |
</small></p>


And here is what the category should look:


<p>Welcome to the Links online demo. Feel free to add your own link, modify another's or just play around!</p>

<h2>Categories:</h2>

<%category%>

<p class="grandtotal">There are <strong><%grand_total%></strong> links for you to choose from!</p>

Hope that helps somewhat,
Paul

http://www.fullmoonshining.com for Pearl Jam Fans
Quote Reply
I really having a headache. In reply to
Thanks guys for your patience with me, but I still have the same problems. I think the major problem resides in the cgi file.
In fact, I'm a beginner in that field and ask all of you kindly to help me resolve all these problems.
Firstly, how can I build a menu, and why I always have a cgi error when I click on the "build all" from the admin area. Follows is the mentioned error:
Building Home Pages . . .
Subcategories: 1
Total Links: 1
Opening page: usr/local/etc/httpd/htdocs/intra-synet/links_pages/index.html

CGI ERROR
==========================================
Error Message : unable to open home page: usr/local/etc/httpd/htdocs/intra-synet/links_pages/index.html. Reason: No such file or directory
Script Location : /www/cgi-bin/links/admin/nph-build.cgi
Perl Version : 5.00502

Form Variables
-------------------------------------------

Environment Variables
-------------------------------------------
DOCUMENT_ROOT : /usr/local/etc/httpd/htdocs
GATEWAY_INTERFACE : CGI/1.1
HTTP_ACCEPT : image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*
HTTP_ACCEPT_ENCODING: gzip, deflate
HTTP_ACCEPT_LANGUAGE: en-us
HTTP_FORWARDED : by http://lune:3128 (Netscape-Proxy/2.5)
HTTP_HOST : intra-sy.net
HTTP_REFERER : http://intra-sy.net/cgi-bin/links/admin/admin.cgi?display=navigation
HTTP_USER_AGENT : Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
PATH : /bin:/usr/bin
QUERY_STRING :
REMOTE_ADDR : 195.22.198.9
REMOTE_PORT : 53977
REQUEST_METHOD : GET
REQUEST_URI : /cgi-bin/links/admin/nph-build.cgi
SCRIPT_FILENAME : /www/cgi-bin/links/admin/nph-build.cgi
SCRIPT_NAME : /cgi-bin/links/admin/nph-build.cgi
SERVER_ADMIN : intrasyn@intra-sy.net
SERVER_NAME : intra-sy.net
SERVER_PORT : 80
SERVER_PROTOCOL : HTTP/1.0
SERVER_SIGNATURE : Apache/1.3.4 Server at intra-sy.net Port 80

SERVER_SOFTWARE : Apache/1.3.4 (Unix) PHP/3.0.15

Also, it seems that the cgi doesn't recognize the index.html file which I founded manually in the directory "links_pages" which has the path:
usr/local/etc/httpd/htdocs/intra-synet/links_pages/index.html
Now, of course, I removed the a. m. index.html file because it can't be read. How can I estabish a correct index file? And how can I establish the other html files in the links_pages? Must I use the existing files in the template or I have to make them by myself?
I enclosed a copy of the admin.cgi & links.cfg files, I appreciate if anybody can takes a look at them and finds if there is a mistake. Thanks in advance.
The admin.cgi and links.cfg files text is:
#!/usr/bin/perl
# -------------
# Links
# -------------
# Links Manager
#
# File: admin.cgi
# Description: This is the administrative interface for the links program.
# Author: Alex Krohn
# Email: alex@gossamer-threads.com
# Web: http://www.gossamer-threads.com/
# Version: 2.01
#
# (c) 1998 Gossamer Threads Inc.
#
# This script is not freeware! Please read the README for full details
# on registration and terms of use.
# =====================================================================
#
# Required Librariers
# --------------------------------------------------------
eval {
($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX /
($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \

require 5.001; # Make sure we have at least perl 5.001.
require "links.cfg"; # Change this to full path to links.cfg if you have problems.
require "$db_lib_path/db.pl"; # Database Routines.
require "$db_lib_path/db_utils.pl"; # Database Support utilities.
require "$db_lib_path/admin_html.pl"; # Admin HTML routines.
};

if ($@) {
print "Content-type: text/plain\n\n";
print "Error including libraries: $@\n";
print "Make sure they exist, permissions are set properly, and paths are set correctly.";
exit;
}

# ========================================================
eval { &main; }; # Trap any fatal errors so the program hopefully
if ($@) { &cgierr("fatal error: $@"); } # never produces that nasty 500 server error page.
exit; # There are only two exit calls in the script, here and in in &cgierr.
# ========================================================

sub main {
# --------------------------------------------------------
$| = 1; # Flush Output Right Away

# Main Menu. Check to see what the user requested, then if he has permission for that
# request, do it. Otherwise send the user off to an unauthorized request page.
%in = &parse_form; # Get form input so we know which database to load.

# Load the database definition file and set the link url.
$in{'db'} ?
require "$db_lib_path/$in{'db'}.def" :
require "$db_lib_path/links.def";

$db_script_link_url = "$db_script_url?db=$in{'db'}";

# The functions beginning with &html_ can be found in admin_html.pl, while the other
# functions can be found in db.pl

if ($in{'add_form'}) { &html_add_form; } # Display the Add Record Form.
elsif ($in{'add_record'}) { &add_record; } # Add the Actual Record.
elsif ($in{'add_record_mult'}) { &add_record_mult; } # Add Multiple Records at once (beta).
elsif ($in{'view_search'}) { &html_view_search; } # Display form to search database.
elsif ($in{'view_records'}) { &view_records; } # Search database and print results.
elsif ($in{'delete_search'}) { &html_delete_search; } # Display the form to search for records to delete.
elsif ($in{'delete_form'}) { &html_delete_form; } # Display the form to pick records to delete.
elsif ($in{'delete_records'}) { &delete_records; } # Delete records.
elsif ($in{'modify_search'}) { &html_modify_search; } # Display the form to search for records to modify.
elsif ($in{'modify_mult_form'}) { &html_modify_mult_form; } # Display multiple records to modify at one time.
elsif ($in{'modify_form'}) { &html_modify_form; } # Display the form to pick record to modify.
elsif ($in{'modify_form_record'}) { &html_modify_form_record; } # Display the form to modify a record.
elsif ($in{'modify_record'}) { &modify_record; } # Modify the record.
elsif ($in{'modify_mult_record'}) { &modify_mult_record; } # Modify multiple records at once.
elsif ($in{'validate_form'}) { &html_validate_form; } # Display the Validation Form.
elsif ($in{'validate_records'}) { &validate_records; } # Validate records.
elsif ($in{'check_links'}) { &check_links; } # Display/Check to make sure links have matching catgories.
elsif ($in{'fix_links'}) { &fix_links; } # Fixes up any errors found in check links.
elsif ($in{'check_duplicates'}) { &check_duplicates; } # Display/Check for duplicate links.
elsif ($in{'html_mail_target'}) { &html_mail_target; } # Form to do targeted mass mailing.
elsif ($in{'html_mail_form'}) { &html_mail_form; } # Form to do mass mailing.
elsif ($in{'html_mail_update'}) { &html_mail_update; } # Form to do email updates.
elsif ($in{'html_edit_template'}) { &html_edit_template; } # Edit Templates
elsif ($in{'save_template'}) { &save_template; } # Save templates.
elsif ($in{'html_template_help'}) { &html_template_help; } # Template Help.
elsif ($in{'display'} eq 'navigation') { &html_navigation; } # Display HTML Header
elsif ($in{'display'} eq 'body') { &html_body; } # Display HTML Body
elsif ($in{'display'} eq 'top') { &html_top; } # Display HTML Top
else { &html_home; } # Display Frame Index page.

# &cgierr("Done"); # Uncomment this line for Debugging... Will tack on form variables and environment variables
# to the end of every page. Quite Useful.
}






The links.cfg file text is:
# -------------
# Links
# -------------
# Links Manager
#
# File: links.cfg
# Description: Contains all the setup variables.
# Author: Alex Krohn
# Email: alex@gossamer-threads.com
# Web: http://www.gossamer-threads.com/
# Version: 2.01
#
# (c) 1998 Gossamer Threads Inc.
#
# This script is not freeware! Please read the README for full details
# on registration and terms of use.
# =====================================================================

# Paths and URL's to Important Stuff
# --------------------------------------------------------
# PATH and URL of Admin CGI directory. No Trailing Slash.
$db_script_path = "/usr/local/etc/httpd/cgi-bin/links/admin";
$db_dir_url = "http://intra-sy.net/cgi-bin/links/admin";

# URL of User CGI directory. No Trailing Slash.
$db_cgi_url = "http://intra-sy.net/cgi-bin/links";

# PATH and URL of Pages to be built. No Trailing Slash.
$build_root_path = "usr/local/etc/httpd/htdocs/intra-synet/links_pages";
$build_root_url = "http://intra-sy.net/intra-synet/links_pages";

# PATH and URL of What's New page. No Trailing slash.
$build_new_path = "$build_root_path/New";
$build_new_url = "$build_root_url/New";

# PATH and URL of What's Cool page. No Trailing slash.
$build_cool_path = "$build_root_path/Cool";
$build_cool_url = "$build_root_url/Cool";

# PATH and URL of What's Rating page. No Trailing slash.
$build_ratings_path = "$build_root_path/Ratings";
$build_ratings_url = "$build_root_url/Ratings";



# Database Options
# --------------------------------------------------------
# You really need to use flock(). However if your system doesn't support it (Win95),
# then turn this off at your own risk!
$db_use_flock = 1;
# Use Pragma: no-cache to stop browsers from caching output? (0 = cache, 1 = nocache)
$db_nocache = 0;
# Use IIS headers? Set this to 1 if your web server needs the full headers (HTTP/1.0 etc.)
$db_iis = 0;
# Field number of category in category.db
$db_main_category = 1;
# Referers -- which hosts are allowed to add to your database.
@db_referers = ();

# Email Options
# --------------------------------------------------------
# NOTE: Be sure to edit the text of the message. It can be found
# in the templates directory: email-add.txt, email-del.txt and
# email-mod.txt respectively.

# Set only ONE of either $db_mail_path which should go to a
# mail program like sendmail, or $db_smtp_server which will use
# a SMTP server. Do not set both at once!

# PATH of sendmail. # SMTP Server
$db_mail_path = '/bin/sendmail'; $db_smtp_server = '';

# Email address of the administrator. BE SURE TO SET!
$db_admin_email = 'admin@intra-sy.net';

# Notify visitors automatically when their links are validated?
$db_email_add = 1;

# Notify visitors automatically when their links are modified?
$db_email_modify = 1;

# Log all outgoing messages? Put the full path to a logfile and make sure it
# exists and is writeable (chmod 666 -rw-rw-rw-). This logfile can get pretty
# big!
$db_mailer_log = '';

# Build Options
# --------------------------------------------------------
# Setting for popular cutoff, can either be a percent (i.e. top 3%), or
# a fixed value (i.e. top 10). Enter 0.03 or 10 respectively.
$db_popular_cutoff = 0.03; # Top 3%
# Number of days a link is considered New.
$db_new_cutoff = 14; # 14 days old.
# Return search results bolded (1 = yes, 0 = no).
$search_bold = 1;
# The name of an index file.
$build_index = "index.html";
# The extension to use for non index files:
$build_extension = ".html";

# Should your add.cgi automatically select what category the user
# is adding his link into?
$db_single_category = 1;

# Directory Permissions. Do NOT put quotes around it. Set to 0777
# for world writeable. If you put this at 0755, you might need a
# script to remove any directories created as they will be owned
# by the web server or user nobody. Better solution might be to
# run the nph-build routine from the command shell.
$build_dir_per = 0777;

# The script can now break up category pages that have more then x
# number of links in it. It will also create next and previous links
# to help navigate. Set this to 1 if you want to break up pages or 0 if
# you want to have only one page per category.
# Setting this to one, will also break up the What's New pages into
# per day sections (not affected by number of links per page).
$build_span_pages = 1;

# Number of links per page.
$build_links_per_page = 25;

# Detailed View: The script can build a single html page per link. This is
# great if you have a review in your database. To enable, you must set
# the directory where all the pages will be stored, the url to that directory
# and set the enable option.
$build_detailed = 0;
$build_detail_path = "$build_root_path/Detailed";
$build_detail_url = "$build_root_url/Detailed";

# Use Templates: instead of editing site_html.pl, you can edit regular html pages
# encoded with special <%links_tags%>. It's not as flexible as site_html.pl, but it
# may be easier.
$build_use_templates = 1;

# Site Title, the default title to use. You should really spend some time customizing
# the directory though!
$build_site_title = 'intra-sy.net';

# Date Routines
# --------------------------------------------------------
# Your date format can be whatever you like, as long as the following
# two functions are defined &date_to_unix and &unix_to_date:
# The default is dd-mmm-yyyy.

sub date_to_unix {
# --------------------------------------------------------
# This routine must take your date format and return the time a la UNIX time().
# Some things to be careful about..
# timelocal does not like to be in array context, don't do my($time) = timelocal (..)
# int your values just in case to remove spaces, etc.
# catch the fatal error timelocal will generate if you have a bad date..
# don't forget that the month is indexed from 0!
#
my $date = shift; my $i;
my %months = map { $_ => $i++ } qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;
my ($day, $mon, $year) = split(/-/, $date);

exists $months{$mon} or return undef;
$day = int($day); $year = $year - 1900;

require Time::Local;
my $time = 0;
eval {
$time = &Time::Local::timelocal(0,0,0, $day, $months{$mon}, $year);
};
if ($@) { die "invalid date format: $date - parsed as (day: $day, month: $months{$mon}, year: $year). Reason: $@"; }
return $time;
}

sub unix_to_date {
# --------------------------------------------------------
# This routine must take a unix time and return your date format
# A much simpler routine, just make sure your format isn't so complex that
# you can't get it back into unix time.
#
my $time = shift;
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $tz) = localtime $time;
my @months = qw!Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec!;
$year = $year + 1900;
return "$day-$months[$mon]-$year";
}

sub long_date {
# --------------------------------------------------------
# This routine is for printing a nicer date format on the what's new page. It should
# take in a date in your current format and return a new one.
my $time = shift;
$time = &date_to_unix ($time);
my ($sec, $min, $hour, $day, $mon, $year, $dweek, $dyear, $tz) = localtime $time;
my @months = qw!January February March April May June July August September October November December!;
my @days = qw!Sunday Monday Tuesday Wednesday Thursday Friday Saturday!;
$year = $year + 1900;
return "$days[$dweek], $months[$mon] $day $year";
}

# -------------------------------------------------------------
# Extra Paths -- unless you feel the need to rename files, you
# can leave this as is.
# -------------------------------------------------------------
$db_script_url = $db_dir_url . "/admin.cgi"; # Admin script.
$db_header_path = $db_script_path . "/header"; # Place to store header and footers.
$db_footer_path = $db_script_path . "/footer";
$build_search_url = $db_cgi_url . "/search.cgi"; # URL of search script.
$build_add_url = $db_cgi_url . "/add.cgi"; # URL of add script.
$build_modify_url = $db_cgi_url . "/modify.cgi"; # URL of modify script.
$build_jump_url = $db_cgi_url . "/jump.cgi"; # URL of jump script.
$build_email_url = $db_cgi_url . "/subscribe.cgi"; # URL of email update script.
$build_rate_url = $db_cgi_url . "/rate.cgi"; # URL of rate script.
$db_mail_url = $db_dir_url . "/nph-email.cgi"; # URL of admin mass mail script.
$build_css_url = $build_root_url . "/links.css"; # URL to your CSS file.

$db_lib_path = $db_script_path; # PATH of library files.
$db_links_name = "$db_script_path/data/links.db"; # PATH to links database.
$db_category_name = "$db_script_path/data/categories.db"; # PATH to category database.
$db_valid_name = "$db_script_path/data/validate.db"; # PATH to validation database.
$db_modified_name = "$db_script_path/data/modified.db"; # PATH to modification database.
$db_url_name = "$db_script_path/data/url.db"; # PATH to URL lookup database.
$db_email_name = "$db_script_path/data/email.db"; # PATH to email database.
$db_links_id_file_name = "$db_script_path/data/linksid.txt"; # PATH to links counter file.
$db_category_id_file_name = "$db_script_path/data/categoryid.txt"; # PATH to category counter file.
$db_hits_path = "$db_script_path/data/hits"; # PATH to hits directory.
$db_template_path = "$db_script_path/templates"; # PATH to templates.
$db_rates_path = "$db_script_path/data/rates"; # PATH to ratings.
1;

j.joubarani
Quote Reply
Re: I really having a headache. In reply to
In the future, please post links your files in .txt format in a user-accesible directory at your site instead of placing the entire thing in the forum.

--Drew
Quote Reply
Re: I really having a headache. In reply to
Ok I may follow your advice next time, but why?
Did this form of posting bother you?

j.joubarani
Quote Reply
Re: I really having a headache. In reply to
Try changing this line $db_dir_url = "http://intra-sy.net/cgi-bin/links/admin"; to $db_dir_url = "http://www.intra-sy.net/cgi-bin/links/admin"; Do the same for the $db_cgi_url. Maybe that'll work.
Later,
Paul


http://www.fullmoonshining.com for Pearl Jam Fans
Quote Reply
Re: I really having a headache. In reply to
'Cause:
-it makes threads hard to follow
-it's a waste of GT's resources
-and it's a BIG waste if you have to post the same thing more than once (even if there are minor differences)

--Drew
Quote Reply
Re: I really having a headache. In reply to
I changed the lines but I gut nothing!

I am sorry to my poor English language.

Thank you

j.joubarani

j.joubarani
Quote Reply
Re: I really having a headache. In reply to
I've just had a look at your admin.cgi (still not protected!) and note the following:

Document root: /usr/local/etc/httpd/htdocs
Site URL: http://www.intra-sy.net/
Place were script is trying to build your home page: usr/local/etc/httpd/htdocs/intra-synet/pages/index.html

It looks like you've mixed up the absolute paths and URLS in links.cfg. Use this script to find out about your environment:

#!/usr/bin/perl (change this to your path to Perl!)

print "Content-type: text/html\n\n";
print "<tt>\n";
foreach $key (sort keys(%ENV)) {
print "$key = $ENV{$key}<P>";
}

Let's get the basic facts first. Then we can work through the paths one-by-one. Cool

Martin Webster
--
Cebidae's UK Internet Resource
http://www.cebidae.co.uk/