Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
Tizwit
Involved
Involved



Joined: Aug 29, 2004
Posts: 324
Location: New Mexico

PostPosted: Thu Apr 28, 2005 9:31 am Reply with quote

Hmm.. After no one responsed on the last one I am going to try it again.

I am trying to get the Advanced Downloads block to work. It works fine on my main site of [ Only registered users can see links on this board! Get registered or login! ] but when I placed it on my other site [ Only registered users can see links on this board! Get registered or login! ] it fails to work. I think it has something to do with the fact that my site is a add on site.

Can anyone please tell me what to change..

Here is the script:

Quote:
<?php

/************************************************************************/
/* Advanced Downloads Block */
/* =========================== */
/* */
/* This is basically just an edit of the original block by Francisco. */
/* Even though this is heavly edited, I think he deserves credit, so: */
/* */
/* Copyright (c) 2002 by Francisco Burzi */
/* [ Only registered users can see links on this board! Get registered or login! ] */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
/* */
/* Copyright © 2002 by Michael Bacoz */
/* [ Only registered users can see links on this board! Get registered or login! ] */
/* */
/************************************************************************/

// Make sure people don't try and access it directly
if (eregi("block-Advanced_Downloads.php",$PHP_SELF)) {
Header("Location: index.php");
die();
}
/************************/
/* Variables */
/************************/
$downloadstoshow = 40;
$usemarquee = 1;
$scrolldirection = "up";

$most = "Most Downloaded";
$latest = "Latest Downloads";
$totalfiles = "Total Files";
$totalcategories = "Total Categories";
$totaldownloads = "Total Downloads";
$hitstext = "Hits";
$totalserved = "Total Served";

/************************/
/* End Variables */
/************************/

global $prefix, $dbi, $db;

// Total Files
$result = sql_query("select * from ".$prefix."_downloads_downloads", $dbi);
$files = sql_num_rows($result, $dbi);

// Total Categories
$result = sql_query("select * from ".$prefix."_downloads_categories", $dbi);
$cats = sql_num_rows($result, $dbi);

// Total Downloads
$result = sql_query("select hits from ".$prefix."_downloads_downloads", $dbi);

$a = 1;
while(list($hits) = sql_fetch_row($result, $dbi)) {
$total_hits = $total_hits + $hits;
$a++;
}

$result=sql_query("select lid, hits from $prefix"._downloads_downloads." order by lid", $dbi);

$dresult=0;

while(list($lid, $hits) = sql_fetch_row($result, $dbi)) {
$dresult = $dresult + $hits;
}

$result = sql_query("select * from $prefix"._downloads_downloads."", $dbi);
$numrows = sql_num_rows($result, $dbi);
$result = sql_query("select sum(filesize*hits) as serv from $prefix"._downloads_downloads."", $dbi);

while(list($serv) = sql_fetch_row($result, $dbi)) {
$served = $serv;
}

$tb = 1024*1024*1024*1024;
$gb = 1024*1024*1024;
$mb = 1024*1024;
$kb = 1024;

if ($served >= $tb){
$mysizes = sprintf ("%01.2f",$served/$tb) . " TB ";
} elseif ($served >= $gb) {
$mysizes = sprintf ("%01.2f",$served/$mb) . " GB ";
} elseif ($served >= $mb) {
$mysizes = sprintf ("%01.2f",$served/$mb) . " MB ";
} elseif ($served >= $kb) {
$mysizes = sprintf ("%01.2f",$served/$kb) . " KB ";
} else{
$mysizes = $served . " B ";
}

$content .= "$totalfiles: $files<br>$totalcategories: $cats<br> $totaldownloads: $total_hits<br> $totalserved: $mysizes<br>";

if ($usemarquee == 1) {
$content .= "<Marquee Behavior=\"Scroll\" Direction=\"$scrolldirection\" ScrollAmount=\"2\" ScrollDelay=\"100\" onMouseOver=\"this.stop()\" onMouseOut=\"this.start()\"><br>";
}

// Latest added
$content .= $latest."<br>";
$a = 1;
$sql = "select lid, title, hits from ".$prefix."_downloads_downloads order by date DESC limit 0,$downloadstoshow";
$result = $db->sql_query($sql);

while($row = $db->sql_fetchrow($result)) {
$title2 = ereg_replace ("_", " ", $row[title]);
$transfertitle = str_replace(" ", "_", $row[title]);
$content .= "<strong><big>&middot;</big></strong>&nbsp;$a: <a title=\"$title2\" href=\"downloadview-details-$row[lid]-$transfertitle.html\">$title2</a><br>[$hitstext: ".$row['hits']."]<br><br>";
$a++;
}

// Most downloaded
$content .= "<br>".$most."<br>";
$a = 1;
$sql = "select lid, title, hits from ".$prefix."_downloads_downloads order by hits DESC limit 0,$downloadstoshow";
$result = $db->sql_query($sql);

while($row = $db->sql_fetchrow($result)) {
$title2 = ereg_replace ("_", " ", $row[title]);
$transfertitle = str_replace(" ", "_", $row[title]);
$content .= "<strong><big>&middot;</big></strong>&nbsp;$a: <a title=\"$title2\" href=\"downloadview-details-$row[lid]-$transfertitle.html\">$title2</a><br>[$hitstext: ".$row['hits']."]<br><br>";
$a++;
}
?>

_________________
Brian [ Only registered users can see links on this board! Get registered or login! ]
Helping the Children in the NM Children's Hospital 
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Thu Apr 28, 2005 10:13 am Reply with quote

That would seem to indicate that there is a problem with accessing the tables. Have you checked your server error log? Add this line to your .htaccess and see if that reveals anything.

PHP_FLAG display_errors on
 
View user's profile Send private message
Tizwit







PostPosted: Thu Apr 28, 2005 10:27 am Reply with quote

Added the above code in the .htaccess file but I don't see anything different
 
Raven







PostPosted: Thu Apr 28, 2005 10:30 am Reply with quote

So there are no errors in the server error log?
 
Tizwit







PostPosted: Thu Apr 28, 2005 10:40 am Reply with quote

Not that I can find

The only error log I have is that of someone trying to access a page that is not existant.. over and over and over.
 
Tizwit







PostPosted: Wed May 11, 2005 10:32 pm Reply with quote

Any Help/Ideas Neutral with this?
 
64bitguy
The Mouse Is Extension Of Arm



Joined: Mar 06, 2004
Posts: 1164

PostPosted: Thu May 12, 2005 11:24 am Reply with quote

First off, I would note that it looks like the links in this block are "Google Tapped" and the site you described isn't.

Next, when you say that it doesn't work, can you be more specific? Does the block not show up? Etc...

Next, what version of Nuke are you using and what is the patched revision?

Thanks

_________________
Steph Benoit
100% Section 508 and W3C HTML5 and CSS Compliant (Truly) Code, because I love compliance. 
View user's profile Send private message
Tizwit







PostPosted: Thu May 12, 2005 1:37 pm Reply with quote

The Site that I am having the problem with is [ Only registered users can see links on this board! Get registered or login! ] The downloads do not appear to show up in the module. The same module is loaded on my [ Only registered users can see links on this board! Get registered or login! ] website and it works perfectly that is why I think it is due to the fact that the TwistedNurse site is an add on domain.

I do think the version is the patched 7.5 if I remember right.
 
Raven







PostPosted: Thu May 12, 2005 3:34 pm Reply with quote

My site is an addon domain and it works just fine, so I doubt that is the problem. Unfortunately I don't have any thoughts on resolution either.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©