/groupChat/storeGroupMessage.php |
@@ -14,14 +14,8 @@ |
## CONFIGURATION ## |
########################################################################### |
|
# Set this to the name of the group. |
$GROUP = 'My Group'; |
# How many chat lines to store? |
$CHAT_LINES = 10; |
# Set this to the group password. |
$PASSWORD = 'mypassword'; |
# Set this to Corrade's HTTP Server URL. |
$URL = 'http://corrade.hostname:8080'; |
require_once('config.php'); |
require_once('functions.php'); |
|
########################################################################### |
## INTERNALS ## |
@@ -32,38 +26,13 @@ |
# Check that the notification is for the configured group. |
if(!isset($_POST['group']) || $_POST['group'] != $GROUP) return; |
# Bail if "firstname", "lastname" or the "message" variables are blank. |
if($_POST['firstname'] == '' |
|| $_POST['lastname'] == '' |
|| $_POST['message'] == '') return; |
if(!isset($_POST['firstname']) || |
empty($_POST['firstname']) || |
!isset($_POST['lastname']) || |
empty($_POST['lastname']) || |
!isset($_POST['message']) || |
empty($_POST['message'])) return; |
|
########################################################################### |
## Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 ## |
########################################################################### |
function atomized_put_contents($file, $data) { |
$fp = fopen($file, "w+"); |
if (flock($fp, LOCK_EX)) { |
fwrite($fp, $data); |
fflush($fp); |
flock($fp, LOCK_UN); |
} |
fclose($fp); |
} |
########################################################################### |
## Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 ## |
########################################################################### |
function atomized_get_contents($file) { |
$fp = fopen($file, "r+"); |
$ct = ''; |
if (flock($fp, LOCK_SH)) { |
if (filesize($file)) { |
$ct = fread($fp, filesize($file)); |
} |
flock($fp, LOCK_UN); |
} |
fclose($fp); |
return $ct; |
} |
|
#### |
# I. Initialize a new blank array. |
$data = array(); |