One more bug I've found.....The Sort feature doesen't work on the "ViewAll Files" page, just returns back to the categories.
Code: Select all
<?php
/*
paFileDB 3.0
©2001/2002 PHP Arena
Written by Todd
[email protected]
http://www.phparena.net
Keep all copyright links on the script visible
Please read the license included with this script for more information.
*/
/*You need to change these variables to get paFileDB working. If you are unsure of this information, please contact your host to obtain this information*/
$db[host] = "mysql.tfcgaschamber.com"; //This is the MySQL server paFileDB will connect to
$db[user] = "******"; //This is the MySQL user name
$db[pass] = "********"; //This is the MySQL password
$db[name] = "phpBB2dino"; //This is the MySQL database paFileDB will put it's information in
/*
This is the MySQL table name prefix. The default is "pafiledb" but if you wish to install multiple copies of
paFileDB on the same database, change this to something like "pafiledb2." All tables in the MySQL database will
be named "$prefix_files," "$prefix_license" ect, for example: "pafiledb_files" and "pafiledb2_files." That will
allow multple copies of paFileDB on the same database. If you are only installing one copy of paFileDB, you dont
need to change this. NOTE: Your host does not have this information, it is up to you to set it to what you want.
If you are upgrading from an older version of paFileDB, you MUST keep this as "pafiledb"
*/
$db[prefix] = "pafiledb"; //Table name prefix-explained above.
/*Don't mess with anything below here unless you know what you're doing!*/
class pafiledb_sql {
function query($db,$query,$type) {
$result = mysql_query($query);
$error = mysql_error();
global $query_count;
global $queries_used;
$query_count++;
$queries_used .= "<tr><td width=\"100%\" align=\"left\" class=\"datacell\">$query</td></tr>";
if (!empty($error)) {
$errno = mysql_errno();
$this->error("paFileDB was unable to successfully run a MySQL query.<br>MySQL Returned this error: <b>$error</b> Error number: <b>$errno</b><br>The query that caused this error was: <b>$query</b>");
}
if ($type == 0) {
return $result;
}
if ($type == 1) {
$array = mysql_fetch_array($result);
return $array;
}
if ($type == 2) {
$array = mysql_num_rows($result);
return $array;
}
if ($type == 3) {
$array = mysql_insert_id();
return $array;
}
@mysql_free_result($result);
}
function error($error) {
die($error);
}
function connect($db) {
if(!($dbc = mysql_connect($db[host],$db[user],$db[pass]))) $this->error("paFileDB was unable to successfully connect to the MySQL database. Check your settings including the MySQL server, username, and password and try again.");
if(!(mysql_select_db($db[name],$dbc))) $this->error("paFileDB was able to connect to the MySQL database, but was unable to select the database <b>$db[name]</b> to use.");
}
}
$pafiledb_sql = new pafiledb_sql;
?>
Code: Select all
<?php
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////Top Files in Main Page Addon for PafileDB (http://www.phparena.net)//////
//////////Written by Wh1t3w0lf ([email protected]) (fixed by NightWolf www.belesh.net )/////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Instructions:
//Change the settings bellow (and the layout in the bottom of this file if you wish).
//After that put include this file in the page and in the place where you want to show the top files
//via the include php command
//Settings
$dbhostname= "localhost"; //Your MySQL Host name
$dbusername= "your_username"; //Your MySQL Username
$dbpassword= "your_password"; //Your MySQL Password
$dbdatabase= "databasename_pafiledb"; //Your MySQL Database Name
$url= "http://www.yoursite.com/pafiledb/pafiledb.php"; //The Url where you have installed pafiledb.php e.g "http://www.yoursite.com/files/pafile.php"
$table ="pafiledb_files"; //Table name including the prefix
$topfilecount= 20; // Top X files to show. e.g Top 10
//Don't mess with the following :P
$db = @mysql_connect($dbhostname,$dbusername,$dbpassword);
if (!$db) {
echo( "<p>Unable to connect to the " .
"database server at this time.</p>" );
exit();
}
if (! @mysql_select_db($dbdatabase) ) {
echo( "<p>Error locating the file " .
"database at this time.</p >" );
exit();
}
$result = @mysql_query("SELECT file_id, file_name, file_dls FROM $table ORDER BY file_dls DESC", $db);
if (!$result) {
echo("<p>Error performing query: " . mysql_error() . "</p>");
exit();
}
$files = mysql_num_rows($result);
//Style. Change accoridngly e.g Add html tags or css styles to match your site's design.
echo "<body bgcolor='#E0E8EF' text='#000000' link='#2F486F' vlink='#2F486F' alink='#2F486F'>";
echo "<style>
body{
scrollbar-face-color: #DEE3E7;
scrollbar-highlight-color: #FFFFFF;
scrollbar-shadow-color: #DEE3E7;
scrollbar-3dlight-color: #D1D7DC;
scrollbar-arrow-color: #006699;
scrollbar-track-color: #A9BAC9;
scrollbar-darkshadow-color: #98AAB1;
}
A.pFo:link {color:#2F486F; text-decoration:overline;}
A.pFo:visited {color:#2F486F; text-decoration:overline;}
A.pFo:active {color:#2F486F; text-decoration:overline;}
A.pFo:hover {color:#8AA0B4; text-decoration:overline;}
</style>";
echo "<center><u><b>Top 20 Downloads</b></u>:";
echo "<br><center><font face='Arial, Helvetica, sans-serif' size='-1'>";
$i=1;
while (($myrow = mysql_fetch_row($result)) And ($i<=$topfilecount)){
$i=$i + 1;
echo "<a href='$url?action=file&id=$myrow[0]' target='_parent'>$myrow[1]</a><br>\n";}
///////////////////////////////////////////////////////////////////////////////
/////Top Files in Main Page Addon for PafileDB (http://www.phparena.net)///////
//////////Written by Wh1t3w0lf ([email protected])/////////////////
///////////////////////////////////////////////////////////////////////////////
?>
Narc0sis wrote: here's a toplist script mod for the original pafiledb 3 if you need it. its pretty basic, just lists the top 20 most downloaded files with each file on the list linking to the info about that file. i didnt write it and i dont have pafile integration installed but it works just fine for the regular pafiledb so maybe it will help you out some
danez wrote: hey i have pafiledb right now, and a bunch of stuff in it, is it possible to keep the stuff i have?
LordOden wrote: phpBB : Critical Error
Line : 285
File : /home/lordoden/lordoden.com/Forum2/includes/sessions.php
i get thgis error when trying to to dload.php
define('PAGE_DOWNLOAD', -12);
Dinosaur Gas wrote: Thanks, I didn't use your file, but it gave me the clue I needed to fix mine. I just had to add all the database connect info into the toplist.php and now it's all set.