Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

PHP Script for 30 days premium

$
0
0
Hello! I have a site with premium memberships, but PHP script is not working well..
 
I the table accounts I have a column called reset_timer(default value is 0). When someone purchase a new premium membership, PHP add with time(); function into the reset_timer.
 
Premium is 1 month yes and is working well, but the "countdown" script is not working, the script take only the first reset_timer value so for example if the user1 purchase premium membership today, after 5 days, he have 25 days left, but if somebody in another account purchase 1 month of premium, he have 25 days left too, because script only taking the first reset_timer value.. This is the code:
 
function time_reset()
{
    $now = time();
    DB::select('accounts');
    $timer = DB::fetch_row();   
    $timer = $timer['reset_timer'];
    $difference = ($now - $timer);
    return (2629743 - $difference);
}
 
This is my table structure:
x7vhb.png
 
How I can do it for the script look in every account and reset timer for work correctly?
 
Thank you very much!

Viewing all articles
Browse latest Browse all 13200

Trending Articles