Gossamer Forum
Home : Products : Links 2.0 : Customization :

Need someone to Fix an Illegal division by zero

Quote Reply
Need someone to Fix an Illegal division by zero
I am getting the below error when my script tries to build the HTML pages. I am unsure why and have not made recent changes for this to stop working. I have tried everything I can think of and looked in the Forum but no luck. I want to get this working, so anyone experienced in Links and CGI, this is probably a 5 minute fix, but I'm happy to pay for you to fix it. please contact me at matt@revenuemakers.com if you can help. I'd like to fix this asap.
The error msg is :
Error Message : fatal error: Illegal division by zero at /home/sites/site84/web/cgi-bin/links/admin/nph-build.cgi line 447, chunk 461.

Script Location : /home/sites/site84/web/cgi-bin/links/admin/nph-build.cgi
Perl Version : 5.00404

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

Environment Variables
-------------------------------------------
AUTH_TYPE : Basic
DOCUMENT_ROOT : /home/sites/site84/web
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, application/x-comet, */*
HTTP_ACCEPT_ENCODING: gzip, deflate
HTTP_ACCEPT_LANGUAGE: en-us
HTTP_CONNECTION : Keep-Alive
HTTP_HOST : www.revenuemakers.com
HTTP_REFERER : http://www.revenuemakers.com/cgi-bin/links/admin/admin.cgi?display=navigation
HTTP_USER_AGENT : Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
PATH : /sbin:/usr/sbin:/bin:/usr/bin
QUERY_STRING :
REMOTE_ADDR : 193.114.209.135
REMOTE_PORT : 1484
REMOTE_USER : matthawk
REQUEST_METHOD : GET
REQUEST_URI : /cgi-bin/links/admin/nph-build.cgi
SCRIPT_FILENAME : /home/sites/site84/web/cgi-bin/links/admin/nph-build.cgi
SCRIPT_NAME : /cgi-bin/links/admin/nph-build.cgi
SCRIPT_URI : http://www.revenuemakers.com/cgi-bin/links/admin/nph-build.cgi
SCRIPT_URL : /cgi-bin/links/admin/nph-build.cgi
SERVER_ADMIN : site84
SERVER_NAME : www.revenuemakers.com
SERVER_PORT : 80
SERVER_PROTOCOL : HTTP/1.1
SERVER_SIGNATURE :
SERVER_SOFTWARE : Apache/1.3.3 Cobalt (Unix) (Red Hat/Linux) PHP/3.0.7
UNIQUE_ID : OlMB9kDzkhEAAC3WUo4


Quote Reply
Re: Need someone to Fix an Illegal division by zero In reply to
I am assuming you are trying some MOD. If yes, please mention what MOD are you using so that other links users can suggest you help.


Error Message : fatal error: Illegal division by zero at /home/sites/site84/web/cgi-bin/links/admin/nph-build.cgi line 447, chunk 461.


Copy and paste the code from your nph-build.cgi from line 447.



Regards,

Pagla



Quote Reply
Re: Need someone to Fix an Illegal division by zero In reply to
Thanks Pagla,

We have quiet a few MODs. Which have never caused problems before.

The line 447 is after :

# This adds one to the total of each category above the current category.
# We have to caluclate the affect of the link on each alt category as well as the main.
foreach $cat ($category, @alt_categories) {


The lines around this are :


# Add the link to the list of new links if it is new.
push (@{$new_links{$category}}, @values) if ($values[$db_isnew] eq "Yes");

# Add the link to the list of cool links if it is popular.
push (@{$cool_links{$category}}, @values) if ($values[$db_ispop] eq "Yes");

# This adds one to the total of each category above the current category.
# We have to caluclate the affect of the link on each alt category as well as the main.
foreach $cat ($category, @alt_categories) {

# Calculate the stats: the number of links and the newest link.
@categorylist = split (/\//, $cat);
$depth = $#categorylist;

# This adds one to the total of each category above the current category,
# and also marks any above categories new, if this link is new.
for $i (0 .. $depth) {
$stats{$cat}[0]++;
if ((!$stats{$cat}[1]) || &compare_dates($values[$db_modified], $stats{$cat}[1])) {
$stats{$cat}[1] = $values[$db_modified];
}
pop (@categorylist);
$cat = join("/", @categorylist);
}
}
}
close DB;


I think this was from the category MOD, so we can have sub categories. Any ideas. Any help is really appreciated.
Regards,

Matt


Quote Reply
Re: Need someone to Fix an Illegal division by zero In reply to
Sorry I put the wrong code on, it is actually the unique category line that is the problem below. Any ideas, or offers to fix this for a fee are welcome.

Regards,
Matt

# This adds one to the total of each category above the current category.
# We have to caluclate the affect of the link on each alt category as well as the main.
%unique_categories = "";
foreach $cat ($category, @alt_categories) {


Quote Reply
Re: Need someone to Fix an Illegal division by zero In reply to
You need to add values in the %unique_categories hash...look at the MOD instructions again.

Regards,

Eliot Lee