| Server IP : 3.96.16.70 / Your IP : 216.73.216.15 Web Server : Apache System : Linux ip-172-31-26-103.ca-central-1.compute.internal 6.1.163-186.299.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Feb 24 16:35:42 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/registration.mining4life.org/wp-content/themes/m4l_theme/ |
Upload File : |
<?php
/* Template Name: Hold Em For Life Top 5 */
?>
<?php
global $wpdb;
// Top donors
$top5donors = $wpdb->get_results("SELECT post_id, SUM(amount) as total FROM wp_hefl_cctrans WHERE result_authorizationresult LIKE '%OK%' GROUP BY post_id ORDER BY total DESC LIMIT 5", ARRAY_A);
// Top Companies
$transactions = $wpdb->get_results("SELECT post_id, SUM(amount) as total FROM wp_hefl_cctrans WHERE result_authorizationresult LIKE '%OK%' GROUP BY post_id ORDER BY total DESC LIMIT 5", ARRAY_A);
$top5Companies = array();
foreach ($transactions as $trans) {
$sponsor = get_post_meta($trans['post_id'], 'guest_company', true);
if (!isset($top5Companies[$sponsor])) {
// Add this company to the array for the first time
$top5Companies[$sponsor] = $trans['total'];
} else {
// Add the transaction amount to the existing element in the array
$top5Companies[$sponsor] = $top5Companies[$sponsor] + $trans['total'];
}
}
// Top Tables
$transactions = $wpdb->get_results("SELECT post_id, SUM(amount) as total FROM wp_hefl_cctrans WHERE result_authorizationresult LIKE '%OK%' GROUP BY post_id ORDER BY total DESC", ARRAY_A);
$topTables = array();
foreach ($transactions as $trans) {
$table = get_post_meta($trans['post_id'], 'guest_tablenumber', true);
if (!isset($topTables[$table])) {
// Add this company to the array for the first time
$topTables[$table] = $trans['total'];
} else {
// Add the transaction amount to the existing element in the array
$topTables[$table] = $topTables[$table] + $trans['total'];
}
}
arsort($topTables);
$top5Tables = array_slice($topTables, 0, 5, true);
?>
<?php get_header('hefl_donationtracker'); ?>
<script>
$(document).ready(function() {
$('.hefl-total').fadeIn(500);
setTimeout(function() {
$('.hefl-total').fadeOut(1000, function() {
location.reload(true);
});
}, 60000);
});
</script>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:700" rel="stylesheet" type="text/css"><style>
html { box-sizing: border-box; margin: 0; padding: 0; }
*, *:before, *:after { box-sizing: inherit; }
html, body { background: #fff; height: 100%; width: 100%; margin: 0; padding: 0; }
body {
background-image: url('<?php echo get_template_directory_uri(); ?>/images/donationtracker-bg.jpg');
background-repeat: no-repeat; background-position: center center; background-size: cover;
width: 100%;
max-width: 100%;
color: #fff;
font-size: 18px;
padding: 2em;
font-size: 18px;
}
body:before, body:after {
background: none !important;
height: 0 !important;
display: none !important;
}
.site { height: 100%; width: 100%; margin: 0; padding: 0; background: transparent; position: relative; }
.hefl-logo {
position: absolute; right: 50px; bottom: 50px; height: 285px; width: 285px;
background-image: url('<?php echo get_template_directory_uri(); ?>/images/dt-logo_2.png?ver=2');
background-repeat: no-repeat; background-position: center center;
}
.hefl-total {
display: none;
}
h1 {
margin-top: 0;
font-size: 1.5em;
}
ul {
overflow: auto;
padding: 0;
margin: 0;
width: 100%;
font-size: 0;
}
li {
font-size: 24px;
display: inline-block;
margin: 0 1% 0 1%;
padding: 1em;
border: 1px solid #fff;
background-color: rgba(255,255,255,0.2);
border-radius: 16px;
vertical-align: top;
min-height: 750px;
}
table {
table-layout: inherit;
width: 100%;
}
td {
line-height: 1.25em;
padding: 0 1em 2em 0;
vertical-align: top;
}
td.nopad {
padding-right: 0;
}
td.count {
width: 50px;
}
.number {
background-color: #fff;
color: #d0454a;
border-radius: 20px;
height: 40px;
width: 40px;
display: block;
text-align: center;
padding-top: 5px;
}
</style>
<div class="hefl-total">
<ul>
<li style="width: 37%;">
<h1>Top 5 Individual Buy-Ins</h1>
<table>
<?php
$count = 1;
foreach ($top5donors as $donor) :
$firstname = get_post_meta($donor['post_id'], 'guest_firstname', true);
$lastname = get_post_meta($donor['post_id'], 'guest_lastname', true);
$sponsor = get_post_meta($donor['post_id'], 'guest_company', true);
?>
<tr>
<td class="count nopad"><span class="number"><?php echo ($count); ?></span></td>
<td style="padding-top: 5px;"><?php echo ($firstname); ?> <?php echo ($lastname); ?></td>
<td style="padding-top: 5px;"><?php echo ($sponsor); ?></td>
<td style="padding-top: 5px;" class="nopad">$<?php echo (number_format($donor['total'])); ?></td>
</tr>
<?php
$count++;
endforeach;
?>
</table>
</li>
<li style="width: 34%;">
<h1>Top 5 Company Buy-Ins</h1>
<table>
<?php
$count = 1;
foreach ($top5Companies as $company => $amt) :
?>
<tr>
<td class="count nopad"><span class="number"><?php echo ($count); ?></span></td>
<td style="padding-top: 5px;"><?php echo ($company); ?></td>
<td style="padding-top: 5px;" class="nopad">$<?php echo (number_format($amt)); ?></td>
</tr>
<?php
$count++;
endforeach;
?>
</table>
</li>
<li style="width: 23%;">
<h1>Top 5 Table Buy-Ins</h1>
<table>
<?php
$count = 1;
foreach ($top5Tables as $tabl => $amt) : ?>
<tr>
<td class="count nopad"><span class="number"><?php echo ($count); ?></span></td>
<td style="padding-top: 5px;">Table <?php echo ($tabl); ?></td>
<td style="padding-top: 5px;" class="nopad">$<?php echo (number_format($amt)); ?></td>
</tr>
<?php
$count++;
endforeach;
?>
</table>
</li>
</ul>
</div>
<div class="hefl-logo"></div>
<?php get_footer('hefl_donationtracker'); ?>