Hello,
I was wondering if it would be possible to switch from days to hours in the system.
What I would want is that instead of "Download volume x in y days" to have "Download volume x in y hours" and even more if the system could check the number downloads made by an IP or user within a certain amount of time would be great. Something like "You can download x times in y hours".
Would this be possible?
Thank you,
Nick
XFileSharing Pro - Possibility to switch from days to hours
- PilgrimX182
- Posts: 2186
- Joined: Mar 22, 2006 1:39 pm
Nothing is impossible in SibSoft
To change days to hours here's quick hack:
in index.cgi find these 2 lines:
and replace "DAY" with "HOUR" in 1st line, and then replace "days" with "hours" in 2nd line.
Use the same field in config, only it will be hours, not days.
To change days to hours here's quick hack:
in index.cgi find these 2 lines:
Code: Select all
my $bw = $db->SelectOne("SELECT SUM(size) FROM IP2Files WHERE ip=INET_ATON(?) AND created > NOW()-INTERVAL ? DAY",$ses->getIP,$c->{bw_limit_days});
$ses->message("You have reached the download-limit: $c->{bw_limit} Mb for last $c->{bw_limit_days} days") if ($bw > 1024*1024*$c->{bw_limit});
Use the same field in config, only it will be hours, not days.
Re: Possibility to switch from days to hours
Hehe I know nothing is impossible, just wanted to tease you
What about the second option?
Nick
What about the second option?
Thank you,Nick wrote:Hello,
[..] and even more if the system could check the number downloads made by an IP or user within a certain amount of time would be great. Something like "You can download x times in y hours".
Nick
I'm a bit confused to be honest
I have in index.cgi:
which i presume it is correct.
Now, in XFileConfig.pm i have the following:
Where should I change the values in config?
Thank you,
Nick
I have in index.cgi:
Code: Select all
my $bw = $db->SelectOne("SELECT SUM(size) FROM IP2Files WHERE ip=INET_ATON(?) AND created > NOW()-INTERVAL ? HOUR",$ses->getIP,$c->{bw_limit_hours});
$ses->message("You have reached the download-limit: $c->{bw_limit} Mb for last $c->{bw_limit_hours} hours") if ($bw > 1024*1024*$c->{bw_limit});
Now, in XFileConfig.pm i have the following:
Code: Select all
# Used for BW limit
bw_limit_days => '1',
# Limit Max bandwidth for IP per 'bw_limit_days' days
bw_limit_anon => '100',
# Incrementally limit bandwidth per day
bw_daily_limit_anon => '100',
# Limit Max bandwidth for IP per 'bw_limit_days' days
bw_limit_reg => '500',
# Incrementally limit bandwidth per day
bw_daily_limit_reg => '500',
# Limit Max bandwidth for IP per 'bw_limit_days' days
bw_limit_prem => '3000',
# Incrementally limit bandwidth per day
bw_daily_limit_prem => '0',
Thank you,
Nick
- PilgrimX182
- Posts: 2186
- Joined: Mar 22, 2006 1:39 pm
add this code after that 2 lines:
and add 2 keys into XFileConfig.pm:
which means max 5 downloads last 3 hours.
Code: Select all
my $dlnum = $db->SelectOne("SELECT COUNT(*) FROM IP2Files WHERE ip=INET_ATON(?) AND created > NOW()-INTERVAL ? HOUR",$ses->getIP,$c->{limit_maxdl_hours});
$ses->message("You have reached the download-limit: $c->{limit_maxdl_num} downloads for last $c->{limit_maxdl_hours} hours") if $dlnum > $c->{limit_maxdl_num};
Code: Select all
limit_maxdl_num => 5,
limit_maxdl_hours => 3,
- PilgrimX182
- Posts: 2186
- Joined: Mar 22, 2006 1:39 pm
Damn. You've made wrong edit. Here's correct code for 1st feature:
Code: Select all
my $bw = $db->SelectOne("SELECT SUM(size) FROM IP2Files WHERE ip=INET_ATON(?) AND created > NOW()-INTERVAL ? HOUR",$ses->getIP,$c->{bw_limit_days});
$ses->message("You have reached the download-limit: $c->{bw_limit} Mb for last $c->{bw_limit_days} hours") if ($bw > 1024*1024*$c->{bw_limit});
Corrected and added the lines.
Now the premium page looks like this:
http://www.self-share.com/premium.html
I'll PM you with links for downloading index.cgi and XFileConfig.cgi as it seems I'm still doing it wrong
Nick
Now the premium page looks like this:
http://www.self-share.com/premium.html
I'll PM you with links for downloading index.cgi and XFileConfig.cgi as it seems I'm still doing it wrong
Nick