Znote / ZnoteAAC

Developement repository for the Znote AAC project. A website portal to represent and manage your Open Tibia server.
MIT License
143 stars 127 forks source link

[V2] CHANGE UNIX_TIMESTAMP(CURDATE()) TO UNIX_TIMESTAMP(NOW()) #512

Open mano368 opened 2 years ago

mano368 commented 2 years ago

Hello,

When making a test purchase, I verified that when using CURDATE(), only 5 hours of premium was added to the account, instead of 24 hours. Switching to NOW() seems to have fixed the problem by adding 24 hours!

Engine->Function->users.php

// Add additional premium days to account id
function user_account_add_premdays($accid, $days) {
    $accid = (int)$accid;
    $days = (int)$days;
    mysql_update("
        UPDATE `accounts` 
        SET `premium_ends_at` = GREATEST(`premium_ends_at`, UNIX_TIMESTAMP(NOW())) + ({$days} * 86400)
        WHERE `id`='{$accid}';
    ");
}

If this error has to do with the webserver, please disregard and I apologize in advance.