summaryrefslogtreecommitdiffstats
path: root/ajax
diff options
context:
space:
mode:
authorSnap <snapwilliam@gmail.com>2015-04-25 22:30:21 -0700
committerSnap <snapwilliam@gmail.com>2015-04-25 22:30:21 -0700
commit79d3c716e38084beab01d34a5f49a5aee7e72526 (patch)
treef71ed377e66fa2f4447e331eb5dd44bc701626b1 /ajax
parente0979d05a26ee14ac20f3e8bc3a4f358a25041f4 (diff)
downloadpathery-79d3c716e38084beab01d34a5f49a5aee7e72526.tar.xz
Some work on the Chat.
Fixed bug where user could chat as "SERVER"
Diffstat (limited to 'ajax')
-rw-r--r--ajax/chat.ajax.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/ajax/chat.ajax.php b/ajax/chat.ajax.php
index 1574bde..576ab39 100644
--- a/ajax/chat.ajax.php
+++ b/ajax/chat.ajax.php
@@ -52,6 +52,9 @@ if (isset($_REQUEST['messages'])) {
}
}
//Don't lockout requests by holding the session file open!
+
+$isLoggedIn = ($_SESSION['accepted'] == 1);
+
session_write_close();
$userID = $_SESSION['userID'];
@@ -74,8 +77,19 @@ require_once('../includes/chats.php');
enterChannel($userID);
$sent = false;
+//User is sending a message
if (isset($_REQUEST['messages'])) {
$date = isMuted($userID);
+ if ($isLoggedIn !== true) {
+ $r[0]['error'] = 'Logged out';
+ $r[0]['serverMessage'] = 'true';
+ $r[0]['message'] = "Whoops, your session has timed out. Please sign in again.";
+ $r[0]['secondsSince'] = 0;
+ $r[0]['displayName'] = 'SERVER';
+ $r[0]['userID'] = null;
+ echo json_encode($r);
+ exit;
+ }
if ($date !== false) {
$r[0]['error'] = 'Muted';
$r[0]['serverMessage'] = 'true';