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
https://forums.phpfreaks.com/topic/264811-total-per-day/
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
https://forums.phpfreaks.com/topic/264811-total-per-day/#findComment-1357147
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.