Facebook 

SMFHacks.com - Celebrating 20 Years!

+-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 4341
Latest: jmac32here
New This Month: 2
New This Week: 0
New Today: 0
Stats
Total Posts: 44306
Total Topics: 7676
Most Online Today: 365
Most Online Ever: 27044
(May 30, 2026, 09:10:16 pm)
Users Online
Members: 0
Guests: 204
Total: 204

Author Topic: Incorrect download counts!  (Read 27893 times)

0 Members and 1 Guest are viewing this topic.

Re: Incorrect download counts!
« Reply #15 on: »
Thanks again

Re: Incorrect download counts!
« Reply #16 on: »
Glad to help.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Re: Incorrect download counts!
« Reply #17 on: »
I still get this problem but I am not using credits.

I have it set for 6 downloads per month ( changed the code from 24*60*60 ) but can only download 1 file per 24 hours.

If the user tries to download before the 24 hours is up they get an error message saying x amount of minutes remain but then the script adds a download to the database so it is counting as a download when they havent actually received a download.

Also, a count down timer of time remaining to wait before the next download would be good.

Re: Incorrect download counts!
« Reply #18 on: »
What code did you use to get six downloads per month?
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Re: Incorrect download counts!
« Reply #19 on: »
This is the code I used.

 // Get the end date of the subscription
global $smcFunc, $user_info;



$request = $smcFunc['db_query']('', '
  SELECT end_time
  FROM {db_prefix}log_subscribed
  WHERE id_member = {int:member}',
  array(
    'member' => $user_info['id'],
  )
);
if ($smcFunc['db_num_rows']($request) != 0)
{
  list ($result) = $smcFunc['db_fetch_row']($request);
}
else
  $result = false;
$smcFunc['db_free_result']($request);

$enddate=$result;


   // Find total downloads for the last 24 hours
   $currenttime = time();
   
   //$last24hourstime = $currenttime  -  (1* 24 * 60 * 60);

$last24hourstime= $enddate - (30*24*60 *60);


Basically it is for paid subscriptions. It gets the end date of the susbscription and deducts 30 days from that date.

Just commented out
   //$last24hourstime = $currenttime  -  (1* 24 * 60 * 60);

And added the new code.

Re: Incorrect download counts!
« Reply #20 on: »
Just dis part doesn't give six downloads a month
$last24hourstime= $enddate - (30*24*60 *60);

Right now I think that would only allow one download a month?
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Re: Incorrect download counts!
« Reply #21 on: »
In admin you can set how many downloads per day.

I just changed the code but not the variable.

My site is solely monthly subscriptions - so the $enddate gets the end date of the subscription and takes 30 from before that to get the period

 

Related Topics

  Subject / Started by Replies Last post
2 Replies
8053 Views
Last post November 29, 2006, 10:00:34 pm
by Hawk
9 Replies
15139 Views
Last post November 18, 2016, 01:51:12 pm
by elbeer
7 Replies
9639 Views
Last post February 25, 2015, 09:34:14 pm
by SMFHacks
5 Replies
6119 Views
Last post December 02, 2017, 06:28:54 pm
by KKOG
4 Replies
4729 Views
Last post January 12, 2025, 02:02:47 pm
by SMFHacks

+- Recent Topics

Registration - anti bot pattern matching by SMFHacks
November 01, 2026, 07:20:17 pm

EZPortal 8 by davejo
October 21, 2026, 01:01:54 pm

Downloads Pro 7.0 Released by SMFHacks
October 07, 2026, 07:35:30 pm

[Mod]ActivityPub Federation for SMF 2.1 by SMFHacks
October 01, 2026, 05:03:45 pm

Newsletter Pro 4.0 Released by SMFHacks
September 23, 2026, 08:08:24 pm

Can't remove or restore any item from the recycle bin by SMFHacks
September 22, 2026, 11:01:51 am

MCP Server for SMF 2.1 - let Claude, ChatGPT or Cursor run your admin chores by SMFHacks
September 12, 2026, 02:50:45 pm

Suggestions for improvements to Ultimate Shoutbox & Chatroom by davejo
September 02, 2026, 01:35:09 am

Automatic Sorting of Categories by Kiwi
August 31, 2026, 12:36:09 am

' appears as ' in Most Viewed (and Recent Items ?) by SMFHacks
August 22, 2026, 11:01:56 pm

Powered by EzPortal