diff options
Diffstat (limited to 'ajax_chat.php')
-rw-r--r-- | ajax_chat.php | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/ajax_chat.php b/ajax_chat.php deleted file mode 100644 index 2b6d909..0000000 --- a/ajax_chat.php +++ /dev/null @@ -1,84 +0,0 @@ -<?
-session_start();
-session_write_close();
-//Just doing this as evidence that $_SESSION as read-only is still available.
-$userID = $_SESSION['userID'];
-
-include('includes/chats.php');
-
-$sent = false;
-
-if ($_REQUEST['messages']) {
- $messages = $_REQUEST['messages'];
- $messages = explode("|:|", $messages);
- foreach ($messages as $message) {
- $message = chatFilter(stripslashes($message));
- $insertID = addchat($userID, $message);
- }
-
- $sent = true;
- //echo "IID:$insertID:";
-}
-
-
-if ($_REQUEST['getChatFromID']) {
- $getChatID = $_REQUEST['getChatFromID'];
- if ($sent) {
- //Wait .2 seconds
- usleep(200000);
- //echo "yesSent";
- for( $i = 1; $i < 3; $i++) {
- //echo "loop";
- $data = getChat($getChatID);
- if ($data !== false) {
- //$data['debug'][] = "Count times: $i";
- //$data['debug'][] = "Count value:".count($data);
- echo prepareChatData($data);
- exit;
- }
- //Wait .1 seconds
- usleep(100000);
- }
- }
- //echo "reachedEnd";
- $json = prepareChatData(getChat($getChatID));
- echo $json;
- exit;
-}
-
-function prepareChatData($data) {
- if ($data) {
- foreach($data as &$user) {
- //$user['message'] = $user['message'].'write-append';
- $user['secondsSince'] = strtotime($user['dateSent']) - strtotime("now");
- }
- return json_encode($data);
- }
- return $data;
-}
-
-
-
-function chatFilter($chat) {
- //cuss words
- $chat = str_replace("fuck you", "i am moron", $chat);
- $chat = str_replace("fuck", "dumb", $chat);
-
- $chat = str_replace("asshole", "dumb", $chat);
- $chat = str_replace("damnit", "dumb", $chat);
- $chat = str_replace("damn", "dumb", $chat);
- $chat = str_replace("cunt", "dumb", $chat);
- $chat = str_replace("shit", "dumb", $chat);
- $chat = str_replace("bitch", "dumb", $chat);
- $chat = str_replace("sucks ass", "is dumb", $chat);
- $chat = str_replace("suck ass", "is dumb", $chat);
- $chat = str_replace("stfu", "shutup", $chat);
- $chat = str_replace("omfg", "omg", $chat);
- $chat = str_replace("fuk", "dumb", $chat);
- return $chat;
-}
-
-
-
-
-?>
\ No newline at end of file |