View Full Version : Download Limits for PAFILEDB
ksb
March 26th, 2007, 20:07
Anyone know how to make it possible for PAFileDB Download Program to check IP's and only allow the user of that IP a certain amount of downloads per day??
I need to find a way to preserve bandwith so any help would be awesome
((alternatively if anyone has anyother sort of ideas for this endavor please share them too))
krakjoe
March 27th, 2007, 08:14
post some code and I will know .......
Hamed
March 27th, 2007, 16:11
Yes I need it too.
ksb
March 29th, 2007, 15:05
here is the index.php
<?php
/************************************************************ ***
* paFileDB 3.6 *
* *
* Author: PHP Arena <http://www.phparena.net> *
* File Version 3.6 *
* Copyright ©2005-2007 PHP Arena. All Rights Reserved. *
* *
* THIS FILE MAY NOT BE REDISTRIBUTED. *
* For more information, please see the PHP Arena license at: *
* http://www.phparena.net/license.html *
************************************************************ ***/
if (file_exists('install')) { die("Please remove the install directory to use paFileDB!"); }
if (file_exists('upgrade')) { die("Please remove the upgrade directory to use paFileDB!"); }
//Start the execution timer
$starttime = microtime();
$starttime = explode(" ",$starttime);
$starttime = $starttime[1] + $starttime[0];
//Require the important files so paFileDB isn't paUselessScript
require('./includes/smarty/Smarty.class.php');
require('./includes/functions.php');
include('./includes/adodb/adodb-errorhandler.inc.php');
include('./includes/adodb/adodb.inc.php');
require('./includes/config.php');
/*Get $act from the query string, set to main if $act is unset
(only time its unset is on the main page */
if (!isset($_GET['act'])) { $act = 'main'; } else { $act = $_GET['act']; }
//Load paFileDB settings into $settings array
$settings = $db->GetArray("SELECT * FROM ".$dbPrefix."settings");
$version = '3.6';
//This stops any l33t h4x0ring of paFileDB. Just an extra security measure
$allowed_acts = array('main', 'category', 'view', 'download', 'viewall', 'search', 'email', 'license', 'mirror', 'report', 'stats', 'login', 'register', 'comments', 'myoptions', 'lostpw', 'viewtag');
if (!in_array($act, $allowed_acts))
{
die("Invalid Action!");
}
//Get Smarty set up and load the right language file
$smarty = new Smarty();
$smarty->config_booleanize = false;
init_smarty($settings[0]['skin']);
$smarty->config_load('english.conf');
if ($settings[0]['lang'] != "english") { $smarty->config_load($settings[0]['lang'].'.conf'); }
$smarty->config_load('config.conf');
$smarty->assign('settings', $settings[0]);
$smarty->assign('act');
$smarty->assign('version', $version);
require('./includes/auth.php');
if (($settings[0]['require_registration'] == 1 && $userinfo[0]['user_userid'] == 0) && ($act != "login" && $act != "register" && $act != "lostpw")) {
$logreg = '<br /><br /><a href="'.$settings[0]['dburl'].'/index.php?act=login&qs='.urlencode($_SERVER['QUERY_STRING']).'">'.lang('login').'</a> - <a href="'.$settings[0]['dburl'].'/index.php?act=register">'.lang('register').'</a>';
smarty_error(lang('login_view').$logreg);
}
//Require the file that actually does what we want
require('./includes/'.$act.'.php');
//Display the header
$smarty->display('header.tpl');
//Display the template for whatever page we're showing
$smarty->display($act.'.tpl');
//Calculate execution time
$endtime = microtime();
$endtime = explode(" ",$endtime);
$endtime = $endtime[1] + $endtime[0];
$stime = $endtime - $starttime;
dropDown($settings[0]['dropdown']);
//Send exec time and queries used to Smarty
$smarty->assign('debug_info', array($db->query_count, round($stime,5)));
//Display the footer
$smarty->display('footer.tpl');
?>
ksb
April 4th, 2007, 22:45
anyone???
krakjoe
April 5th, 2007, 02:56
I don't think that's the file that does the downloading, there are no header statements in there .... try again .......
ksb
April 10th, 2007, 15:23
this should be it, its download.php in the includes folder. Sorry about the other one :X
<?php
/************************************************************ ***
* paFileDB 3.6 *
* *
* Author: PHP Arena <http://www.phparena.net> *
* File Version 3.6 *
* Copyright ©2005-2007 PHP Arena. All Rights Reserved. *
* *
* THIS FILE MAY NOT BE REDISTRIBUTED. *
* For more information, please see the PHP Arena license at: *
* http://www.phparena.net/license.html *
************************************************************ ***/
if ($settings[0]['require_registration'] == 2 && $userinfo[0]['user_userid'] == 0) {
$logreg = '<br /><br /><a href="'.$settings[0]['dburl'].'/index.php?act=login&qs='.urlencode($_SERVER['QUERY_STRING']).'">'.lang('login').'</a> - <a href="'.$settings[0]['dburl'].'/index.php?act=register">'.lang('register').'</a>';
smarty_error(lang('login_download').$logreg);
}
//Fetch the file info from the database
$file = $db->GetArray("SELECT * FROM ".$dbPrefix."files WHERE file_id = ".intval($_GET['id']));
if (count($file) == 0) {
smarty_error(lang('file_exist'));
}
$file = $file[0];
//Update stuff
$db->Execute("UPDATE ".$dbPrefix."files SET file_dls = file_dls + 1, file_last = ".time()." WHERE file_id = ".intval($_GET['id']));
if (isset($_GET['mirror'])) {
$mirrors = unserialize($file['file_mirrors']);
smarty_redirect(str_replace('{fileurl}',$file['file_dlurl'], lang('download_message')), $mirrors[$_GET['mirror']]['url'], true);
} else {
smarty_redirect(str_replace('{fileurl}',$file['file_dlurl'], lang('download_message')), $file['file_dlurl'], true);
}
?>
ksb
April 13th, 2007, 20:55
once again.....anyone.....or should i just give up =)
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.