Jump to content

Total Per Day..


dc2007

Recommended Posts

Hi i have a php mysql query where it see how many attachments users have downloaded per day but i need it to reset at each users midnight but at the moment its no its just removing one each time its 24 hour after.

 


if($row['postdate'] <= (time()-$permissions['ugpindexretention']*24*60*60) AND ($vbulletin->userinfo['userid'] != $row['owner']) AND (!in_array($vbulletin->userinfo['usergroupid'], array(6))))
{
standard_error("Sorry you can only download 10 attachments per 24 hours.");
}

Link to comment
Share on other sites

thanks for that mate but it was the wrong code lol here the proper one

 

for the download file

 

    $grabs= $db->query_first("
        SELECT COUNT(*) AS `grab`
        FROM " . TABLE_PREFIX . "downloaded AS down
        WHERE down.userid = '" . $vbulletin->userinfo['userid'] . "'
	AND down.time > NOW() - INTERVAL 24 HOUR
    ");
    $vbulletin->db->free_result($grabs);  
    $totgrabs = $grabs['grab'];


if($totgrabs >= $permissions['ugpindexperday'])
{
standard_error("You have reached you daily download limit of 10");
}

 

and for the display of how many the member had downed

 

$perd = $vbulletin->db->query_first("
        SELECT COUNT(*) AS `perday`
        FROM " . TABLE_PREFIX . "downloaded AS down
        WHERE down.userid = '" . $vbulletin->userinfo['userid'] . "'
AND down.time >= NOW() - INTERVAL 24 HOUR
    ");
    $vbulletin->db->free_result($perd);  
    $downed = $perd['perday'];

 

but its displaying 0

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.