<?php
include "../cfg.php";
$result = $db->query("
SELECT * FROM members
ORDER BY `monthlyscore` DESC
LIMIT 5;
");// get winners
$monthly_winners = mysql_fetch_array($result);
$winners_list = "";
$i = 0;
foreach ($monthly_winners as $monthly_winner)
{
$i++;
$winners_list.= "Monthly Rank ".$i.": ".$monthly_winner['username']." with ".$monthly_winner['monthlyscore']." points!\n";
// email every winner
mail("Admin@VIPortals.com", "VIPortals - Congradulations on Winning, ".$monthly_winner['username']."!!!",
"Hello ".$monthly_winner['username'].",\n\nCONGRADULATIONS!!! You are one of this month's Monthly VIPortals $$$ Winners!\n\n
Your Monthly Rank is ".$i." with ".$monthly_winner['monthlyscore']." points!\n\n
In order to receive your winnings, simply reply to this email your PayPal Email Address, and you will receive your winnings as soon we get them. Your patience is required, and if you disobey any of our rules, found on our site found at 'http://www.viportals.com/index.php?params=page/5/', we will cancel your payment.\n\n
Please understand that your winnings will depend solely on the site's profit and your ranking.\n\n
Thank you very much for being such an active participant on my site. I hope to see more of you, and wish you the best of luck in the new month's contest!\n\n
Regards,\n\n
The VIPortals Admin",
"From:
Admin@VIPortals.com");
}
// send top 10 to my email
mail("Admin@VIPortals.com", "Monthly VIPortals $$$ Winners", $winners_list, "From:
Admin@VIPortals.com");
// update player monthly scores
$db->query("UPDATE members
SET `lastmonthscore`=`viportalsscore`,
`monthlyscore`=0
WHERE 1=1");
?>