I have a php script I'm trying to alter. The original code is written to increase the countdown timer by a value pulled from SQL anytime a button is pressed.
What I've been trying to do is change the code so that the time doesn't increase but actually resets to a specific remaining time ONLY WHEN the timer is under a certain amount (say 60 seconds). For example: Button is pressed at 45 seconds remaining; Timer resets to 60 seconds remaining. Button pressed at 2 minutes does not affect the timer.
The original code looks like:
// Price increment
$auction['Auction']['start_price'] += $data['auction_price_increment'];
if(strtotime($auction['Auction']['end_time']) < time()) {
$auction['Auction']['end_time'] = date('Y-m-d H:i:s');
}
// Time increment
$auction['Auction']['end_time'] = date('Y-m-d H:i:s', strtotime($auction['Auction']['end_time']) + $data['auction_time_increment']);
if(strtotime($auction['Auction']['end_time']) < time()) {
$auction['Auction']['end_time'] = date('Y-m-d H:i:s');
}
I'd appreciate any and all ideas on how to do this.