HEX
Server: Apache
System: Linux vps-1289444.devslamantis.cl 3.10.0-1160.80.1.el7.x86_64 #1 SMP Tue Nov 8 15:48:59 UTC 2022 x86_64
User: vspt (1013)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/vspt/public_html/vinamar.vsptdigital.cl/wp-content/plugins/winwheel4wp/lib/ace_engine.php
<?php

if ( ! defined( 'ABSPATH' ) ) { exit; }

class winwheel4wp_ace_engine {

	private $db_run_log_table;

	public function __construct( $config ) {
		$this->db_run_log_table = $config;
	}
	
	public function count_spins( $args ) {
		global $wpdb;	
		return $wpdb->get_row($wpdb->prepare('SELECT COUNT(*) as count FROM '.$this->db_run_log_table.' WHERE wheel_id = %s AND '.$args['column'].' = %s AND timestamp > %s AND skip_counting = 0',
									  $args['wheel_hash'],
									  $args['form_data'],
									  time() - ($args['max_age'])))->count;
	}
	
	public function last_timestamp( $args ) {
		global $wpdb;
		return $wpdb->get_row($wpdb->prepare('SELECT timestamp FROM '.$this->db_run_log_table.' WHERE wheel_id = %s AND '.$args['column'].' = %s AND skip_counting = 0 ORDER BY timestamp DESC',
						  $args['wheel_hash'],
						  $args['form_data']))->timestamp;
	}
	
	public function remaining_minutes( $args ) {
		return ceil((($args['max_age']) - (time() - $this->last_timestamp( $args ) ))/60);
	}
	
}