diff --git a/bans.php b/bans.php
index dab6466..d315c36 100644
--- a/bans.php
+++ b/bans.php
@@ -10,6 +10,40 @@
+
+
+
+
+
+
@@ -37,9 +71,8 @@
global $table_bans, $conn;
$result = run_query($table_bans);
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
- date_default_timezone_set("UTC");
- $timeResult = date('F j, Y, g:i a', $row['time'] / 1000);
- $expiresResult = date('F j, Y, g:i a', $row['until'] / 1000);
+ $timeResult = millis_to_date($row['time']);
+ $expiresResult = millis_to_date($row['until']);
?>
|
diff --git a/check.php b/check.php
new file mode 100644
index 0000000..a7f5a19
--- /dev/null
+++ b/check.php
@@ -0,0 +1,33 @@
+prepare("SELECT uuid FROM " . $table_history . " WHERE name=? ORDER BY date LIMIT 1");
+ if ($stmt->execute(array($name))) {
+ if ($row = $stmt->fetch()) {
+ $uuid = $row['uuid'];
+ }
+ }
+ if (isset($uuid)) {
+ $stmt = $conn->prepare("SELECT * FROM " . $table_bans . " WHERE (uuid=? AND active=1) LIMIT 1");
+ if ($stmt->execute(array($uuid))) {
+ if ($row = $stmt->fetch()) {
+ $banner = get_banner_name($row['banned_by_name']);
+ $reason = $row['reason'];
+ $time = millis_to_date($row['time']);
+ $until = millis_to_date($row['until']);
+ echo($name . ' is banned!
');
+ echo('Banned by ' . $banner . '
');
+ echo('Reason: ' . $reason . '
');
+ echo('Banned on: ' . $time . '
');
+ echo('Banned until: ' . $until . '
');
+ } else {
+ echo($name . ' is not banned.');
+ }
+ }
+ } else {
+ echo($name . ' has not joined before.');
+ }
+}
+?>
\ No newline at end of file
diff --git a/includes/page.php b/includes/page.php
index 8c981c6..beeb6fd 100644
--- a/includes/page.php
+++ b/includes/page.php
@@ -32,4 +32,8 @@ function get_banner_name($banner) {
return $banner;
}
+function millis_to_date($millis) {
+ date_default_timezone_set("UTC");
+ return date('F j, Y, g:i a', $millis / 1000);
+}
?>
diff --git a/mutes.php b/mutes.php
index f63d3e4..1f5d576 100644
--- a/mutes.php
+++ b/mutes.php
@@ -27,9 +27,8 @@
global $table_mutes, $conn;
$result = run_query($table_mutes);
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
- date_default_timezone_set("UTC");
- $timeResult = date('F j, Y, g:i a', $row['time'] / 1000);
- $expiresResult = date('F j, Y, g:i a', $row['until'] / 1000);
+ $timeResult = millis_to_date($row['time']);
+ $expiresResult = millis_to_date($row['until']);
?>
|
diff --git a/warnings.php b/warnings.php
index ff1950d..b828801 100644
--- a/warnings.php
+++ b/warnings.php
@@ -34,8 +34,7 @@
global $table_warnings, $conn;
$result = run_query($table_warnings);
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
- date_default_timezone_set("UTC");
- $expiresResult = date('F j, Y, g:i a', $row['until'] / 1000);
+ $expiresResult = millis_to_date($row['until']);
?>
|