also, I made some edits to the index.php code edits. I feel its better, but just my opinion. Also the input is sanitized for numbers only in the files above. Avoid potential issues. Thanks to OXYDE for creating this mod
//Common Pot (By OXYDE - torrenttrader.uk)
if ($site_config['COMMONPOT']){
begin_frame(T_("COMMONPOT"));
$res_commonpot = SQL_Query_exec("SELECT SUM(points) AS total FROM commonpot");
$pot = mysqli_fetch_array($res_commonpot);
$percent = (($pot["total"] / $site_config["COMMONPOT_SIZE"]) * 100);
$res_commonpot_status = SQL_Query_exec("SELECT * FROM commonpot_status");
$pot_status = mysqli_fetch_array($res_commonpot_status);
$now = get_date_time();
$delay = $site_config["FREELEECH_TIME"];
if ($delay >= 8760) {
$delay = floor($delay / 8760);
$unit = "years";
} elseif ($delay >= 720) {
$delay = floor($delay / 720);
$unit = "months";
} elseif ($delay >= 24) {
$delay = floor($delay / 24);
$unit = "days";
} else {
$unit = "hours";
}
$duration = date("M j, Y g:i a", strtotime(" + $delay $unit"));
$stop_date = date("M j, Y g:i a", strtotime("+ $delay $unit", strtotime($pot_status['start_date'])));
if ($pot_status["status"] == "stopped" && $pot["total"] == $site_config["COMMONPOT_SIZE"]) {
$status_text = "<font color='#00FF00'>The pot is full and freeleech will start in the next few minutes!</font>";
$participate = "";
}
elseif ($pot_status["status"] == "started" && $stop_date <= $now) { $status_text = "<font color='#00FF00'>FreeLeech is over and pot will be reset in the next few minutes.</font>"; $participate = ""; }
elseif ($pot_status["status"] == "started") { $status_text = "The pot is full and freeleech is <font color='#BFFF00'><b>ACTIVE</b></font> for <font color='#ffcd03'><b> $delay $unit</b></font> for everyone!<br>It will end on </b><font color='#FFA500'><b>" . date( "M j, Y g:i a", utc_to_tz_time( $pot_status['stop_date'] ) ) . "</b>"; $participate = "";
} else {
$status_text = "$delay $unit of freeleech will be offered for everyone when the common pot is 100% full. Help increase the pot!";
$participate = "<input type='button' value='Add to the pool' onclick='window.location.href = \"commonpot.php\"'>";
}
if (empty($pot["total"])) { $pot_total = "0"; } else { $pot_total = $pot["total"]; }
?>
<table align='center'><tr><td style='padding: 0px; width: 500px; background-image: url(<?= $site_config["LOADBAR_IMG"] ?>loadbarbg.gif); background-repeat: repeat-x'>
<?php
if ($percent <= 40)
$pic = "loadbarred.gif";
elseif ($percent <= 70)
$pic = "loadbaryellow.gif";
else
$pic = "loadbargreen.gif";
$width = $percent * 5;
$history = "<input type='button' value='Who else contributed?' onclick='window.location.href = \"commonpot-history.php\"'>";
if ($percent >= .001) {
echo "<img src='" . $site_config["LOADBAR_IMG"] . $pic . "' height='15' width='$width' alt='$percent%'><div style='position:relative;top:-15px;margin:auto;width:50%;color:#000;text-align:center;font-weight:bold;'>" . $pot_total . " / " . $site_config["COMMONPOT_SIZE"] . " [" . rtrim(rtrim((string)number_format($percent, 3, ".", ""), "0"), ".") . "%]</div><div style='float:right;'><br /><p align='right' style='font-size:13px;color:#FFF;font-weight:bold;'>" . $participate . "</p><p align='right' style='font-size:13px;color:#FFF;font-weight:bold;'><br />".$history."</p></div>" . $status_text;
} else {
echo "<img src='" . $site_config["LOADBAR_IMG"] . $pic . "' height='15' width='$width' alt='$percent%'><div style='position:relative;top:-15px;margin:auto;width:50%;color:#000;text-align:center;font-weight:bold;'>" . $pot_total . " / " . $site_config["COMMONPOT_SIZE"] . " [" . rtrim(rtrim((string)number_format($percent, 3, ".", ""), "0"), ".") . "%]</div><div style='float:right;'><p align='right' style='font-size:13px;color:#FFF;font-weight:bold;'>" . $participate . "</p></div>" . $status_text;
}
echo "</td></tr>";
echo "</table>";
end_frame();
}
//End Common Pot (By OXYDE - torrenttrader.uk)