print '<th>Label</th><th>Value</th><th>Points</th>'; $score = 0; $now = new DateTime(); for ($l = 1; $l <= sizeof($queries); $l++) { print '<tr>'; print '<td>' . $queries[$l][0] . '</td>'; $value = get_score($queries[$l][1]); if ($queries[$l][2] == 'date') { $date = new DateTime($value); $diff = $date->diff($now); $formula = 365 * $diff->format("%y") + 30 * $diff->format("%m") + $diff->format("%d"); print '<td>' . $formula . ' days</td>'; $formula = $formula - 365; } else { print '<td>' . $value . '</td>'; $formula = calculate_string($queries[$l][2] . $value); } $formula = max(min($formula, 100), -100); print '<td align=right><font color=' . get_color($formula) . '>' . $formula . '</font></td>'; $score += $formula; print '</tr>'; } print '<tr><td><b><big>Total score</big></b></td><td colspan=2 align=right><b><big>' . $score . '</big></b></td></tr>'; $mysqli->close(); print '</table>'; } function get_score($query) { global $mysqli; $res = $mysqli->query($query); if ($res) {
$results = strtolower($dbname); return $results; exit; } if (strpos(strtolower($dbtable), "fail") !== false) { $results = strtolower($dbtable); return $results; exit; } $dbconnection = connect_to_database($dbserv, $dbuser, $dbpass, $dbname); if (strpos(strtolower($dbconnection), "fail") !== false) { $results = strtolower($dbconnection); return $results; exit; } $minutes_to_components = calculate_string($_POST['minutes']); // Calculate as math string $query = mysql_query("UPDATE " . trim($dbtable) . " SET minutes='" . $minutes_to_components . "',ip_address='" . trim($_POST['ipaddress']) . "',user_name='" . trim(mysql_real_escape_string($_POST['username'])) . "',reason='" . trim(mysql_real_escape_string($_POST['reason'])) . "',visible_reason='" . trim(mysql_real_escape_string($_POST['visiblereason'])) . "' WHERE user_name='" . trim(mysql_real_escape_string($_POST['username'])) . "' AND time_from='" . trim($_POST['starttime']) . "'"); if (!query) { $results = "failed, " . mysql_error(); } if (strpos(strtolower($results), "fail") !== false) { echo $results; exit; } mysql_close($dbconnection); echo "Ban updated successfully."; } ?> </td> </tr>